EMCmdMessageBody.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*!
  2. * \~chinese
  3. * @header EMCmdMessageBody.h
  4. * @abstract 命令消息体
  5. * @author Hyphenate
  6. * @version 3.00
  7. *
  8. * \~english
  9. * @header EMCmdMessageBody.h
  10. * @abstract Command message body
  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. * Command message body
  22. */
  23. @interface EMCmdMessageBody : EMMessageBody
  24. /*!
  25. * \~chinese
  26. * 命令内容
  27. *
  28. * \~english
  29. * Command content
  30. */
  31. @property (nonatomic, copy) NSString *action;
  32. /*!
  33. * \~chinese
  34. * 命令参数,只是为了兼容老版本,应该使用EMMessage的扩展属性来代替
  35. *
  36. * \~english
  37. * Command parameters, only compatible with old sdk versions. For SDK version 3.0+, use EMMessage's ext property instead
  38. */
  39. @property (nonatomic, copy) NSArray *params;
  40. /*!
  41. * \~chinese
  42. * 是否只投递在线用户,默认NO
  43. *
  44. * \~english
  45. * If this cmd msg is deliver to the online users only, default is NO.
  46. */
  47. @property (nonatomic) BOOL isDeliverOnlineOnly;
  48. /*!
  49. * \~chinese
  50. * 初始化命令消息体
  51. * 用户自己定义的字符串,接收到后,解析出自己定义的字符串,就知道某件事情发过来了。
  52. * ex. 用户要做位置共享,这里的字符串就可以是"loc",解析出"loc"后,就知道这条消息是位置共享的消息了,之后其他信息可以放到.ext属性中去解析。
  53. * ex. 用户如果需要做”阅后即焚“功能,这里就可以自己写一个字符串,如”Snap“,之后.ext里带上要删除的messageid,接收方收到后,就可以删除对应的message,到达阅后即焚的效果
  54. *
  55. * @param aAction 命令内容
  56. *
  57. * @result 命令消息体实例
  58. *
  59. * \~english
  60. * Construct command message body
  61. * Developer self-defined command string that can be used for specifing custom action/command.
  62. * ex. Share a location: mark the action with "location" string, then the parser knows that it's a command message about location sharing and find more attributes stored in extension property .ext.
  63. * ex. Self-destructive message like Snapchat: mark the action ”selfDestructive“ and add the messageId of the message to be destruct and expiration time as part of .ext
  64. *
  65. * @param aAction Self-defined command string content
  66. *
  67. * @result Instance of command message body
  68. */
  69. - (instancetype)initWithAction:(NSString *)aAction;
  70. @end