BoxedMessage.m 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // _____ _
  2. // |_ _| |_ _ _ ___ ___ _ __ __ _
  3. // | | | ' \| '_/ -_) -_) ' \/ _` |_
  4. // |_| |_||_|_| \___\___|_|_|_\__,_(_)
  5. //
  6. // Threema iOS Client
  7. // Copyright (c) 2012-2020 Threema GmbH
  8. //
  9. // This program is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU Affero General Public License, version 3,
  11. // as published by the Free Software Foundation.
  12. //
  13. // This program is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. // GNU Affero General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Affero General Public License
  19. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  20. #import "BoxedMessage.h"
  21. @implementation BoxedMessage
  22. @synthesize fromIdentity;
  23. @synthesize toIdentity;
  24. @synthesize messageId;
  25. @synthesize date;
  26. @synthesize flags;
  27. @synthesize pushFromName;
  28. @synthesize nonce;
  29. @synthesize box;
  30. @synthesize deliveryDate;
  31. @synthesize delivered;
  32. @synthesize userAck;
  33. @synthesize sendUserAck;
  34. - (id)initWithCoder:(NSCoder *)coder {
  35. self = [super init];
  36. if (self) {
  37. self.fromIdentity = [coder decodeObjectForKey:@"fromIdentity"];
  38. self.toIdentity = [coder decodeObjectForKey:@"toIdentity"];
  39. self.messageId = [coder decodeObjectForKey:@"messageId"];
  40. self.date = [coder decodeObjectForKey:@"date"];
  41. self.flags = (uint8_t)[coder decodeIntegerForKey:@"flags"];
  42. self.pushFromName = [coder decodeObjectForKey:@"pushFromName"];
  43. self.nonce = [coder decodeObjectForKey:@"nonce"];
  44. self.box = [coder decodeObjectForKey:@"box"];
  45. self.deliveryDate = [coder decodeObjectForKey:@"deliveryDate"];
  46. self.delivered = [coder decodeObjectForKey:@"delivered"];
  47. self.userAck = [coder decodeObjectForKey:@"userAck"];
  48. self.sendUserAck =[coder decodeObjectForKey:@"sendUserAck"];
  49. }
  50. return self;
  51. }
  52. - (void)encodeWithCoder:(NSCoder *)coder {
  53. [coder encodeObject:self.fromIdentity forKey:@"fromIdentity"];
  54. [coder encodeObject:self.toIdentity forKey:@"toIdentity"];
  55. [coder encodeObject:self.messageId forKey:@"messageId"];
  56. [coder encodeObject:self.date forKey:@"date"];
  57. [coder encodeInt:self.flags forKey:@"flags"];
  58. [coder encodeObject:self.pushFromName forKey:@"pushFromName"];
  59. [coder encodeObject:self.nonce forKey:@"nonce"];
  60. [coder encodeObject:self.box forKey:@"box"];
  61. [coder encodeObject:self.deliveryDate forKey:@"deliveryDate"];
  62. [coder encodeObject:self.delivered forKey:@"delivered"];
  63. [coder encodeObject:self.userAck forKey:@"userAck"];
  64. [coder encodeObject:self.sendUserAck forKey:@"sendUserAck"];
  65. }
  66. @end