-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEXPersistentMessage.m
More file actions
93 lines (77 loc) · 1.91 KB
/
EXPersistentMessage.m
File metadata and controls
93 lines (77 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// EXMessage.m
// Entropy
// (C) 2007-2009 Codesign
// Licensed under LGPL (v3)
//
#import "EXPersistentMessage.h"
@implementation EXPersistentMessage
- (id)initWithFrom:(id)_from to:(id)_to content:(id)_content {
if (self = [super init]) {
from = [_from retain];
to = [_to retain];
content = [_content retain];
}
return self;
}
- (id)mutableCopyWithZone:(NSZone*)zone {
EXPersistentMessage* message = [[EXPersistentMessage allocWithZone: zone] initWithFrom: from to: to content: content];
return message;
}
- (void)setPosted:(NSDate*)date {
posted = [date retain];
}
- (void)setSent:(NSDate*)date {
posted = [sent retain];
}
- (void)setDelivered:(NSDate*)date {
delivered = [sent retain];
}
- (void)encodeWithCoder:(NSCoder*)coder {
[coder encodeObject: from forKey: @"from"];
[coder encodeObject: to forKey: @"to"];
[coder encodeObject: content forKey: @"content"];
[coder encodeObject: posted forKey: @"posted"];
[coder encodeObject: sent forKey: @"sent"];
[coder encodeObject: delivered forKey: @"delivered"];
}
- (id)initWithCoder:(NSCoder*)coder {
if (self = [super init]) {
from = [[coder decodeObjectForKey: @"from"] retain];
to = [[coder decodeObjectForKey: @"to"] retain];
content = [[coder decodeObjectForKey: @"content"] retain];
posted = [[coder decodeObjectForKey: @"posted"] retain];
sent = [[coder decodeObjectForKey: @"sent"] retain];
delivered = [[coder decodeObjectForKey: @"delivered"] retain];
}
return self;
}
- (id)content {
return content;
}
- (id)from {
return from;
}
- (id)to {
return to;
}
- (void)setTo:(id)_to {
if (to != _to) {
[to release];
to = [_to retain];
}
}
- (NSComparisonResult)compare:(EXPersistentMessage*)message {
return [self->sent compare: message->sent];
}
- (void)dealloc {
[from release];
[to release];
[content release];
[posted release];
[sent release];
[delivered release];
//NSLog(@"Message - dealloced");
[super dealloc];
}
@end