TIMComm+Group.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485
  1. //
  2. // TIMComm+Group.h
  3. // IMGroupExt
  4. //
  5. // Created by tomzhu on 2017/2/9.
  6. //
  7. //
  8. #ifndef TIMComm_Group_h
  9. #define TIMComm_Group_h
  10. #import <ImSDK/ImSDK.h>
  11. @class TIMGroupPendencyMeta;
  12. #pragma mark - 枚举类型
  13. /**
  14. * 群基本获取资料标志
  15. */
  16. typedef NS_ENUM(NSInteger, TIMGetGroupBaseInfoFlag) {
  17. /**
  18. * 不获取群组资料
  19. */
  20. TIM_GET_GROUP_BASE_INFO_FLAG_NONE = 0x00,
  21. /**
  22. * 获取群组名
  23. */
  24. TIM_GET_GROUP_BASE_INFO_FLAG_NAME = 0x01,
  25. /**
  26. * 获取创建时间
  27. */
  28. TIM_GET_GROUP_BASE_INFO_FLAG_CREATE_TIME = 0x01 << 1,
  29. /**
  30. * 获取群主id
  31. */
  32. TIM_GET_GROUP_BASE_INFO_FLAG_OWNER_UIN = 0x01 << 2,
  33. /**
  34. * (不可用)
  35. */
  36. TIM_GET_GROUP_BASE_INFO_FLAG_SEQ = 0x01 << 3,
  37. /**
  38. * 获取最近一次修改群信息时间
  39. */
  40. TIM_GET_GROUP_BASE_INFO_FLAG_TIME = 0x01 << 4,
  41. /**
  42. * (不可用)
  43. */
  44. TIM_GET_GROUP_BASE_INFO_FLAG_NEXT_MSG_SEQ = 0x01 << 5,
  45. /**
  46. * 获取最近一次发消息时间
  47. */
  48. TIM_GET_GROUP_BASE_INFO_FLAG_LAST_MSG_TIME = 0x01 << 6,
  49. /**
  50. * (不可用)
  51. */
  52. TIM_GET_GROUP_BASE_INFO_FLAG_APP_ID = 0x01 << 7,
  53. /**
  54. * 获取群成员数量
  55. */
  56. TIM_GET_GROUP_BASE_INFO_FLAG_MEMBER_NUM = 0x01 << 8,
  57. /**
  58. * 获取最大群成员数量
  59. */
  60. TIM_GET_GROUP_BASE_INFO_FLAG_MAX_MEMBER_NUM = 0x01 << 9,
  61. /**
  62. * 获取群公告
  63. */
  64. TIM_GET_GROUP_BASE_INFO_FLAG_NOTIFICATION = 0x01 << 10,
  65. /**
  66. * 获取群简介
  67. */
  68. TIM_GET_GROUP_BASE_INFO_FLAG_INTRODUCTION = 0x01 << 11,
  69. /**
  70. * 获取群头像
  71. */
  72. TIM_GET_GROUP_BASE_INFO_FLAG_FACE_URL = 0x01 << 12,
  73. /**
  74. * 获取入群类型
  75. */
  76. TIM_GET_GROUP_BASE_INFO_FLAG_ADD_OPTION = 0x01 << 13,
  77. /**
  78. * 获取群组类型
  79. */
  80. TIM_GET_GROUP_BASE_INFO_FLAG_GROUP_TYPE = 0x01 << 14,
  81. /**
  82. * 获取最后一条群消息
  83. */
  84. TIM_GET_GROUP_BASE_INFO_FLAG_LAST_MSG = 0x01 << 15,
  85. /**
  86. * 获取在线人数
  87. */
  88. TIM_GET_GROUP_BASE_INFO_FLAG_ONLINE_NUM = 0x01 << 16,
  89. /**
  90. * 获取群成员是否可见标志
  91. */
  92. TIM_GET_GROUP_BASE_INFO_VISIBLE = 0x01 << 17,
  93. /**
  94. * 获取群是否能被搜到标志
  95. */
  96. TIM_GET_GROUP_BASE_INFO_SEARCHABLE = 0x01 << 18
  97. };
  98. /**
  99. * 群成员角色过滤方式
  100. */
  101. typedef NS_ENUM(NSInteger, TIMGroupMemberFilter) {
  102. /**
  103. * 全部成员
  104. */
  105. TIM_GROUP_MEMBER_FILTER_ALL = 0x00,
  106. /**
  107. * 群主
  108. */
  109. TIM_GROUP_MEMBER_FILTER_SUPER = 0x01,
  110. /**
  111. * 管理员
  112. */
  113. TIM_GROUP_MEMBER_FILTER_ADMIN = 0x02,
  114. /**
  115. * 普通成员
  116. */
  117. TIM_GROUP_MEMBER_FILTER_COMMON = 0x04,
  118. };
  119. /**
  120. * 群成员获取资料标志
  121. */
  122. typedef NS_ENUM(NSInteger, TIMGetGroupMemInfoFlag) {
  123. /**
  124. * 入群时间
  125. */
  126. TIM_GET_GROUP_MEM_INFO_FLAG_JOIN_TIME = 0x01,
  127. /**
  128. * 消息标志
  129. */
  130. TIM_GET_GROUP_MEM_INFO_FLAG_MSG_FLAG = 0x01 << 1,
  131. /**
  132. * 角色
  133. */
  134. TIM_GET_GROUP_MEM_INFO_FLAG_ROLE_INFO = 0x01 << 3,
  135. /**
  136. * 禁言时间
  137. */
  138. TIM_GET_GROUP_MEM_INFO_FLAG_SHUTUP_TIME = 0x01 << 4,
  139. /**
  140. * 群名片
  141. */
  142. TIM_GET_GROUP_MEM_INFO_FLAG_NAME_CARD = 0x01 << 5,
  143. };
  144. /**
  145. * 群组操作结果
  146. */
  147. typedef NS_ENUM(NSInteger, TIMGroupMemberStatus) {
  148. /**
  149. * 操作失败
  150. */
  151. TIM_GROUP_MEMBER_STATUS_FAIL = 0,
  152. /**
  153. * 操作成功
  154. */
  155. TIM_GROUP_MEMBER_STATUS_SUCC = 1,
  156. /**
  157. * 无效操作,加群时已经是群成员,移除群组时不在群内
  158. */
  159. TIM_GROUP_MEMBER_STATUS_INVALID = 2,
  160. /**
  161. * 等待处理,邀请入群时等待对方处理
  162. */
  163. TIM_GROUP_MEMBER_STATUS_PENDING = 3,
  164. };
  165. typedef NS_ENUM(NSInteger, TIMGroupPendencyGetType) {
  166. /**
  167. * 申请入群
  168. */
  169. TIM_GROUP_PENDENCY_GET_TYPE_JOIN = 0x0,
  170. /**
  171. * 邀请入群
  172. */
  173. TIM_GROUP_PENDENCY_GET_TYPE_INVITE = 0x1,
  174. };
  175. typedef NS_ENUM(NSInteger, TIMGroupPendencyHandleStatus) {
  176. /**
  177. * 未处理
  178. */
  179. TIM_GROUP_PENDENCY_HANDLE_STATUS_UNHANDLED = 0,
  180. /**
  181. * 被他人处理
  182. */
  183. TIM_GROUP_PENDENCY_HANDLE_STATUS_OTHER_HANDLED = 1,
  184. /**
  185. * 被用户处理
  186. */
  187. TIM_GROUP_PENDENCY_HANDLE_STATUS_OPERATOR_HANDLED = 2,
  188. };
  189. typedef NS_ENUM(NSInteger, TIMGroupPendencyHandleResult) {
  190. /**
  191. * 拒绝申请
  192. */
  193. TIM_GROUP_PENDENCY_HANDLE_RESULT_REFUSE = 0,
  194. /**
  195. * 同意申请
  196. */
  197. TIM_GROUP_PENDENCY_HANDLE_RESULT_AGREE = 1,
  198. };
  199. #pragma mark - block回调
  200. /**
  201. * 群成员列表回调
  202. *
  203. * @param members 群成员列表
  204. */
  205. typedef void (^TIMGroupMemberSucc)(NSArray * members);
  206. /**
  207. * 群列表回调
  208. *
  209. * @param arr 群列表
  210. */
  211. typedef void (^TIMGroupListSucc)(NSArray * arr);
  212. /**
  213. * 本人群组内成员信息回调
  214. *
  215. * @param selfInfo 本人成员信息
  216. */
  217. typedef void (^TIMGroupSelfSucc)(TIMGroupMemberInfo * selfInfo);
  218. /**
  219. * 群接受消息选项回调
  220. *
  221. * @param opt 群接受消息选项
  222. */
  223. typedef void (^TIMGroupReciveMessageOptSucc)(TIMGroupReceiveMessageOpt opt);
  224. /**
  225. * 群成员列表回调(分页使用)
  226. *
  227. * @param members 群成员(TIMGroupMemberInfo*)列表
  228. */
  229. typedef void (^TIMGroupMemberSuccV2)(uint64_t nextSeq, NSArray * members);
  230. /**
  231. * 群搜索回调
  232. *
  233. * @param totalNum 搜索结果的总数
  234. * @param groups 请求的群列表片段
  235. */
  236. typedef void (^TIMGroupSearchSucc)(uint64_t totalNum, NSArray * groups);
  237. /**
  238. * 获取群组未决请求列表成功
  239. *
  240. * @param meta 未决请求元信息
  241. * @param pendencies 未决请求列表(TIMGroupPendencyItem)数组
  242. */
  243. typedef void (^TIMGetGroupPendencyListSucc)(TIMGroupPendencyMeta * meta, NSArray * pendencies);
  244. #pragma mark - 基本类型
  245. /**
  246. * 创建群参数
  247. */
  248. @interface TIMCreateGroupInfo : TIMCodingModel
  249. /**
  250. * 群组Id,nil则使用系统默认Id
  251. */
  252. @property(nonatomic,strong) NSString* group;
  253. /**
  254. * 群名
  255. */
  256. @property(nonatomic,strong) NSString* groupName;
  257. /**
  258. * 群类型:Private,Public,ChatRoom,AVChatRoom,BChatRoom
  259. */
  260. @property(nonatomic,strong) NSString* groupType;
  261. /**
  262. * 是否设置入群选项,Private类型群组请设置为false
  263. */
  264. @property(nonatomic,assign) BOOL setAddOpt;
  265. /**
  266. * 入群选项
  267. */
  268. @property(nonatomic,assign) TIMGroupAddOpt addOpt;
  269. /**
  270. * 最大成员数,填0则系统使用默认值
  271. */
  272. @property(nonatomic,assign) uint32_t maxMemberNum;
  273. /**
  274. * 群公告
  275. */
  276. @property(nonatomic,strong) NSString* notification;
  277. /**
  278. * 群简介
  279. */
  280. @property(nonatomic,strong) NSString* introduction;
  281. /**
  282. * 群头像
  283. */
  284. @property(nonatomic,strong) NSString* faceURL;
  285. /**
  286. * 自定义字段集合,key是NSString*类型,value是NSData*类型
  287. */
  288. @property(nonatomic,strong) NSDictionary* customInfo;
  289. /**
  290. * 创建成员(TIMCreateGroupMemberInfo*)列表
  291. */
  292. @property(nonatomic,strong) NSArray* membersInfo;
  293. @end
  294. /**
  295. * 未决请求选项
  296. */
  297. @interface TIMGroupPendencyOption : TIMCodingModel
  298. /**
  299. * 拉取的起始时间 0:拉取最新的
  300. */
  301. @property(nonatomic,assign) uint64_t timestamp;
  302. /**
  303. * 每页的数量
  304. */
  305. @property(nonatomic,assign) uint32_t numPerPage;
  306. @end
  307. /**
  308. * 未决请求元信息
  309. */
  310. @interface TIMGroupPendencyMeta : TIMCodingModel
  311. /**
  312. * 下一次拉取的起始时间戳
  313. */
  314. @property(nonatomic,assign) uint64_t nextStartTime;
  315. /**
  316. * 已读时间戳大小
  317. */
  318. @property(nonatomic,assign) uint64_t readTimeSeq;
  319. /**
  320. * 未决未读数
  321. */
  322. @property(nonatomic,assign) uint32_t unReadCnt;
  323. @end
  324. /**
  325. * 创建群组时的成员信息
  326. */
  327. @interface TIMCreateGroupMemberInfo : TIMCodingModel
  328. /**
  329. * 被操作成员
  330. */
  331. @property(nonatomic,strong) NSString* member;
  332. /**
  333. * 成员类型
  334. */
  335. @property(nonatomic,assign) TIMGroupMemberRole role;
  336. /**
  337. * 自定义字段集合,key是NSString*类型,value是NSData*类型
  338. */
  339. @property(nonatomic,strong) NSDictionary* customInfo;
  340. @end
  341. /**
  342. * 成员操作返回值
  343. */
  344. @interface TIMGroupMemberResult : NSObject
  345. /**
  346. * 被操作成员
  347. */
  348. @property(nonatomic,strong) NSString* member;
  349. /**
  350. * 返回状态
  351. */
  352. @property(nonatomic,assign) TIMGroupMemberStatus status;
  353. @end
  354. /**
  355. * 未决申请
  356. */
  357. @interface TIMGroupPendencyItem : TIMCodingModel
  358. /**
  359. * 相关群组id
  360. */
  361. @property(nonatomic,strong) NSString* groupId;
  362. /**
  363. * 请求者id,请求加群:请求者,邀请加群:邀请人
  364. */
  365. @property(nonatomic,strong) NSString* fromUser;
  366. /**
  367. * 判决者id,请求加群:0,邀请加群:被邀请人
  368. */
  369. @property(nonatomic,strong) NSString* toUser;
  370. /**
  371. * 未决添加时间
  372. */
  373. @property(nonatomic,assign) uint64_t addTime;
  374. /**
  375. * 未决请求类型
  376. */
  377. @property(nonatomic,assign) TIMGroupPendencyGetType getType;
  378. /**
  379. * 已决标志
  380. */
  381. @property(nonatomic,assign) TIMGroupPendencyHandleStatus handleStatus;
  382. /**
  383. * 已决结果
  384. */
  385. @property(nonatomic,assign) TIMGroupPendencyHandleResult handleResult;
  386. /**
  387. * 申请或邀请附加信息
  388. */
  389. @property(nonatomic,strong) NSString* requestMsg;
  390. /**
  391. * 审批信息:同意或拒绝信息
  392. */
  393. @property(nonatomic,strong) NSString* handledMsg;
  394. /**
  395. * 同意申请
  396. *
  397. * @param msg 同意理由,选填
  398. * @param succ 成功回调
  399. * @param fail 失败回调,返回错误码和错误描述
  400. */
  401. -(void) accept:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  402. /**
  403. * 拒绝申请
  404. *
  405. * @param msg 拒绝理由,选填
  406. * @param succ 成功回调
  407. * @param fail 失败回调,返回错误码和错误描述
  408. */
  409. -(void) refuse:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  410. /**
  411. * 用户自己的id
  412. */
  413. @property(nonatomic,strong) NSString* selfIdentifier;
  414. @end
  415. #endif /* TIMComm_Group_h */