floo::BMXChatService

Chat Service

#include <bmx_chat_service.h>

Public Types

Name
enum class ThumbnailStrategy { ThirdpartyServerCreate = 1, LocalServerCreate}
Thumbnail generation policy,

Public Functions

Name
virtual ~BMXChatService()
virtual void sendMessage(BMXMessagePtr msg) =0
Send a message, and the message status change is notified via listener
virtual void resendMessage(BMXMessagePtr msg) =0
Resend this message, and the message status change is notified via listener
virtual void recallMessage(BMXMessagePtr msg) =0
Recall a message, and the message status change is notified via listener
virtual BMXErrorCode forwardMessage(const BMXMessageList & list, BMXConversationPtr to, BMXMessagePtr & newMsg) =0
Merge and forward messages
virtual void forwardMessage(BMXMessagePtr msg) =0
Simple forwarding messages, users should create forwarding messages first through BMXMessage:: createForwardMessage ()
virtual void ackMessage(BMXMessagePtr msg) =0
Send read acknowledgement
virtual void ackMessageDelivered(BMXMessagePtr msg) =0
Send delivery acknowledgement
virtual void ackPlayMessage(BMXMessagePtr msg) =0
Send an audio/video message playback acknowledgement
virtual void readCancel(BMXMessagePtr msg) =0
Mark this message as unread and synchronize to all devices of the current user
virtual void readAllMessage(BMXMessagePtr msg) =0
Mark this message and all previous messages as read, and synchronize to all current users' devices
virtual void removeMessage(BMXMessagePtr msg, bool synchronize =true) =0
Delete this message, which synchronizes to other devices of the current user
virtual void downloadThumbnail(BMXMessagePtr msg, ThumbnailStrategy strategy =ThumbnailStrategy::ThirdpartyServerCreate) =0
Download thumbnail, downloading state changes and progress notified via listener. Thumbnail generation policy: 1 - generated by third-party server, 2 - generated by local server, default 1.
virtual void downloadAttachment(BMXMessagePtr msg) =0
Downloaded attachments, and download state changes and progress are notified via listener
virtual void downloadAttachmentByUrl(int64_t msgId, const std::string & url, const std::string & path) =0
Downloaded attachments, and download state changes and progress are notified via listener
virtual void cancelUploadAttachment(BMXMessagePtr msg) =0
Cancel uploading attachment
virtual void cancelDownloadAttachment(BMXMessagePtr msg) =0
Cancel attachment downloading
virtual int transferingNum() =0
Number of uploading/downloading files
virtual BMXErrorCode insertMessages(const BMXMessageList & list) =0
Insert a message
virtual BMXMessagePtr getMessage(int64_t msgId) =0
Read a message
virtual void deleteConversation(int64_t conversationId, bool synchronize =false) =0
Delete a conversation
virtual BMXConversationPtr openConversation(int64_t conversationId, BMXConversation::Type type, bool createIfNotExist =true) =0
Launch a conversation
virtual std::string attachmentDir() =0
Get attachment saving path
virtual std::string attachmentDirForConversation(int64_t conversationId) =0
Get attachment saving path for a conversation
virtual BMXConversationList getAllConversations() =0
Get all conversations
virtual int getAllConversationsUnreadCount() =0
Get number of unread messages for all conversations (unreads for individuals and groups marked as blocked is not counted)
virtual BMXErrorCode retrieveHistoryMessages(BMXConversationPtr conversation, int64_t refMsgId, size_t size, BMXMessageList & result) =0
Pull message history
virtual BMXErrorCode searchMessagesByKeyWords(const std::string & keywords, int64_t refTime, size_t size, std::vector< BMXMessageList > & result, BMXConversation::Direction =BMXConversation::Direction::Up) =0
Search for messages by keyword
virtual BMXErrorCode searchMessages(const std::string & keywords, int64_t refTime, size_t size, std::vector< BMXMessageList > & result, BMXConversation::Direction =BMXConversation::Direction::Up) =0
Deprecated.
virtual BMXErrorCode getGroupAckMessageUserIdList(BMXMessagePtr msg, std::vector< int64_t > & groupMemberIdList) =0
Get the list of user-ids that have read group messages
virtual BMXErrorCode getGroupAckMessageUnreadUserIdList(BMXMessagePtr msg, std::vector< int64_t > & groupMemberIdList) =0
Get a list of unread user ids for the sent group message
virtual BMXErrorCode getGroupPlayAckMessageUserIdList(BMXMessagePtr msg, std::vector< int64_t > & groupMemberIdList) =0
Get the user id list for sent group audio/video messages played (for audio/video messages only)
virtual BMXErrorCode getGroupUnPlayAckMessageUserIdList(BMXMessagePtr msg, std::vector< int64_t > & groupMemberIdList) =0
Get the user id list for sent group audio/video messages unplayed (for audio/video messages only)
virtual void addChatListener(BMXChatServiceListener * listener) =0
Add chat listener
virtual void removeChatListener(BMXChatServiceListener * listener) =0
Remove chat listener

