Easemob Windows SDK
|
Public Types | |
enum | EMConversationType { CHAT, GROUPCHAT, CHATROOM, DISCUSSIONGROUP, HELPDESK } |
enum | EMMessageSearchDirection { UP, DOWN } |
Public Member Functions | |
virtual | ~EMConversation () |
Conversation's destructor. More... | |
const std::string & | conversationId () const |
Get conversation id. More... | |
EMConversationType | conversationType () const |
Get conversation type. More... | |
bool | removeMessage (const std::string &msgId) |
Remove a message from DB and cache. More... | |
bool | removeMessage (const EMMessagePtr msg) |
Remove a message from DB and cache. More... | |
bool | insertMessage (const EMMessagePtr msg) |
Insert a message to DB. More... | |
bool | appendMessage (const EMMessagePtr msg) |
Append a message to the last of conversation. More... | |
bool | updateMessage (const EMMessagePtr msg) |
Update message's memory change to DB. More... | |
bool | clearAllMessages () |
Clear all messages belong to the the conversation(include DB and memory cache). More... | |
bool | markMessageAsRead (const std::string &msgId, bool isRead=true) |
Change message's read status. More... | |
bool | markAllMessagesAsRead (bool isRead=true) |
Change all messages's read status. More... | |
int | unreadMessagesCount () const |
Get unread messages count of conversation. More... | |
int | messagesCount () const |
Get the total messages count of conversation. More... | |
EMMessagePtr | loadMessage (const std::string &msgId) const |
Load a message(Will load message from DB if not exist in cache). More... | |
EMMessagePtr | latestMessage () const |
Get latest message of conversation. More... | |
EMMessagePtr | latestMessageFromOthers () const |
Get received latest message of conversation. More... | |
EMMessageList | loadMoreMessages (const std::string &refMsgId, int count, EMMessageSearchDirection direction=UP) |
Load specified number of messages from DB. More... | |
EMMessageList | loadMoreMessages (int64_t timeStamp, int count, EMMessageSearchDirection direction=UP) |
Load specified number of messages before the timestamp from DB. More... | |
EMMessageList | loadMoreMessages (EMMessageBody::EMMessageBodyType type, int64_t timeStamp=-1, int count=-1, const std::string &from="", EMMessageSearchDirection direction=UP) |
Load specified number of messages before the timestamp and with the specified type from DB. More... | |
EMMessageList | loadMoreMessages (const std::string &keywords, int64_t timeStamp=-1, int count=-1, const std::string &from="", EMMessageSearchDirection direction=UP) |
Load specified number of messages before the timestamp and contains the specified keywords from DB. More... | |
EMMessageList | loadMoreMessages (int64_t startTimeStamp, int64_t endTimeStamp, int maxCount) |
Load messages from DB. More... | |
const std::string & | extField () const |
Get conversation extend attribute. More... | |
bool | setExtField (const std::string &ext) |
Set conversation extend attribute. More... | |
![]() | |
template<typename T > | |
T * | cast () |
Public Attributes | |
friend | EMConversationManager |
friend | EMChatManager |
friend | EMDatabase |
enum easemob::EMConversation::EMConversationType |
Conversation type.
enum easemob::EMConversation::EMMessageSearchDirection |
Message search direction.
|
virtual |
Conversation's destructor.
NA |
bool easemob::EMConversation::appendMessage | ( | const EMMessagePtr | msg | ) |
Append a message to the last of conversation.
Note: It's user's responsibility to confirm inserted message belongs to the conversation.
The | message to append. |
bool easemob::EMConversation::clearAllMessages | ( | ) |
Clear all messages belong to the the conversation(include DB and memory cache).
NA |
const std::string& easemob::EMConversation::conversationId | ( | ) | const |
Get conversation id.
Note: For a single chat conversation, it's remote peer's user name, for a group chat conversation, it's group id.
NA |
EMConversationType easemob::EMConversation::conversationType | ( | ) | const |
Get conversation type.
NA |
const std::string& easemob::EMConversation::extField | ( | ) | const |
Get conversation extend attribute.
NA |
bool easemob::EMConversation::insertMessage | ( | const EMMessagePtr | msg | ) |
Insert a message to DB.
Note: It's user's responsibility to confirm inserted message belongs to the conversation.
The | message to insert. |
EMMessagePtr easemob::EMConversation::latestMessage | ( | ) | const |
Get latest message of conversation.
NA |
EMMessagePtr easemob::EMConversation::latestMessageFromOthers | ( | ) | const |
Get received latest message of conversation.
NA |
EMMessagePtr easemob::EMConversation::loadMessage | ( | const std::string & | msgId | ) | const |
Load a message(Will load message from DB if not exist in cache).
The | message id |
EMMessageList easemob::EMConversation::loadMoreMessages | ( | const std::string & | refMsgId, |
int | count, | ||
EMMessageSearchDirection | direction = UP |
||
) |
Load specified number of messages from DB.
Note: The return result will NOT include the reference message, and load message from the latest message if reference message id is empty. The result will be sorted by ASC. The trailing position resident last arrived message;
The | reference messages's id |
Message | count to load |
Message | search direction |
EMMessageList easemob::EMConversation::loadMoreMessages | ( | int64_t | timeStamp, |
int | count, | ||
EMMessageSearchDirection | direction = UP |
||
) |
Load specified number of messages before the timestamp from DB.
Note: The result will be sorted by ASC.
The | reference timestamp |
Message | count to load |
Message | search direction |
EMMessageList easemob::EMConversation::loadMoreMessages | ( | EMMessageBody::EMMessageBodyType | type, |
int64_t | timeStamp = -1 , |
||
int | count = -1 , |
||
const std::string & | from = "" , |
||
EMMessageSearchDirection | direction = UP |
||
) |
Load specified number of messages before the timestamp and with the specified type from DB.
Note: The result will be sorted by ASC.
Message | type to load |
The | reference timestamp, milliseconds, will reference current time if timestamp is negative |
Message | count to load, will load all messages meeet the conditions if count is negative |
Message | sender, will ignore it if it's empty |
Message | search direction |
EMMessageList easemob::EMConversation::loadMoreMessages | ( | const std::string & | keywords, |
int64_t | timeStamp = -1 , |
||
int | count = -1 , |
||
const std::string & | from = "" , |
||
EMMessageSearchDirection | direction = UP |
||
) |
Load specified number of messages before the timestamp and contains the specified keywords from DB.
Note: The result will be sorted by ASC.
Message | contains keywords, will ignore it if it's empty |
The | reference timestamp, milliseconds, will reference current time if timestamp is negative |
Message | count to load, will load all messages meeet the conditions if count is negative |
Message | sender, will ignore it if it's empty |
Message | search direction |
EMMessageList easemob::EMConversation::loadMoreMessages | ( | int64_t | startTimeStamp, |
int64_t | endTimeStamp, | ||
int | maxCount | ||
) |
Load messages from DB.
Note: To avoid occupy too much memory, user should limit the max messages count to load. The result will be sorted by ASC. The trailing position resident last arrived message;
The | start time timestamp |
The | end time timestamp |
The | max count of messages to load |
bool easemob::EMConversation::markAllMessagesAsRead | ( | bool | isRead = true | ) |
Change all messages's read status.
NA |
bool easemob::EMConversation::markMessageAsRead | ( | const std::string & | msgId, |
bool | isRead = true |
||
) |
Change message's read status.
Note: It's user's responsibility to confirm changed message belongs to the conversation.
The | message to change. |
int easemob::EMConversation::messagesCount | ( | ) | const |
Get the total messages count of conversation.
NA |
bool easemob::EMConversation::removeMessage | ( | const std::string & | msgId | ) |
Remove a message from DB and cache.
Note: It's user's responsibility to confirm removed message belongs to the conversation.
The | message id |
bool easemob::EMConversation::removeMessage | ( | const EMMessagePtr | msg | ) |
Remove a message from DB and cache.
Note: It's better to use this method to remove a message, and it's user's responsibility to confirm removed message belongs to the conversation.
The | message to remove |
bool easemob::EMConversation::setExtField | ( | const std::string & | ext | ) |
Set conversation extend attribute.
The | extend attribute. |
int easemob::EMConversation::unreadMessagesCount | ( | ) | const |
Get unread messages count of conversation.
NA |
bool easemob::EMConversation::updateMessage | ( | const EMMessagePtr | msg | ) |
Update message's memory change to DB.
Note: It's user's responsibility to confirm updated message belongs to the conversation, and user should NOT change a message's id.
The | message to remove |