WFCCDeleteMessageContent.m 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //
  2. // WFCCTextMessageContent.m
  3. // WFChatClient
  4. //
  5. // Created by heavyrain on 2017/8/16.
  6. // Copyright © 2017年 WildFireChat. All rights reserved.
  7. //
  8. #import "WFCCDeleteMessageContent.h"
  9. #import "WFCCIMService.h"
  10. #import "WFCCNetworkService.h"
  11. #import "Common.h"
  12. @implementation WFCCDeleteMessageContent
  13. - (WFCCMessagePayload *)encode {
  14. //注意:在proto层收到撤回命令或主动撤回成功会直接更新被撤回的消息,如果修改encode&decode,需要同步修改
  15. WFCCMessagePayload *payload = [super encode];
  16. payload.contentType = [self.class getContentType];
  17. payload.content = self.operatorId;
  18. payload.binaryContent = [[[NSNumber numberWithLongLong:self.messageUid] stringValue] dataUsingEncoding:NSUTF8StringEncoding];
  19. return payload;
  20. }
  21. - (void)decode:(WFCCMessagePayload *)payload {
  22. [super decode:payload];
  23. //注意:在proto层收到撤回命令或主动撤回成功会直接更新被撤回的消息,如果修改encode&decode,需要同步修改
  24. self.operatorId = payload.content;
  25. self.messageUid = [[[NSString alloc] initWithData:payload.binaryContent encoding:NSUTF8StringEncoding] longLongValue];
  26. }
  27. + (int)getContentType {
  28. return MESSAGE_CONTENT_TYPE_DELETE;
  29. }
  30. + (int)getContentFlags {
  31. return WFCCPersistFlag_NOT_PERSIST;
  32. }
  33. + (void)load {
  34. [[WFCCIMService sharedWFCIMService] registerMessageContent:self];
  35. }
  36. - (NSString *)digest:(WFCCMessage *)message {
  37. return nil;
  38. }
  39. @end