Protected Functions

Name
BMXChatService()
void updateMessageId(BMXMessagePtr msg, int64_t newId)

Public Types Documentation

enum ThumbnailStrategy

Enumerator Value Description
ThirdpartyServerCreate 1 Generated by third-party server
LocalServerCreate Generated by local server

Thumbnail generation policy,

Public Functions Documentation

function ~BMXChatService

inline virtual ~BMXChatService()

Example:

function sendMessage

virtual void sendMessage(
    BMXMessagePtr msg
) =0

Send a message, and the message status change is notified via listener

Parameters:

  • msg Message to be sent

Example:

client->sendMessage(msg);

function resendMessage

virtual void resendMessage(
    BMXMessagePtr msg
) =0

Resend this message, and the message status change is notified via listener

Parameters:

  • msg Resent message

Example:

function recallMessage

virtual void recallMessage(
    BMXMessagePtr msg
) =0

Recall a message, and the message status change is notified via listener

Parameters:

  • msg Recalled message

Example:

function forwardMessage

virtual BMXErrorCode forwardMessage(
    const BMXMessageList & list,
    BMXConversationPtr to,
    BMXMessagePtr & newMsg
) =0

Merge and forward messages

Parameters:

  • list List of messages to be forwarded
  • to The conversation to which message is forwarded
  • newMsg The newly generated single forwarded message from the merging list of messages to be forwarded

Return: BMXErrorCode

Example:

function forwardMessage

virtual void forwardMessage(
    BMXMessagePtr msg
) =0

Simple forwarding messages, users should create forwarding messages first through BMXMessage:: createForwardMessage ()

Parameters:

  • msg Messages to be forwarded

Example:

function ackMessage

virtual void ackMessage(
    BMXMessagePtr msg
) =0

Send read acknowledgement

Parameters:

  • msg Message requiring a read acknowledgement to be sent

Example:

function ackMessageDelivered

virtual void ackMessageDelivered(
    BMXMessagePtr msg
) =0

Send delivery acknowledgement

Example:

function ackPlayMessage

virtual void ackPlayMessage(
    BMXMessagePtr msg
) =0

Send an audio/video message playback acknowledgement

Parameters:

  • msg Message requiring a read acknowledgement to be sent

Example:

function readCancel

virtual void readCancel(
    BMXMessagePtr msg
) =0

Mark this message as unread and synchronize to all devices of the current user

Parameters:

  • msg The message needs to send “read recalled”

Example:

function readAllMessage

virtual void readAllMessage(
    BMXMessagePtr msg
) =0

Mark this message and all previous messages as read, and synchronize to all current users' devices

Parameters:

  • msg The message for which all earlier messages need to be marked as read

Example:

function removeMessage

virtual void removeMessage(
    BMXMessagePtr msg,
    bool synchronize =true
) =0

Delete this message, which synchronizes to other devices of the current user

