説明なし

EMMessage.h 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /*!
  2. * \~chinese
  3. * @header EMMessage.h
  4. * @abstract 聊天消息
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMMessage.h
  10. * @abstract Chat message
  11. * @author Hyphenate
  12. * @version 3.00
  13. */
  14. #import <Foundation/Foundation.h>
  15. #import "EMMessageBody.h"
  16. /*!
  17. * \~chinese
  18. * 聊天类型
  19. *
  20. * \~english
  21. * Chat type
  22. */
  23. typedef enum{
  24. EMChatTypeChat = 0, /*! \~chinese 单聊消息 \~english one to one chat type */
  25. EMChatTypeGroupChat, /*! \~chinese 群聊消息 \~english Group chat type */
  26. EMChatTypeChatRoom, /*! \~chinese 聊天室消息 \~english Chatroom chat type */
  27. }EMChatType;
  28. /*!
  29. * \~chinese
  30. * 消息发送状态
  31. *
  32. * \~english
  33. * Message Status
  34. */
  35. typedef enum{
  36. EMMessageStatusPending = 0, /*! \~chinese 发送未开始 \~english Pending */
  37. EMMessageStatusDelivering, /*! \~chinese 正在发送 \~english Delivering */
  38. EMMessageStatusSuccessed, /*! \~chinese 发送成功 \~english Successed */
  39. EMMessageStatusFailed, /*! \~chinese 发送失败 \~english Failed */
  40. }EMMessageStatus;
  41. /*!
  42. * \~chinese
  43. * 消息方向
  44. *
  45. * \~english
  46. * Message direction
  47. */
  48. typedef enum{
  49. EMMessageDirectionSend = 0, /*! \~chinese 发送的消息 \~english Send */
  50. EMMessageDirectionReceive, /*! \~chinese 接收的消息 \~english Receive */
  51. }EMMessageDirection;
  52. /*!
  53. * \~chinese
  54. * 聊天消息
  55. *
  56. * \~english
  57. * Chat message
  58. */
  59. @interface EMMessage : NSObject
  60. /*!
  61. * \~chinese
  62. * 消息的唯一标识符
  63. *
  64. * \~english
  65. * Unique identifier of message
  66. */
  67. @property (nonatomic, copy) NSString *messageId;
  68. /*!
  69. * \~chinese
  70. * 所属会话的唯一标识符
  71. *
  72. * \~english
  73. * Unique identifier of message's conversation
  74. */
  75. @property (nonatomic, copy) NSString *conversationId;
  76. /*!
  77. * \~chinese
  78. * 消息的方向
  79. *
  80. * \~english
  81. * Message direction
  82. */
  83. @property (nonatomic) EMMessageDirection direction;
  84. /*!
  85. * \~chinese
  86. * 发送方
  87. *
  88. * \~english
  89. * Message sender
  90. */
  91. @property (nonatomic, copy) NSString *from;
  92. /*!
  93. * \~chinese
  94. * 接收方
  95. *
  96. * \~english
  97. * Message receiver
  98. */
  99. @property (nonatomic, copy) NSString *to;
  100. /*!
  101. * \~chinese
  102. * 时间戳,服务器收到此消息的时间
  103. *
  104. * \~english
  105. * Timestamp, the time of server received this message
  106. */
  107. @property (nonatomic) long long timestamp;
  108. /*!
  109. * \~chinese
  110. * 客户端发送/收到此消息的时间
  111. *
  112. * \~english
  113. * The time of client send/receive the message
  114. */
  115. @property (nonatomic) long long localTime;
  116. /*!
  117. * \~chinese
  118. * 消息类型
  119. *
  120. * \~english
  121. * Chat type
  122. */
  123. @property (nonatomic) EMChatType chatType;
  124. /*!
  125. * \~chinese
  126. * 消息状态
  127. *
  128. * \~english
  129. * Message status
  130. */
  131. @property (nonatomic) EMMessageStatus status;
  132. /*!
  133. * \~chinese
  134. * 已读回执是否已发送/收到, 对于发送方表示是否已经收到已读回执,对于接收方表示是否已经发送已读回执
  135. *
  136. * \~english
  137. * Whether read acknowledgement has been sent or received, it indicates whether the sender has received a message read acknowledgement, or whether the recipient has sent a message read acknowledgement
  138. */
  139. @property (nonatomic) BOOL isReadAcked;
  140. /*!
  141. * \~chinese
  142. * 送达回执是否已发送/收到,对于发送方表示是否已经收到送达回执,对于接收方表示是否已经发送送达回执,如果EMOptions设置了enableDeliveryAck,SDK收到消息后会自动发送送达回执
  143. *
  144. * \~english
  145. * Whether delivery acknowledgement has been sent or received, it indicates whether the sender has received a message deliver acknowledgement, or whether the recipient has sent a message deliver acknowledgement, SDK will automatically send delivery acknowledgement if EMOptions is set to enableDeliveryAck
  146. */
  147. @property (nonatomic) BOOL isDeliverAcked;
  148. /*!
  149. * \~chinese
  150. * 是否已读
  151. *
  152. * \~english
  153. * Whether the message has been read
  154. */
  155. @property (nonatomic) BOOL isRead;
  156. /*!
  157. * \~chinese
  158. * 消息体
  159. *
  160. * \~english
  161. * Message body
  162. */
  163. @property (nonatomic, strong) EMMessageBody *body;
  164. /*!
  165. * \~chinese
  166. * 消息扩展
  167. *
  168. * Key值类型必须是NSString, Value值类型必须是NSString或者 NSNumber类型的 BOOL, int, unsigned in, long long, double.
  169. *
  170. * \~english
  171. * Message extention
  172. *
  173. * Key type must be NSString, Value type must be NSString, int, unsigned in, long long, or double. Please use NSNumber (@YES or @NO) instead of BOOL.
  174. */
  175. @property (nonatomic, copy) NSDictionary *ext;
  176. /*!
  177. * \~chinese
  178. * 初始化消息实例
  179. *
  180. * @param aConversationId 会话ID
  181. * @param aFrom 发送方
  182. * @param aTo 接收方
  183. * @param aBody 消息体实例
  184. * @param aExt 扩展信息
  185. *
  186. * @result 消息实例
  187. *
  188. * \~english
  189. * Initialize a message instance
  190. *
  191. * @param aConversationId Conversation id
  192. * @param aFrom The sender
  193. * @param aTo The receiver
  194. * @param aBody Message body
  195. * @param aExt Message extention
  196. *
  197. * @result Message instance
  198. */
  199. - (id)initWithConversationID:(NSString *)aConversationId
  200. from:(NSString *)aFrom
  201. to:(NSString *)aTo
  202. body:(EMMessageBody *)aBody
  203. ext:(NSDictionary *)aExt;
  204. @end