WFCCTypingMessageContent.m 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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 = [super encode];
  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. [super decode:payload];
  20. self.type = [payload.content intValue];
  21. }
  22. + (int)getContentType {
  23. return MESSAGE_CONTENT_TYPE_TYPING;
  24. }
  25. + (int)getContentFlags {
  26. return WFCCPersistFlag_TRANSPARENT;
  27. }
  28. + (instancetype)contentType:(WFCCTypingType)type {
  29. WFCCTypingMessageContent *content = [[WFCCTypingMessageContent alloc] init];
  30. content.type = type;
  31. return content;
  32. }
  33. + (void)load {
  34. [[WFCCIMService sharedWFCIMService] registerMessageContent:self];
  35. }
  36. - (NSString *)digest:(WFCCMessage *)message {
  37. return nil;
  38. }
  39. @end