JMSGNotificationEvent.h 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. /*
  2. * | | | | \ \ / / | | | | / _______|
  3. * | |____| | \ \/ / | |____| | / /
  4. * | |____| | \ / | |____| | | | _____
  5. * | | | | / \ | | | | | | |____ |
  6. * | | | | / /\ \ | | | | \ \______| |
  7. * | | | | /_/ \_\ | | | | \_________|
  8. *
  9. * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved.
  10. */
  11. #import <Foundation/Foundation.h>
  12. #import <JMessage/JMSGConversation.h>
  13. /*!
  14. * 事件
  15. *
  16. * #### 事件分类
  17. *
  18. * 事件主要区分两类,通知事件、消息事件,两种不同类型的事件是通过不同的监听方法来监听的。
  19. *
  20. * #### 通知事件
  21. *
  22. * 通知事件就是除群事件之外的,如:当前登录登录状态变更、好友相关、消息撤回、消息透传、入群申请、管理员审批等事件.
  23. * 上层通过对应类里的相对应的代理方法接收事件,如:JMSGEventDelegate 、JMSGGroupDelegate 等类.
  24. *
  25. * #### 消息事件
  26. *
  27. * 消息事件就是群事件,如:群加人、踢人、修改群信息、群成员禁言、管理员变更等(即:会展示在消息列表的事件),SDK 依旧作为一个特殊的消息类型下发,上层通过 [JMSGMessageDelegate onReceiveMessage:] 接收消息事件.
  28. */
  29. @interface JMSGNotificationEvent : NSObject
  30. /*!
  31. * @abstract 事件类型
  32. * @discussion 参考事件类型的定义 JMSGEventNotificationType
  33. */
  34. @property(nonatomic, assign, readonly) JMSGEventNotificationType eventType;
  35. /*!
  36. * @abstract 事件的描述信息
  37. * @discussion 下发事件的文字描述,可能为空
  38. */
  39. @property(nonatomic, strong, readonly) NSString *eventDescription;
  40. @end
  41. #pragma mark - 用户登录状态改变事件
  42. /*!
  43. * @abstract 当前用户登录状态改变事件
  44. *
  45. * @discussion 当前登录用户被踢、非客户端修改密码强制登出、登录状态异常、被删除、被禁用、信息变更等通知
  46. *
  47. * @since 3.5.0
  48. */
  49. @interface JMSGUserLoginStatusChangeEvent: JMSGNotificationEvent
  50. @end
  51. #pragma mark - 消息撤回事件
  52. /*!
  53. * @abstract 消息撤回事件
  54. *
  55. * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageRetractEvent:] 代理方法监听此事件,详见官方文档.
  56. */
  57. @interface JMSGMessageRetractEvent : JMSGNotificationEvent
  58. /// 消息撤回所属会话
  59. @property(nonatomic, strong, readonly) JMSGConversation *conversation;
  60. /// 撤回之后的消息
  61. @property(nonatomic, strong, readonly) JMSGMessage *retractMessage;
  62. @end
  63. #pragma mark - 消息已读回执状态变更事件
  64. /*!
  65. * @abstract 消息已读回执状态变更事件
  66. *
  67. * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageReceiptStatusChangeEvent:] 代理方法监听该事件
  68. */
  69. @interface JMSGMessageReceiptStatusChangeEvent : JMSGNotificationEvent
  70. /// 消息所属会话
  71. @property(nonatomic, strong, readonly) JMSGConversation *conversation;
  72. /// 已读回执变更的消息列表
  73. @property(nonatomic, strong, readonly) NSArray <__kindof JMSGMessage *>*messages;
  74. @end
  75. #pragma mark - 消息透传事件
  76. /*!
  77. * @abstract 消息透传事件
  78. *
  79. * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageTransparentEvent:] 代理方法监听该事件
  80. */
  81. @interface JMSGMessageTransparentEvent : JMSGNotificationEvent
  82. /// 消息透传的类型,单聊、群聊、设备间透传消息
  83. @property(nonatomic, assign, readonly) JMSGTransMessageType transMessageType;
  84. /// 透传消息的发送者
  85. @property(nonatomic, strong, readonly) JMSGUser *sendUser;
  86. /// 透传消息的目标对象,JMSGUser、JMSGGroup
  87. @property(nonatomic, strong, readonly) id target;
  88. /// 透传消息内容
  89. @property(nonatomic, strong, readonly) NSString *transparentText;
  90. /*!
  91. * @abstract 透传消息所属会话
  92. *
  93. * @discussion 注意:如果接收到设备间的透传事件,此属性的值为 nil;如果本地并没有创建会话,此属性也为 nil
  94. */
  95. @property(nonatomic, strong, readonly) JMSGConversation *conversation;
  96. @end
  97. #pragma mark - 申请入群事件
  98. /*!
  99. * @abstract 申请入群事件
  100. *
  101. * @discussion 上层通过 JMSGGroupDelegate 类中的 [JMSGGroupDelegate onReceiveApplyJoinGroupApprovalEvent:] 代理方法监听该事件
  102. */
  103. @interface JMSGApplyJoinGroupEvent : JMSGNotificationEvent
  104. /// 事件的 id
  105. @property(nonatomic, strong, readonly) NSString *eventID;
  106. /// 群 gid
  107. @property(nonatomic, strong, readonly) NSString *groupID;
  108. /// 是否是用户主动申请入群,YES:主动申请加入,NO:被邀请加入
  109. @property(nonatomic, assign, readonly) BOOL isInitiativeApply;
  110. /// 发起申请的 user
  111. @property(nonatomic, strong, readonly) JMSGUser *sendApplyUser;
  112. /// 被邀请入群的 user 数组
  113. @property(nonatomic, strong, readonly) NSArray JMSG_GENERIC(__kindof JMSGUser *)*joinGroupUsers;
  114. /// 原因
  115. @property(nonatomic, strong, readonly) NSString *reason;
  116. @end
  117. #pragma mark - 管理员拒绝入群申请事件
  118. /*!
  119. * @abstract 管理员拒绝入群申请事件
  120. *
  121. * @discussion 上层通过 JMSGGroupDelegate 类中的 [JMSGGroupDelegate onReceiveGroupAdminRejectApplicationEvent:] 代理方法监听该事件
  122. */
  123. @interface JMSGGroupAdminRejectApplicationEvent : JMSGNotificationEvent
  124. /// 群 gid
  125. @property(nonatomic, strong, readonly) NSString *groupID;
  126. /// 拒绝原因
  127. @property(nonatomic, strong, readonly) NSString *rejectReason;
  128. /// 操作的管理员
  129. @property(nonatomic, strong, readonly) JMSGUser *groupManager;
  130. @end
  131. #pragma mark - 管理员审批事件
  132. /*!
  133. * @abstract 管理员审批事件
  134. *
  135. * @discussion 管理员同意或者拒绝了某个入群申请,其他管理员会收到该通知,上层通过 [JMSGGroupDelegate onReceiveGroupAdminApprovalEvent:] 代理方法监听该事件
  136. */
  137. @interface JMSGGroupAdminApprovalEvent : JMSGNotificationEvent
  138. /// 管理员是否同意申请,YES:同意,NO:拒绝
  139. @property(nonatomic, assign, readonly) BOOL isAgreeApply;
  140. /// 申请入群事件的事件 id
  141. @property(nonatomic, strong, readonly) NSString *applyEventID;
  142. /// 群 gid
  143. @property(nonatomic, strong, readonly) NSString *groupID;
  144. /// 操作的管理员
  145. @property(nonatomic, strong, readonly) JMSGUser *groupAdmin;
  146. /// 申请或被邀请加入群的用户,即:实际入群的用户
  147. @property(nonatomic, strong, readonly) NSArray JMSG_GENERIC(__kindof JMSGUser *)*users;
  148. @end
  149. #pragma mark - 群成员群昵称修改事件
  150. /*!
  151. * @abstract 群成员群昵称修改事件
  152. *
  153. * @discussion 如果是离线事件, memberInfoList 里会包含群成员每一次的修改记录,上层通过 [JMSGGroupDelegate onReceiveGroupNicknameChangeEvents:] 监听。
  154. */
  155. @interface JMSGGroupNicknameChangeEvent : NSObject
  156. /// 群组
  157. @property(nonatomic, strong, readonly) JMSGGroup *group;
  158. /// 修改昵称的群成员
  159. @property(nonatomic, strong, readonly) JMSGGroupMemberInfo *fromMemberInfo;
  160. /// 被修改昵称的群成员
  161. @property(nonatomic, strong, readonly) JMSGGroupMemberInfo *toMemberInfo;
  162. /// 事件时间
  163. @property(nonatomic, assign, readonly) UInt64 ctime;
  164. @end
  165. #pragma mark - 群公告事件
  166. /*!
  167. * @abstract 群公告事件
  168. *
  169. * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveGroupAnnouncementEvents:] 监听。
  170. */
  171. @interface JMSGGroupAnnouncementEvent : JMSGNotificationEvent
  172. /// 群公告
  173. @property(nonatomic, strong, readonly) JMSGGroupAnnouncement *announcement;
  174. /// 事件操作者
  175. @property(nonatomic, strong, readonly) JMSGUser *fromUser;
  176. /// 群组
  177. @property(nonatomic, strong, readonly) JMSGGroup *group;
  178. /// 事件时间
  179. @property(nonatomic, assign, readonly) UInt64 ctime;
  180. @end
  181. #pragma mark - 群黑名单变更事件
  182. /*!
  183. * @abstract 群黑名单变更事件
  184. *
  185. * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveGroupBlacklistChangeEvents:] 监听。
  186. */
  187. @interface JMSGGroupBlacklistChangeEvent : JMSGNotificationEvent
  188. /// 群组
  189. @property(nonatomic, strong, readonly) JMSGGroup *group;
  190. /// 事件操作者
  191. @property(nonatomic, strong, readonly) JMSGUser *fromUser;
  192. /// 被加入/被删除 群组黑名单的用户列表
  193. @property(nonatomic, strong, readonly) NSArray <__kindof JMSGUser *>*targetList;
  194. @end
  195. #pragma mark - 聊天室事件
  196. @interface JMSGChatRoomEvent : JMSGNotificationEvent
  197. /// 聊天室
  198. @property(nonatomic, strong, readonly) JMSGChatRoom *chatRoom;
  199. /// 事件操作者
  200. @property(nonatomic, strong, readonly) JMSGUser *fromUser;
  201. /// 事件作用的用户列表
  202. @property(nonatomic, strong, readonly) NSArray <__kindof JMSGUser *>*targetList;
  203. @end
  204. #pragma mark - 聊天室管理员变更事件
  205. /*!
  206. * @abstract 聊天室管理员变更事件
  207. *
  208. * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGEventDelegate onReceiveChatRoomAdminChangeEvents:] 监听。
  209. */
  210. @interface JMSGChatRoomAdminChangeEvent : JMSGChatRoomEvent
  211. @end
  212. #pragma mark - 聊天室黑名单变更事件
  213. /*!
  214. * @abstract 聊天室黑名单变更事件
  215. *
  216. * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGEventDelegate onReceiveChatRoomBlacklistChangeEvents:] 监听。
  217. */
  218. @interface JMSGChatRoomBlacklisChangetEvent : JMSGChatRoomEvent
  219. @end
  220. #pragma mark - 聊天室禁言事件
  221. /*!
  222. * @abstract 聊天室禁言事件
  223. *
  224. * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGEventDelegate onReceiveChatRoomSilenceEvents:] 监听。
  225. */
  226. @interface JMSGChatRoomSilenceEvent : JMSGChatRoomEvent
  227. @end