Parameters:

  • msg Message to be deleted
  • synchronize Whether to synchronize to other devices, otherwise only the locally stored message will be deleted

Example:

function downloadThumbnail

virtual void downloadThumbnail(
    BMXMessagePtr msg,
    ThumbnailStrategy strategy =ThumbnailStrategy::ThirdpartyServerCreate
) =0

Download thumbnail, downloading state changes and progress notified via listener. Thumbnail generation policy: 1 - generated by third-party server, 2 - generated by local server, default 1.

Parameters:

  • msg Message requiring to download thumbnail
  • strategy Thumbnail generation policy, 1 - generated by third-party server, 2 - Generated by local server, default 1.

Example:

function downloadAttachment

virtual void downloadAttachment(
    BMXMessagePtr msg
) =0

Downloaded attachments, and download state changes and progress are notified via listener

Parameters:

  • msg Message requiring to download attachment

Example:

function downloadAttachmentByUrl

virtual void downloadAttachmentByUrl(
    int64_t msgId,
    const std::string & url,
    const std::string & path
) =0

Downloaded attachments, and download state changes and progress are notified via listener

Example:

function cancelUploadAttachment

virtual void cancelUploadAttachment(
    BMXMessagePtr msg
) =0

Cancel uploading attachment

Parameters:

  • msg Message requiring to cancel attachment uploading

Example:

function cancelDownloadAttachment

virtual void cancelDownloadAttachment(
    BMXMessagePtr msg
) =0

Cancel attachment downloading

Parameters:

  • msg Message requiring to cancel attachment downloading

Example:

function transferingNum

virtual int transferingNum() =0

Number of uploading/downloading files

Return: Number of files

Example:

function insertMessages

virtual BMXErrorCode insertMessages(
    const BMXMessageList & list
) =0

Insert a message

Parameters:

  • list Insert message list

Return: BMXErrorCode

Example:

function getMessage

virtual BMXMessagePtr getMessage(
    int64_t msgId
) =0

Read a message

Parameters:

  • msgId id of the message which needs to be fetched

Return: BMXMessagePtr

Example:

function deleteConversation

virtual void deleteConversation(
    int64_t conversationId,
    bool synchronize =false
) =0

Delete a conversation

Parameters:

  • conversationId Conversation id requiring to delete conversation
  • synchronize Whether to delete the conversation on other devices synchronously, default false, means only delete the conversation on the current device

Example:

function openConversation

virtual BMXConversationPtr openConversation(
    int64_t conversationId,
    BMXConversation::Type type,
    bool createIfNotExist =true
) =0

Launch a conversation

Parameters:

  • conversationId id of the conversation which needs to be opened
  • type Conversation type, single/group chat.
  • createIfNotExist Whether to create a local conversation if no conversation existing, default to create

Return: BMXConversationPtr

Example:

function attachmentDir

virtual std::string attachmentDir() =0

Get attachment saving path

Return: std::string

Example:

function attachmentDirForConversation

virtual std::string attachmentDirForConversation(
    int64_t conversationId
) =0

Get attachment saving path for a conversation

Parameters:

  • conversationId Conversation id requiring a conversation attachment path

Return: std::string

Example:

function getAllConversations

virtual BMXConversationList getAllConversations() =0

Get all conversations

Return: BMXConversationList

Example:

BMXConversationList conversationList = client->getChatService().getAllConversations();

function getAllConversationsUnreadCount

virtual int getAllConversationsUnreadCount() =0

Get number of unread messages for all conversations (unreads for individuals and groups marked as blocked is not counted)

Return: int

Example:

function retrieveHistoryMessages

virtual BMXErrorCode retrieveHistoryMessages(
    BMXConversationPtr conversation,
    int64_t refMsgId,
    size_t size,
    BMXMessageList & result
) =0

Pull message history

Parameters:

  • conversation Conversation for which message history needs to pull
  • refMsgId Start message Id for pulling conversation messages
  • size Maximum number of messages to pull
  • result List of messages fetched by pull operation, externally initializing an incoming empty list.

