18 #ifndef __easemob__EMMessage__ 19 #define __easemob__EMMessage__ 24 #include "embaseobject.h" 25 #include "emmessagebody.h" 26 #include "emcallback.h" 27 #include "emjsonstring.h" 31 class EMAttributeValue;
32 class EMMessagePrivate;
78 const std::string& msgId();
87 void setMsgId(
const std::string &);
95 const std::string& from();
103 void setFrom(
const std::string&);
111 const std::string& to();
119 void setTo(
const std::string&);
127 const std::string& conversationId();
136 void setConversationId(
const std::string&);
144 EMMessageStatus status();
153 void setStatus(EMMessageStatus);
161 EMChatType chatType();
170 void setChatType(EMChatType);
178 EMMessageDirection msgDirection();
187 void setMsgDirection(EMMessageDirection);
204 void setIsRead(
bool isRead);
221 void setIsListened(
bool isListened);
239 void setIsReadAcked(
bool);
248 bool isDeliverAcked();
257 void setIsDeliverAcked(
bool);
274 void setIsOffline(
bool);
291 void setTimestamp(int64_t);
308 void setLocalTime(int64_t);
316 std::vector<EMMessageBodyPtr> bodies();
333 void addBody(
const EMMessageBodyPtr &body);
344 void setAttribute(
const std::string &attribute,
const T &value);
355 bool getAttribute(
const std::string &attribute, T &value);
363 void removeAttribute(
const std::string &attribute);
371 void clearAttributes();
379 std::map<std::string, std::shared_ptr<EMAttributeValue> > ext();
387 EMCallbackPtr callback();
395 void setCallback(EMCallbackPtr);
397 void setProgress(
float percent) { mProgress = percent; }
399 float getProgress() {
return mProgress; }
413 static std::shared_ptr<EMMessage> createReceiveMessage(
const std::string &from,
const std::string &to,
const EMMessageBodyPtr &body, EMChatType = SINGLE,
const std::string &msgId =
"");
424 static std::shared_ptr<EMMessage> createSendMessage(
const std::string &from,
const std::string &to,
const EMMessageBodyPtr &body, EMChatType = SINGLE);
434 EMMessage(
const std::string& msgId, EMChatType = SINGLE);
442 std::string mConversationId;
444 EMMessageStatus mStatus;
445 EMChatType mChatType;
446 EMMessageDirection mDirection;
451 bool mIsDeliverAcked;
455 std::vector<EMMessageBodyPtr> mBodies;
456 std::map<std::string, std::shared_ptr<EMAttributeValue> > mExt;
457 EMCallbackPtr mCallback;
459 EMMessagePrivate* messagePrivate;
460 friend class EMMessagePrivate;
461 friend class EMMessageEncoder;
466 typedef std::shared_ptr<EMMessage> EMMessagePtr;
467 typedef std::vector<EMMessagePtr> EMMessageList;
Definition: emmessage.h:34
EMChatType
Definition: emmessage.h:41
Definition: emattributevalue.h:28
EMMessageStatus
Definition: emmessage.h:51
Definition: embaseobject.h:28