TIMComm.h 25 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255
  1. //
  2. // TIMComm.h
  3. // ImSDK
  4. //
  5. // Created by bodeng on 29/1/15.
  6. // Copyright (c) 2015 tencent. All rights reserved.
  7. //
  8. #ifndef ImSDK_TIMComm_h
  9. #define ImSDK_TIMComm_h
  10. #import <Foundation/Foundation.h>
  11. #define ERR_IMSDK_KICKED_BY_OTHERS 6208
  12. @protocol TIMConnListener;
  13. @protocol TIMUserStatusListener;
  14. @protocol TIMRefreshListener;
  15. @protocol TIMMessageReceiptListener;
  16. @protocol TIMMessageUpdateListener;
  17. @protocol TIMMessageRevokeListener;
  18. @protocol TIMUploadProgressListener;
  19. @protocol TIMGroupEventListener;
  20. @protocol TIMFriendshipListener;
  21. @protocol TIMGroupListener;
  22. @class TIMMessage;
  23. @class TIMImageElem;
  24. @class TIMConversation;
  25. @class TIMAPNSConfig;
  26. @class TIMUserProfile;
  27. @class TIMGroupInfoOption;
  28. @class TIMGroupMemberInfoOption;
  29. @class TIMFriendProfileOption;
  30. #pragma mark - 枚举类型
  31. /**
  32. * 网络连接状态
  33. */
  34. typedef NS_ENUM(NSInteger, TIMNetworkStatus) {
  35. /**
  36. * 已连接
  37. */
  38. TIM_NETWORK_STATUS_CONNECTED = 1,
  39. /**
  40. * 链接断开
  41. */
  42. TIM_NETWORK_STATUS_DISCONNECTED = 2,
  43. };
  44. /**
  45. * 日志级别
  46. */
  47. typedef NS_ENUM(NSInteger, TIMLogLevel) {
  48. TIM_LOG_NONE = 0,
  49. TIM_LOG_ERROR = 1,
  50. TIM_LOG_WARN = 2,
  51. TIM_LOG_INFO = 3,
  52. TIM_LOG_DEBUG = 4,
  53. };
  54. /**
  55. * 会话类型:
  56. * C2C 双人聊天
  57. * GROUP 群聊
  58. */
  59. typedef NS_ENUM(NSInteger, TIMConversationType) {
  60. /**
  61. * C2C 类型
  62. */
  63. TIM_C2C = 1,
  64. /**
  65. * 群聊 类型
  66. */
  67. TIM_GROUP = 2,
  68. /**
  69. * 系统消息
  70. */
  71. TIM_SYSTEM = 3,
  72. };
  73. /**
  74. * 消息状态
  75. */
  76. typedef NS_ENUM(NSInteger, TIMMessageStatus){
  77. /**
  78. * 消息发送中
  79. */
  80. TIM_MSG_STATUS_SENDING = 1,
  81. /**
  82. * 消息发送成功
  83. */
  84. TIM_MSG_STATUS_SEND_SUCC = 2,
  85. /**
  86. * 消息发送失败
  87. */
  88. TIM_MSG_STATUS_SEND_FAIL = 3,
  89. /**
  90. * 消息被删除
  91. */
  92. TIM_MSG_STATUS_HAS_DELETED = 4,
  93. /**
  94. * 导入到本地的消息
  95. */
  96. TIM_MSG_STATUS_LOCAL_STORED = 5,
  97. /**
  98. * 被撤销的消息
  99. */
  100. TIM_MSG_STATUS_LOCAL_REVOKED = 6,
  101. };
  102. /**
  103. * 消息优先级标识
  104. */
  105. typedef NS_ENUM(NSInteger, TIMMessagePriority) {
  106. /**
  107. * 高优先级,一般为红包或者礼物消息
  108. */
  109. TIM_MSG_PRIORITY_HIGH = 1,
  110. /**
  111. * 普通优先级,普通消息
  112. */
  113. TIM_MSG_PRIORITY_NORMAL = 2,
  114. /**
  115. * 低优先级,一般为点赞消息
  116. */
  117. TIM_MSG_PRIORITY_LOW = 3,
  118. /**
  119. * 最低优先级,一般为后台下发的成员进退群通知
  120. */
  121. TIM_MSG_PRIORITY_LOWEST = 4,
  122. };
  123. /**
  124. * 图片压缩选项
  125. */
  126. typedef NS_ENUM(NSInteger, TIM_IMAGE_COMPRESS_TYPE){
  127. /**
  128. * 原图(不压缩)
  129. */
  130. TIM_IMAGE_COMPRESS_ORIGIN = 0x00,
  131. /**
  132. * 高压缩率:图片较小,默认值
  133. */
  134. TIM_IMAGE_COMPRESS_HIGH = 0x01,
  135. /**
  136. * 低压缩:高清图发送(图片较大)
  137. */
  138. TIM_IMAGE_COMPRESS_LOW = 0x02,
  139. };
  140. /**
  141. * 图片类型
  142. */
  143. typedef NS_ENUM(NSInteger, TIM_IMAGE_TYPE){
  144. /**
  145. * 原图
  146. */
  147. TIM_IMAGE_TYPE_ORIGIN = 0x01,
  148. /**
  149. * 缩略图
  150. */
  151. TIM_IMAGE_TYPE_THUMB = 0x02,
  152. /**
  153. * 大图
  154. */
  155. TIM_IMAGE_TYPE_LARGE = 0x04,
  156. };
  157. /**
  158. * 图片格式
  159. */
  160. typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){
  161. /**
  162. * JPG格式
  163. */
  164. TIM_IMAGE_FORMAT_JPG = 0x1,
  165. /**
  166. * GIF格式
  167. */
  168. TIM_IMAGE_FORMAT_GIF = 0x2,
  169. /**
  170. * PNG格式
  171. */
  172. TIM_IMAGE_FORMAT_PNG = 0x3,
  173. /**
  174. * BMP格式
  175. */
  176. TIM_IMAGE_FORMAT_BMP = 0x4,
  177. /**
  178. * 未知格式
  179. */
  180. TIM_IMAGE_FORMAT_UNKNOWN = 0xff,
  181. };
  182. typedef NS_ENUM(NSInteger, TIMLoginStatus) {
  183. /**
  184. * 已登陆
  185. */
  186. TIM_STATUS_LOGINED = 1,
  187. /**
  188. * 登陆中
  189. */
  190. TIM_STATUS_LOGINING = 2,
  191. /**
  192. * 无登陆
  193. */
  194. TIM_STATUS_LOGOUT = 3,
  195. };
  196. typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) {
  197. /**
  198. * 未知
  199. */
  200. TIM_GROUP_MEMBER_VISIBLE_UNKNOWN = 0x00,
  201. /**
  202. * 群组成员不可见
  203. */
  204. TIM_GROUP_MEMBER_VISIBLE_NO = 0x01,
  205. /**
  206. * 群组成员可见
  207. */
  208. TIM_GROUP_MEMBER_VISIBLE_YES = 0x02,
  209. };
  210. typedef NS_ENUM(NSInteger, TIMGroupSearchableType) {
  211. /**
  212. * 未知
  213. */
  214. TIM_GROUP_SEARCHABLE_UNKNOWN = 0x00,
  215. /**
  216. * 群组不能被搜到
  217. */
  218. TIM_GROUP_SEARCHABLE_NO = 0x01,
  219. /**
  220. * 群组能被搜到
  221. */
  222. TIM_GROUP_SEARCHABLE_YES = 0x02,
  223. };
  224. /**
  225. * 加群选项
  226. */
  227. typedef NS_ENUM(NSInteger, TIMGroupAddOpt) {
  228. /**
  229. * 禁止加群
  230. */
  231. TIM_GROUP_ADD_FORBID = 0,
  232. /**
  233. * 需要管理员审批
  234. */
  235. TIM_GROUP_ADD_AUTH = 1,
  236. /**
  237. * 任何人可以加入
  238. */
  239. TIM_GROUP_ADD_ANY = 2,
  240. };
  241. /**
  242. * 群组提示类型
  243. */
  244. typedef NS_ENUM(NSInteger, TIMGroupTipsType){
  245. /**
  246. * 成员加入
  247. */
  248. TIM_GROUP_TIPS_JOIN = 1,
  249. /**
  250. * 成员离开
  251. */
  252. TIM_GROUP_TIPS_QUIT = 2,
  253. /**
  254. * 成员被踢
  255. */
  256. TIM_GROUP_TIPS_KICK = 3,
  257. /**
  258. * 成员设置管理员
  259. */
  260. TIM_GROUP_TIPS_SET_ADMIN = 4,
  261. /**
  262. * 成员取消管理员
  263. */
  264. TIM_GROUP_TIPS_CANCEL_ADMIN = 5,
  265. };
  266. /**
  267. * 群消息接受选项
  268. */
  269. typedef NS_ENUM(NSInteger, TIMGroupReceiveMessageOpt) {
  270. /**
  271. * 接收消息
  272. */
  273. TIM_GROUP_RECEIVE_MESSAGE = 0,
  274. /**
  275. * 不接收消息,服务器不进行转发
  276. */
  277. TIM_GROUP_NOT_RECEIVE_MESSAGE = 1,
  278. /**
  279. * 接受消息,不进行iOS APNs 推送
  280. */
  281. TIM_GROUP_RECEIVE_NOT_NOTIFY_MESSAGE = 2,
  282. };
  283. /**
  284. * 群Tips类型
  285. */
  286. typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){
  287. /**
  288. * 邀请加入群 (opUser & groupName & userList)
  289. */
  290. TIM_GROUP_TIPS_TYPE_INVITE = 0x01,
  291. /**
  292. * 退出群 (opUser & groupName & userList)
  293. */
  294. TIM_GROUP_TIPS_TYPE_QUIT_GRP = 0x02,
  295. /**
  296. * 踢出群 (opUser & groupName & userList)
  297. */
  298. TIM_GROUP_TIPS_TYPE_KICKED = 0x03,
  299. /**
  300. * 设置管理员 (opUser & groupName & userList)
  301. */
  302. TIM_GROUP_TIPS_TYPE_SET_ADMIN = 0x04,
  303. /**
  304. * 取消管理员 (opUser & groupName & userList)
  305. */
  306. TIM_GROUP_TIPS_TYPE_CANCEL_ADMIN = 0x05,
  307. /**
  308. * 群资料变更 (opUser & groupName & introduction & notification & faceUrl & owner)
  309. */
  310. TIM_GROUP_TIPS_TYPE_INFO_CHANGE = 0x06,
  311. /**
  312. * 群成员资料变更 (opUser & groupName & memberInfoList)
  313. */
  314. TIM_GROUP_TIPS_TYPE_MEMBER_INFO_CHANGE = 0x07,
  315. };
  316. /**
  317. * 群Tips类型
  318. */
  319. typedef NS_ENUM(NSInteger, TIM_GROUP_INFO_CHANGE_TYPE){
  320. /**
  321. * 群名修改
  322. */
  323. TIM_GROUP_INFO_CHANGE_GROUP_NAME = 0x01,
  324. /**
  325. * 群简介修改
  326. */
  327. TIM_GROUP_INFO_CHANGE_GROUP_INTRODUCTION = 0x02,
  328. /**
  329. * 群公告修改
  330. */
  331. TIM_GROUP_INFO_CHANGE_GROUP_NOTIFICATION = 0x03,
  332. /**
  333. * 群头像修改
  334. */
  335. TIM_GROUP_INFO_CHANGE_GROUP_FACE = 0x04,
  336. /**
  337. * 群主变更
  338. */
  339. TIM_GROUP_INFO_CHANGE_GROUP_OWNER = 0x05,
  340. };
  341. /**
  342. * 群系统消息类型
  343. */
  344. typedef NS_ENUM(NSInteger, TIM_GROUP_SYSTEM_TYPE){
  345. /**
  346. * 申请加群请求(只有管理员会收到)
  347. */
  348. TIM_GROUP_SYSTEM_ADD_GROUP_REQUEST_TYPE = 0x01,
  349. /**
  350. * 申请加群被同意(只有申请人能够收到)
  351. */
  352. TIM_GROUP_SYSTEM_ADD_GROUP_ACCEPT_TYPE = 0x02,
  353. /**
  354. * 申请加群被拒绝(只有申请人能够收到)
  355. */
  356. TIM_GROUP_SYSTEM_ADD_GROUP_REFUSE_TYPE = 0x03,
  357. /**
  358. * 被管理员踢出群(只有被踢的人能够收到)
  359. */
  360. TIM_GROUP_SYSTEM_KICK_OFF_FROM_GROUP_TYPE = 0x04,
  361. /**
  362. * 群被解散(全员能够收到)
  363. */
  364. TIM_GROUP_SYSTEM_DELETE_GROUP_TYPE = 0x05,
  365. /**
  366. * 创建群消息(创建者能够收到)
  367. */
  368. TIM_GROUP_SYSTEM_CREATE_GROUP_TYPE = 0x06,
  369. /**
  370. * 邀请入群通知(被邀请者能够收到)
  371. */
  372. TIM_GROUP_SYSTEM_INVITED_TO_GROUP_TYPE = 0x07,
  373. /**
  374. * 主动退群(主动退群者能够收到)
  375. */
  376. TIM_GROUP_SYSTEM_QUIT_GROUP_TYPE = 0x08,
  377. /**
  378. * 设置管理员(被设置者接收)
  379. */
  380. TIM_GROUP_SYSTEM_GRANT_ADMIN_TYPE = 0x09,
  381. /**
  382. * 取消管理员(被取消者接收)
  383. */
  384. TIM_GROUP_SYSTEM_CANCEL_ADMIN_TYPE = 0x0a,
  385. /**
  386. * 群已被回收(全员接收)
  387. */
  388. TIM_GROUP_SYSTEM_REVOKE_GROUP_TYPE = 0x0b,
  389. /**
  390. * 邀请入群请求(被邀请者接收)
  391. */
  392. TIM_GROUP_SYSTEM_INVITE_TO_GROUP_REQUEST_TYPE = 0x0c,
  393. /**
  394. * 邀请加群被同意(只有发出邀请者会接收到)
  395. */
  396. TIM_GROUP_SYSTEM_INVITE_TO_GROUP_ACCEPT_TYPE = 0x0d,
  397. /**
  398. * 邀请加群被拒绝(只有发出邀请者会接收到)
  399. */
  400. TIM_GROUP_SYSTEM_INVITE_TO_GROUP_REFUSE_TYPE = 0x0e,
  401. /**
  402. * 用户自定义通知(默认全员接收)
  403. */
  404. TIM_GROUP_SYSTEM_CUSTOM_INFO = 0xff,
  405. };
  406. typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) {
  407. /**
  408. * 按照默认规则进行推送
  409. */
  410. TIM_OFFLINE_PUSH_DEFAULT = 0,
  411. /**
  412. * 不进行推送
  413. */
  414. TIM_OFFLINE_PUSH_NO_PUSH = 1,
  415. };
  416. typedef NS_ENUM(NSInteger, TIMAndroidOfflinePushNotifyMode) {
  417. /**
  418. * 通知栏消息
  419. */
  420. TIM_ANDROID_OFFLINE_PUSH_NOTIFY_MODE_NOTIFICATION = 0x00,
  421. /**
  422. * 不弹窗,由应用自行处理
  423. */
  424. TIM_ANDROID_OFFLINE_PUSH_NOTIFY_MODE_CUSTOM = 0x01,
  425. };
  426. /**
  427. * 群成员角色
  428. */
  429. typedef NS_ENUM(NSInteger, TIMGroupMemberRole) {
  430. /**
  431. * 未定义(没有获取该字段)
  432. */
  433. TIM_GROUP_MEMBER_UNDEFINED = 0,
  434. /**
  435. * 群成员
  436. */
  437. TIM_GROUP_MEMBER_ROLE_MEMBER = 200,
  438. /**
  439. * 群管理员
  440. */
  441. TIM_GROUP_MEMBER_ROLE_ADMIN = 300,
  442. /**
  443. * 群主
  444. */
  445. TIM_GROUP_MEMBER_ROLE_SUPER = 400,
  446. };
  447. typedef NS_ENUM(NSInteger, TIMFriendAllowType) {
  448. /**
  449. * 同意任何用户加好友
  450. */
  451. TIM_FRIEND_ALLOW_ANY = 0,
  452. /**
  453. * 需要验证
  454. */
  455. TIM_FRIEND_NEED_CONFIRM = 1,
  456. /**
  457. * 拒绝任何人加好友
  458. */
  459. TIM_FRIEND_DENY_ANY = 2,
  460. };
  461. typedef NS_ENUM(NSInteger, TIMGender) {
  462. /**
  463. * 未知性别
  464. */
  465. TIM_GENDER_UNKNOWN = 0,
  466. /**
  467. * 男性
  468. */
  469. TIM_GENDER_MALE = 1,
  470. /**
  471. * 女性
  472. */
  473. TIM_GENDER_FEMALE = 2,
  474. };
  475. /**
  476. * 基本资料标志位
  477. */
  478. typedef NS_ENUM(NSInteger, TIMProfileFlag) {
  479. /**
  480. * 昵称
  481. */
  482. TIM_PROFILE_FLAG_NICK = 0x01,
  483. /**
  484. * 好友验证方式
  485. */
  486. TIM_PROFILE_FLAG_ALLOW_TYPE = (0x01 << 1),
  487. /**
  488. * 头像
  489. */
  490. TIM_PROFILE_FLAG_FACE_URL = (0x01 << 2),
  491. /**
  492. * 好友备注
  493. */
  494. TIM_PROFILE_FLAG_REMARK = (0x01 << 3),
  495. /**
  496. * 好友分组
  497. */
  498. TIM_PROFILE_FLAG_GROUP = (0x01 << 4),
  499. /**
  500. * 用户签名
  501. */
  502. TIM_PROFILE_FLAG_SELFSIGNATURE = (0x01 << 5),
  503. /**
  504. * 用户性别
  505. */
  506. TIM_PROFILE_FLAG_GENDER = (0x01 << 6),
  507. /**
  508. * 用户生日
  509. */
  510. TIM_PROFILE_FLAG_BIRTHDAY = (0x01 << 7),
  511. /**
  512. * 用户区域
  513. */
  514. TIM_PROFILE_FLAG_LOCATION = (0x01 << 8),
  515. /**
  516. * 用户语言
  517. */
  518. TIM_PROFILE_FLAG_LANGUAGE = (0x01 << 9),
  519. };
  520. #pragma mark - block回调
  521. /**
  522. * 获取消息回调
  523. *
  524. * @param msgs 消息列表
  525. */
  526. typedef void (^TIMGetMsgSucc)(NSArray * msgs);
  527. /**
  528. * 一般操作成功回调
  529. */
  530. typedef void (^TIMSucc)();
  531. /**
  532. * 操作失败回调
  533. *
  534. * @param code 错误码
  535. * @param msg 错误描述,配合错误码使用,如果问题建议打印信息定位
  536. */
  537. typedef void (^TIMFail)(int code, NSString * msg);
  538. /**
  539. * 登陆成功回调
  540. */
  541. typedef void (^TIMLoginSucc)();
  542. /**
  543. * 获取资源
  544. *
  545. * @param data 资源二进制
  546. */
  547. typedef void (^TIMGetResourceSucc)(NSData * data);
  548. /**
  549. * 日志回调
  550. *
  551. * @param lvl 输出的日志级别
  552. * @param msg 日志内容
  553. */
  554. typedef void (^TIMLogFunc)(TIMLogLevel lvl, NSString * msg);
  555. /**
  556. * 上传图片成功回调
  557. *
  558. * @param elem 上传图片成功后elem
  559. */
  560. typedef void (^TIMUploadImageSucc)(TIMImageElem * elem);
  561. /**
  562. * APNs推送配置更新成功回调
  563. *
  564. * @param config 配置
  565. */
  566. typedef void (^TIMAPNSConfigSucc)(TIMAPNSConfig* config);
  567. /**
  568. * 群创建成功
  569. *
  570. * @param groupId 群组Id
  571. */
  572. typedef void (^TIMCreateGroupSucc)(NSString * groupId);
  573. /**
  574. * 好友列表
  575. *
  576. * @param friends 好友列表
  577. */
  578. typedef void (^TIMFriendSucc)(NSArray * friends);
  579. /**
  580. * 获取资料回调
  581. *
  582. * @param profile 资料
  583. */
  584. typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
  585. #pragma mark - 基本类型
  586. @interface TIMCodingModel : NSObject <NSCoding>
  587. - (void)encodeWithCoder:(NSCoder *)encoder;
  588. - (id)initWithCoder:(NSCoder *)decoder;
  589. @end
  590. @interface TIMSdkConfig : NSObject
  591. /**
  592. * 用户标识接入SDK的应用ID,必填
  593. */
  594. @property(nonatomic,assign) int sdkAppId;
  595. /**
  596. * 用户的账号类型,必填
  597. */
  598. @property(nonatomic,strong) NSString * accountType;
  599. /**
  600. * 禁用crash上报,默认上报
  601. */
  602. @property(nonatomic,assign) BOOL disableCrashReport;
  603. /**
  604. * 禁止在控制台打印log
  605. */
  606. @property(nonatomic,assign) BOOL disableLogPrint;
  607. /**
  608. * 本地写log文件的等级,默认DEBUG等级
  609. */
  610. @property(nonatomic,assign) TIMLogLevel logLevel;
  611. /**
  612. * log文件路径,不设置时为默认路径
  613. */
  614. @property(nonatomic,strong) NSString * logPath;
  615. /**
  616. * 回调给log函数的log等级,默认DEBUG等级
  617. */
  618. @property(nonatomic,assign) TIMLogLevel logFuncLevel;
  619. /**
  620. * log监听函数
  621. */
  622. @property(nonatomic,copy) TIMLogFunc logFunc;
  623. /**
  624. * 消息数据库路径,不设置时为默认路径
  625. */
  626. @property(nonatomic,strong) NSString * dbPath;
  627. /**
  628. * 网络监听器
  629. */
  630. @property(nonatomic,strong) id<TIMConnListener> connListener;
  631. @end
  632. @interface TIMUserConfig : NSObject
  633. /**
  634. * 禁用本地存储(加载消息扩展包有效)
  635. */
  636. @property(nonatomic,assign) BOOL disableStorage;
  637. /**
  638. * 禁止自动上报(加载消息扩展包有效)
  639. */
  640. @property(nonatomic,assign) BOOL disableAutoReport;
  641. /**
  642. * 开启C2C已读回执(加载消息扩展包有效)
  643. */
  644. @property(nonatomic,assign) BOOL enableReadReceipt;
  645. /**
  646. * 不开启最近联系人(加载消息扩展包有效)
  647. */
  648. @property(nonatomic,assign) BOOL disableRecnetContact;
  649. /**
  650. * 不通过onNewMessage:抛出最近联系人的最后一条消息(加载消息扩展包有效)
  651. */
  652. @property(nonatomic,assign) BOOL disableRecentContactNotify;
  653. /**
  654. * 开启关系链数据本地缓存功能(加载好友扩展包有效)
  655. */
  656. @property(nonatomic,assign) BOOL enableFriendshipProxy;
  657. /**
  658. * 开启群组数据本地缓存功能(加载群组扩展包有效)
  659. */
  660. @property(nonatomic,assign) BOOL enableGroupAssistant;
  661. /**
  662. * 设置默认拉取的群组资料
  663. */
  664. @property(nonatomic,strong) TIMGroupInfoOption * groupInfoOpt;
  665. /**
  666. * 设置默认拉取的群成员资料
  667. */
  668. @property(nonatomic,strong) TIMGroupMemberInfoOption * groupMemberInfoOpt;
  669. /**
  670. * 设置默认拉取的好友资料
  671. */
  672. @property(nonatomic,strong) TIMFriendProfileOption * friendProfileOpt;
  673. /**
  674. * 用户登录状态监听器
  675. */
  676. @property(nonatomic,strong) id<TIMUserStatusListener> userStatusListener;
  677. /**
  678. * 会话刷新监听器(未读计数、已读同步)(加载消息扩展包有效)
  679. */
  680. @property(nonatomic,strong) id<TIMRefreshListener> refreshListener;
  681. /**
  682. * 消息已读回执监听器(加载消息扩展包有效)
  683. */
  684. @property(nonatomic,strong) id<TIMMessageReceiptListener> receiptListener;
  685. /**
  686. * 消息svr重写监听器(加载消息扩展包有效)
  687. */
  688. @property(nonatomic,strong) id<TIMMessageUpdateListener> messageUpdateListener;
  689. /**
  690. * 消息撤回监听器(加载消息扩展包有效)
  691. */
  692. @property(nonatomic,strong) id<TIMMessageRevokeListener> messgeRevokeListener;
  693. /**
  694. * 文件上传进度监听器
  695. */
  696. @property(nonatomic,strong) id<TIMUploadProgressListener> uploadProgressListener;
  697. /**
  698. * 群组事件通知监听器
  699. */
  700. @property(nonatomic,strong) id<TIMGroupEventListener> groupEventListener;
  701. /**
  702. * 关系链数据本地缓存监听器(加载好友扩展包、enableFriendshipProxy有效)
  703. */
  704. @property(nonatomic,strong) id<TIMFriendshipListener> friendshipListener;
  705. /**
  706. * 群组据本地缓存监听器(加载群组扩展包、enableGroupAssistant有效)
  707. */
  708. @property(nonatomic,strong) id<TIMGroupListener> groupListener;
  709. @end
  710. /**
  711. * 登陆信息
  712. */
  713. @interface TIMLoginParam : NSObject
  714. /**
  715. * 用户名
  716. */
  717. @property(nonatomic,strong) NSString* identifier;
  718. /**
  719. * 鉴权Token
  720. */
  721. @property(nonatomic,strong) NSString* userSig;
  722. /**
  723. * App用户使用OAuth授权体系分配的Appid
  724. */
  725. @property(nonatomic,strong) NSString* appidAt3rd;
  726. @end
  727. /**
  728. * APNs 配置
  729. */
  730. @interface TIMAPNSConfig : NSObject
  731. /**
  732. * 是否开启推送:0-不进行设置 1-开启推送 2-关闭推送
  733. */
  734. @property(nonatomic,assign) uint32_t openPush;
  735. /**
  736. * C2C消息声音,不设置传入nil
  737. */
  738. @property(nonatomic,strong) NSString * c2cSound;
  739. /**
  740. * Group消息声音,不设置传入nil
  741. */
  742. @property(nonatomic,strong) NSString * groupSound;
  743. /**
  744. * Video声音,不设置传入nil
  745. */
  746. @property(nonatomic,strong) NSString * videoSound;
  747. @end
  748. /**
  749. * SetToken 参数
  750. */
  751. @interface TIMTokenParam : NSObject
  752. /**
  753. * 获取的客户端Token信息
  754. */
  755. @property(nonatomic,strong) NSData* token;
  756. /**
  757. * 业务ID,传递证书时分配
  758. */
  759. @property(nonatomic,assign) uint32_t busiId;
  760. @end
  761. /**
  762. * 切后台参数
  763. */
  764. @interface TIMBackgroundParam : NSObject
  765. /**
  766. * C2C 未读计数
  767. */
  768. @property(nonatomic,assign) int c2cUnread;
  769. /**
  770. * 群 未读计数
  771. */
  772. @property(nonatomic,assign) int groupUnread;
  773. @end
  774. @interface TIMMessageLocator : NSObject
  775. /**
  776. * 所属会话的id
  777. */
  778. @property(nonatomic,strong) NSString * sessId;
  779. /**
  780. * 所属会话的类型
  781. */
  782. @property(nonatomic,assign) TIMConversationType sessType;
  783. /**
  784. * 消息序列号
  785. */
  786. @property(nonatomic,assign) uint64_t seq;
  787. /**
  788. * 消息随机码
  789. */
  790. @property(nonatomic,assign) uint64_t rand;
  791. /**
  792. * 消息时间戳
  793. */
  794. @property(nonatomic,assign) time_t time;
  795. /**
  796. * 是否本人消息
  797. */
  798. @property(nonatomic,assign) BOOL isSelf;
  799. /**
  800. * 是否来自撤销通知
  801. */
  802. @property(nonatomic,assign) BOOL isFromRevokeNotify;
  803. @end
  804. /**
  805. * 已读回执
  806. */
  807. @interface TIMMessageReceipt : NSObject
  808. /**
  809. * 已读回执对应的会话(目前只支持C2C会话)
  810. */
  811. @property(nonatomic,strong) TIMConversation * conversation;
  812. /**
  813. * 收到已读回执时,这个时间戳之前的消息都已读
  814. */
  815. @property(nonatomic,assign) time_t timestamp;
  816. @end
  817. @interface TIMAndroidOfflinePushConfig : NSObject
  818. /**
  819. * 离线推送时展示标签
  820. */
  821. @property(nonatomic,strong) NSString * title;
  822. /**
  823. * Android离线Push时声音字段信息
  824. */
  825. @property(nonatomic,strong) NSString * sound;
  826. /**
  827. * 离线推送时通知形式
  828. */
  829. @property(nonatomic,assign) TIMAndroidOfflinePushNotifyMode notifyMode;
  830. @end
  831. @interface TIMIOSOfflinePushConfig : NSObject
  832. /**
  833. * 离线Push时声音字段信息
  834. */
  835. @property(nonatomic,strong) NSString * sound;
  836. /**
  837. * 忽略badge计数
  838. */
  839. @property(nonatomic,assign) BOOL ignoreBadge;
  840. @end
  841. /**
  842. * 群组内的本人信息
  843. */
  844. @interface TIMGroupSelfInfo : NSObject
  845. /**
  846. * 加入群组时间
  847. */
  848. @property(nonatomic,assign) uint32_t joinTime;
  849. /**
  850. * 群组中的角色
  851. */
  852. @property(nonatomic,assign) TIMGroupMemberRole role;
  853. /**
  854. * 群组消息接收选项
  855. */
  856. @property(nonatomic,assign) TIMGroupReceiveMessageOpt recvOpt;
  857. /**
  858. * 群组中的未读消息数
  859. */
  860. @property(nonatomic,assign) uint32_t unReadMessageNum;
  861. @end
  862. /**
  863. * 群资料信息
  864. */
  865. @interface TIMGroupInfo : TIMCodingModel
  866. /**
  867. * 群组Id
  868. */
  869. @property(nonatomic,strong) NSString* group;
  870. /**
  871. * 群名
  872. */
  873. @property(nonatomic,strong) NSString* groupName;
  874. /**
  875. * 群创建人/管理员
  876. */
  877. @property(nonatomic,strong) NSString * owner;
  878. /**
  879. * 群类型:Private,Public,ChatRoom
  880. */
  881. @property(nonatomic,strong) NSString* groupType;
  882. /**
  883. * 群创建时间
  884. */
  885. @property(nonatomic,assign) uint32_t createTime;
  886. /**
  887. * 最近一次群资料修改时间
  888. */
  889. @property(nonatomic,assign) uint32_t lastInfoTime;
  890. /**
  891. * 最近一次发消息时间
  892. */
  893. @property(nonatomic,assign) uint32_t lastMsgTime;
  894. /**
  895. * 最大成员数
  896. */
  897. @property(nonatomic,assign) uint32_t maxMemberNum;
  898. /**
  899. * 群成员数量
  900. */
  901. @property(nonatomic,assign) uint32_t memberNum;
  902. /**
  903. * 入群类型
  904. */
  905. @property(nonatomic,assign) TIMGroupAddOpt addOpt;
  906. /**
  907. * 群公告
  908. */
  909. @property(nonatomic,strong) NSString* notification;
  910. /**
  911. * 群简介
  912. */
  913. @property(nonatomic,strong) NSString* introduction;
  914. /**
  915. * 群头像
  916. */
  917. @property(nonatomic,strong) NSString* faceURL;
  918. /**
  919. * 最后一条消息
  920. */
  921. @property(nonatomic,strong) TIMMessage* lastMsg;
  922. /**
  923. * 在线成员数量
  924. */
  925. @property(nonatomic,assign) uint32_t onlineMemberNum;
  926. /**
  927. * 群组是否被搜索类型
  928. */
  929. @property(nonatomic,assign) TIMGroupSearchableType isSearchable;
  930. /**
  931. * 群组成员可见类型
  932. */
  933. @property(nonatomic,assign) TIMGroupMemberVisibleType isMemberVisible;
  934. /**
  935. * 群组中的本人信息
  936. */
  937. @property(nonatomic,strong) TIMGroupSelfInfo* selfInfo;
  938. /**
  939. * 自定义字段集合,key是NSString*类型,value是NSData*类型
  940. */
  941. @property(nonatomic,strong) NSDictionary* customInfo;
  942. @end
  943. /**
  944. * 事件上报信息
  945. */
  946. @interface TIMEventReportItem : NSObject
  947. /**
  948. * 事件id
  949. */
  950. @property(nonatomic,assign) uint32_t event;
  951. /**
  952. * 错误码
  953. */
  954. @property(nonatomic,assign) uint32_t code;
  955. /**
  956. * 错误描述
  957. */
  958. @property(nonatomic,strong) NSString * desc;
  959. /**
  960. * 事件延迟(单位ms)
  961. */
  962. @property(nonatomic,assign) uint32_t delay;
  963. @end
  964. @interface TIMGroupInfoOption : NSObject
  965. /**
  966. * 需要获取的群组信息标志(TIMGetGroupBaseInfoFlag),默认为0xffffff
  967. */
  968. @property(nonatomic,assign) uint64_t groupFlags;
  969. /**
  970. * 需要获取群组资料的自定义信息(NSString*)列表
  971. */
  972. @property(nonatomic,strong) NSArray * groupCustom;
  973. @end
  974. @interface TIMGroupMemberInfoOption : NSObject
  975. /**
  976. * 需要获取的群成员标志(TIMGetGroupMemInfoFlag),默认为0xffffff
  977. */
  978. @property(nonatomic,assign) uint64_t memberFlags;
  979. /**
  980. * 需要获取群成员资料的自定义信息(NSString*)列表
  981. */
  982. @property(nonatomic,strong) NSArray * memberCustom;
  983. @end
  984. /**
  985. * 成员操作返回值
  986. */
  987. @interface TIMGroupMemberInfo : TIMCodingModel
  988. /**
  989. * 被操作成员
  990. */
  991. @property(nonatomic,strong) NSString* member;
  992. /**
  993. * 群名片
  994. */
  995. @property(nonatomic,strong) NSString* nameCard;
  996. /**
  997. * 加入群组时间
  998. */
  999. @property(nonatomic,assign) time_t joinTime;
  1000. /**
  1001. * 成员类型
  1002. */
  1003. @property(nonatomic,assign) TIMGroupMemberRole role;
  1004. /**
  1005. * 禁言结束时间(时间戳)
  1006. */
  1007. @property(nonatomic,assign) uint32_t silentUntil;
  1008. /**
  1009. * 自定义字段集合,key是NSString*类型,value是NSData*类型
  1010. */
  1011. @property(nonatomic,strong) NSDictionary* customInfo;
  1012. @end
  1013. @interface TIMFriendProfileOption : NSObject
  1014. /**
  1015. * 需要获取的好友信息标志(TIMProfileFlag),默认为0xffffff
  1016. */
  1017. @property(nonatomic,assign) uint64_t friendFlags;
  1018. /**
  1019. * 需要获取的好友自定义信息(NSString*)列表
  1020. */
  1021. @property(nonatomic,strong) NSArray * friendCustom;
  1022. /**
  1023. * 需要获取的用户自定义信息(NSString*)列表
  1024. */
  1025. @property(nonatomic,strong) NSArray * userCustom;
  1026. @end
  1027. /**
  1028. * 好友资料
  1029. */
  1030. @interface TIMUserProfile : TIMCodingModel
  1031. /**
  1032. * 用户identifier
  1033. */
  1034. @property(nonatomic,strong) NSString* identifier;
  1035. /**
  1036. * 用户昵称
  1037. */
  1038. @property(nonatomic,strong) NSString* nickname;
  1039. /**
  1040. * 用户备注(最大96字节,获取自己资料时,该字段为空)
  1041. */
  1042. @property(nonatomic,strong) NSString* remark;
  1043. /**
  1044. * 好友验证方式
  1045. */
  1046. @property(nonatomic,assign) TIMFriendAllowType allowType;
  1047. /**
  1048. * 用户头像
  1049. */
  1050. @property(nonatomic,strong) NSString* faceURL;
  1051. /**
  1052. * 用户签名
  1053. */
  1054. @property(nonatomic,strong) NSData* selfSignature;
  1055. /**
  1056. * 好友性别
  1057. */
  1058. @property(nonatomic,assign) TIMGender gender;
  1059. /**
  1060. * 好友生日
  1061. */
  1062. @property(nonatomic,assign) uint32_t birthday;
  1063. /**
  1064. * 好友区域
  1065. */
  1066. @property(nonatomic,strong) NSData* location;
  1067. /**
  1068. * 好友语言
  1069. */
  1070. @property(nonatomic,assign) uint32_t language;
  1071. /**
  1072. * 好友分组名称 NSString* 列表
  1073. */
  1074. @property(nonatomic,strong) NSArray* friendGroups;
  1075. /**
  1076. * 自定义字段集合,key是NSString*类型,value是NSData*类型
  1077. * (key值按照后台配置的字符串传入)
  1078. */
  1079. @property(nonatomic,strong) NSDictionary* customInfo;
  1080. @end
  1081. #endif