WFCCTypingMessageContent.m 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. //
  2. // TypingMessageContent.m
  3. // WFChatClient
  4. //
  5. // Created by heavyrain on 2017/8/16.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCCTypingMessageContent.h"
  9. #import "WFCCIMService.h"
  10. #import "Common.h"
  11. @implementation WFCCTypingMessageContent
  12. - (WFCCMessagePayload *)encode {
  13. WFCCMessagePayload *payload = [[WFCCMessagePayload alloc] init];
  14. payload.contentType = [self.class getContentType];
  15. payload.content = [NSString stringWithFormat:@"%d", (int)self.type];
  16. return payload;
  17. }
  18. - (void)decode:(WFCCMessagePayload *)payload {
  19. self.type = [payload.content intValue];
  20. }
  21. + (int)getContentType {
  22. return MESSAGE_CONTENT_TYPE_TYPING;
  23. }
  24. + (int)getContentFlags {
  25. return WFCCPersistFlag_TRANSPARENT;
  26. }
  27. + (instancetype)contentType:(WFCCTypingType)type {
  28. WFCCTypingMessageContent *content = [[WFCCTypingMessageContent alloc] init];
  29. content.type = type;
  30. return content;
  31. }
  32. + (void)load {
  33. [[WFCCIMService sharedWFCIMService] registerMessageContent:self];
  34. }
  35. - (NSString *)digest {
  36. return nil;
  37. }
  38. @end