Easemob Windows SDK
|
Public Types | |
enum | EMChatType { SINGLE, GROUP, CHATROOM } |
enum | EMMessageStatus { NEW, DELIVERING, SUCCESS, FAIL } |
enum | EMMessageDirection { SEND, RECEIVE } |
Public Member Functions | |
virtual | ~EMMessage () |
Class destructor. More... | |
const std::string & | msgId () |
Get message id. More... | |
void | setMsgId (const std::string &) |
Set message id. More... | |
const std::string & | from () |
Get message sender. More... | |
void | setFrom (const std::string &) |
Set message sender. More... | |
const std::string & | to () |
Get message receiver. More... | |
void | setTo (const std::string &) |
Set message receiver. More... | |
const std::string & | conversationId () |
Get conversation id. More... | |
void | setConversationId (const std::string &) |
Set message's conversation id. More... | |
EMMessageStatus | status () |
Get message status. More... | |
void | setStatus (EMMessageStatus) |
Set message's status. More... | |
EMChatType | chatType () |
Get message chat type. More... | |
void | setChatType (EMChatType) |
Set message's chat type. More... | |
EMMessageDirection | msgDirection () |
Get message direction. More... | |
void | setMsgDirection (EMMessageDirection) |
Set message's direction. More... | |
bool | isRead () |
Get message if has read status. More... | |
void | setIsRead (bool isRead) |
Set message's read status. More... | |
bool | isListened () |
Get message if has listened status. More... | |
void | setIsListened (bool isListened) |
Set message's listened status. More... | |
bool | isReadAcked () |
Get message read ack status. More... | |
void | setIsReadAcked (bool) |
Set message's read ack status. More... | |
bool | isDeliverAcked () |
Get message delivering status. More... | |
void | setIsDeliverAcked (bool) |
Set message's delivery ack status. More... | |
bool | isOffline () |
Get message offline status. More... | |
void | setIsOffline (bool) |
Set message's offline status. More... | |
int64_t | timestamp () |
Get message timestamp(server time). More... | |
void | setTimestamp (int64_t) |
Set message's timestamp. More... | |
int64_t | localTime () |
Get message's local time. More... | |
void | setLocalTime (int64_t) |
Set message's local time. More... | |
std::vector< EMMessageBodyPtr > | bodies () |
Get message body list. More... | |
void | clearBodies () |
Clear all bodies. More... | |
void | addBody (const EMMessageBodyPtr &body) |
Add a body to message. More... | |
template<typename T > | |
void | setAttribute (const std::string &attribute, const T &value) |
Add a extend attribute to message. More... | |
template<typename T > | |
bool | getAttribute (const std::string &attribute, T &value) |
Get extend attribute of message. More... | |
void | removeAttribute (const std::string &attribute) |
Remove a attribute from message. More... | |
void | clearAttributes () |
Remove all attributes from message. More... | |
std::map< std::string, std::shared_ptr< EMAttributeValue > > | ext () |
Get all attributes from message. More... | |
EMCallbackPtr | callback () |
Get message's callback to notify status change. More... | |
void | setCallback (EMCallbackPtr) |
Set message's callback to notify status change. More... | |
void | setProgress (float percent) |
float | getProgress () |
![]() | |
template<typename T > | |
T * | cast () |
Static Public Member Functions | |
static std::shared_ptr< EMMessage > | createReceiveMessage (const std::string &from, const std::string &to, const EMMessageBodyPtr &body, EMChatType=SINGLE, const std::string &msgId="") |
Create a received message. More... | |
static std::shared_ptr< EMMessage > | createSendMessage (const std::string &from, const std::string &to, const EMMessageBodyPtr &body, EMChatType=SINGLE) |
Create a send message. More... | |
Friends | |
class | EMMessagePrivate |
class | EMMessageEncoder |
enum easemob::EMMessage::EMChatType |
Message chat type.
enum easemob::EMMessage::EMMessageStatus |
Message status.
|
virtual |
Class destructor.
NA |
void easemob::EMMessage::addBody | ( | const EMMessageBodyPtr & | body | ) |
Add a body to message.
Note: The ownership of the body will be transfered, user must NOT release it.
A | message body. |
std::vector<EMMessageBodyPtr> easemob::EMMessage::bodies | ( | ) |
Get message body list.
NA |
EMCallbackPtr easemob::EMMessage::callback | ( | ) |
Get message's callback to notify status change.
NA |
EMChatType easemob::EMMessage::chatType | ( | ) |
Get message chat type.
NA |
void easemob::EMMessage::clearAttributes | ( | ) |
Remove all attributes from message.
NA |
void easemob::EMMessage::clearBodies | ( | ) |
Clear all bodies.
NA |
const std::string& easemob::EMMessage::conversationId | ( | ) |
Get conversation id.
NA |
|
static |
Create a received message.
The | message sender. |
The | message receiver. |
The | message body. |
The | message chat type. |
The | message id. |
|
static |
Create a send message.
The | message sender. |
The | message receiver. |
The | message body. |
The | message chat type. |
std::map<std::string, std::shared_ptr<EMAttributeValue> > easemob::EMMessage::ext | ( | ) |
Get all attributes from message.
NA |
const std::string& easemob::EMMessage::from | ( | ) |
Get message sender.
NA |
bool easemob::EMMessage::getAttribute | ( | const std::string & | attribute, |
T & | value | ||
) |
Get extend attribute of message.
Note: Supported types: bool, int, unsigned int, int64_t and string.
The | attrubute key. |
The | attrubute value, it's a out argument. |
bool easemob::EMMessage::isDeliverAcked | ( | ) |
Get message delivering status.
Note: For receiver, it indicates whether has sent delivering successed ack, and for sender, it indicates whether has received delivering successed ack.
NA |
bool easemob::EMMessage::isListened | ( | ) |
Get message if has listened status.
NA |
bool easemob::EMMessage::isOffline | ( | ) |
Get message offline status.
NA |
bool easemob::EMMessage::isRead | ( | ) |
Get message if has read status.
NA |
bool easemob::EMMessage::isReadAcked | ( | ) |
Get message read ack status.
Note: For receiver, it indicates whether has sent read ack, and for sender, it indicates whether has received read ack.
NA |
int64_t easemob::EMMessage::localTime | ( | ) |
Get message's local time.
NA |
EMMessageDirection easemob::EMMessage::msgDirection | ( | ) |
Get message direction.
NA |
const std::string& easemob::EMMessage::msgId | ( | ) |
Get message id.
NA |
void easemob::EMMessage::removeAttribute | ( | const std::string & | attribute | ) |
Remove a attribute from message.
The | attribute key. |
void easemob::EMMessage::setAttribute | ( | const std::string & | attribute, |
const T & | value | ||
) |
Add a extend attribute to message.
Note: Supported types: bool, int32_t, uint32_t, int64_t, double, string and EMJsonString. If the attribute has already existed, it will be replaced.
The | attrubute key. |
The | attrubute value. |
void easemob::EMMessage::setCallback | ( | EMCallbackPtr | ) |
Set message's callback to notify status change.
The | callback. |
void easemob::EMMessage::setChatType | ( | EMChatType | ) |
Set message's chat type.
Note: User should NOT change message's chat type after receive or send a message.
The | new conversation id. |
void easemob::EMMessage::setConversationId | ( | const std::string & | ) |
Set message's conversation id.
Note: User should NOT change message's conversation id after receive or send a message.
The | new conversation id. |
void easemob::EMMessage::setFrom | ( | const std::string & | ) |
Set message sender.
The | new message sender. |
void easemob::EMMessage::setIsDeliverAcked | ( | bool | ) |
Set message's delivery ack status.
Note: User should NOT change message's delivery ack status directly.
The | new message delivery ack status. |
void easemob::EMMessage::setIsListened | ( | bool | isListened | ) |
Set message's listened status.
Note: User should NOT change message's listened status directly.
The | new message listened status. |
void easemob::EMMessage::setIsOffline | ( | bool | ) |
Set message's offline status.
Note: User should never change message's offline status.
The | new message offline status. |
void easemob::EMMessage::setIsRead | ( | bool | isRead | ) |
Set message's read status.
Note: User should NOT change message's read status directly.
The | new message read status. |
void easemob::EMMessage::setIsReadAcked | ( | bool | ) |
Set message's read ack status.
Note: User should NOT change message's read ack status directly.
The | new message read ack status. |
void easemob::EMMessage::setLocalTime | ( | int64_t | ) |
Set message's local time.
Note: User should NOT change message's server time.
The | new message server time. |
void easemob::EMMessage::setMsgDirection | ( | EMMessageDirection | ) |
Set message's direction.
Note: User should NOT change message's message direction after receive or send a message.
NA |
void easemob::EMMessage::setMsgId | ( | const std::string & | ) |
Set message id.
Note: User should never change a message's id if you don't want to save as a new message.
The | new message id. |
void easemob::EMMessage::setStatus | ( | EMMessageStatus | ) |
Set message's status.
Note: User should NOT change message's status directly.
The | new message status. |
void easemob::EMMessage::setTimestamp | ( | int64_t | ) |
Set message's timestamp.
Note: User should NOT change message's timestamp.
The | new message timestamp. |
void easemob::EMMessage::setTo | ( | const std::string & | ) |
Set message receiver.
The | new message receiver. |
EMMessageStatus easemob::EMMessage::status | ( | ) |
Get message status.
NA |
int64_t easemob::EMMessage::timestamp | ( | ) |
Get message timestamp(server time).
NA |
const std::string& easemob::EMMessage::to | ( | ) |
Get message receiver.
NA |