Return: BMXErrorCode

Example:

BMXErrorCode errorCode = client->getChatService().retrieveHistoryMessages(conversationList[0], 0, 10, list);

function searchMessagesByKeyWords

virtual BMXErrorCode searchMessagesByKeyWords(
    const std::string & keywords,
    int64_t refTime,
    size_t size,
    std::vector< BMXMessageList > & result,
    BMXConversation::Direction  =BMXConversation::Direction::Up
) =0

Search for messages by keyword

Parameters:

  • keywords Keyword for search
  • refTime Start time of message search
  • size Maximum number of messages to search
  • result List of searched message results, externally initializing an incoming empty list.
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

Example:

function searchMessages

virtual BMXErrorCode searchMessages(
    const std::string & keywords,
    int64_t refTime,
    size_t size,
    std::vector< BMXMessageList > & result,
    BMXConversation::Direction  =BMXConversation::Direction::Up
) =0

Deprecated.

Parameters:

  • keywords Keyword for search
  • refTime Start time of message search
  • size Maximum number of messages to search
  • result List of searched message results, externally initializing an incoming empty list.
  • Direction Message search direction, default (Direction::Up)means search from earlier messages.

Return: BMXErrorCode

use searchMessagesByKeyWords instead.

Search for messages

Example:

function getGroupAckMessageUserIdList

virtual BMXErrorCode getGroupAckMessageUserIdList(
    BMXMessagePtr msg,
    std::vector< int64_t > & groupMemberIdList
) =0

Get the list of user-ids that have read group messages

Parameters:

  • msg Message requiring to get list of read user ids
  • groupMemberIdList List of read user ids for this message, initially passed in as an empty list

Return: BMXErrorCode

Example:

function getGroupAckMessageUnreadUserIdList

virtual BMXErrorCode getGroupAckMessageUnreadUserIdList(
    BMXMessagePtr msg,
    std::vector< int64_t > & groupMemberIdList
) =0

Get a list of unread user ids for the sent group message

Parameters:

  • msg Message requiring to get list of unread user ids
  • groupMemberIdList List of unread user ids for this message, initially passed in as an empty list

Return: BMXErrorCode

Example:

function getGroupPlayAckMessageUserIdList

virtual BMXErrorCode getGroupPlayAckMessageUserIdList(
    BMXMessagePtr msg,
    std::vector< int64_t > & groupMemberIdList
) =0

Get the user id list for sent group audio/video messages played (for audio/video messages only)

Parameters:

  • msg Message requiring to get list of played user ids
  • groupMemberIdList List of played user ids for this message, initially passed in as an empty list

Return: BMXErrorCode

Example:

function getGroupUnPlayAckMessageUserIdList

virtual BMXErrorCode getGroupUnPlayAckMessageUserIdList(
    BMXMessagePtr msg,
    std::vector< int64_t > & groupMemberIdList
) =0

Get the user id list for sent group audio/video messages unplayed (for audio/video messages only)

Parameters:

  • msg Message requiring to get list of unplayed user ids
  • groupMemberIdList List of unplayed user ids for this message, initially passed in as an empty list

Return: BMXErrorCode

Example:

function addChatListener

virtual void addChatListener(
    BMXChatServiceListener * listener
) =0

Add chat listener

Parameters:

  • listener Chat listener

Example:

client->getChatService().addChatListener(chatListener);

function removeChatListener

virtual void removeChatListener(
    BMXChatServiceListener * listener
) =0

Remove chat listener

Parameters:

  • listener Chat listener

Protected Functions Documentation

Example:

mService->removeChatListener(this);
client->getChatService().removeChatListener(chatListener);

function BMXChatService

inline BMXChatService()

Example:

function updateMessageId

void updateMessageId(
    BMXMessagePtr msg,
    int64_t newId
)

Example:


Updated on 2022-01-26 at 17:20:40 +0800

© 2019-2023 MaximTop | Homepage Last modified time: 2023-08-09 14:48:15

results matching ""

    No results matching ""