-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEXMessage.m
More file actions
63 lines (51 loc) · 1.15 KB
/
EXMessage.m
File metadata and controls
63 lines (51 loc) · 1.15 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
//
// EXMessage.m
// Entropy
// (C) 2007-2009 Codesign
// Licensed under LGPL (v3)
//
#import "EXMessage.h"
@implementation EXMessage
- (id)initWithObject:(id)_object {
if (self = [super init]) {
object = [_object retain];
status = EXMessageStatusPending;
timeStamp = [[NSDate date] timeIntervalSinceReferenceDate];
}
return self;
}
- (void)setHost:(NSString*)_host port:(int)_port {
host = [_host retain];
port = _port;
}
- (void)setStatusToProcessed {
status = EXMessageStatusProcessed;
}
- (NSComparisonResult)compare:(EXMessage*)message {
NSComparisonResult result = [host compare: message->host];
if (result == NSOrderedSame) {
if (port < message->port) result = NSOrderedAscending;
else if (port > message->port) result = NSOrderedDescending;
else if (timeStamp < message->timeStamp) result = NSOrderedAscending;
else if (timeStamp > message->timeStamp) result = NSOrderedDescending;
}
return result;
}
- (NSString*)host {
return host;
}
- (int)port {
return port;
}
- (id)object {
return object;
}
- (EXMessageStatus)status {
return status;
}
- (void)dealloc {
[object release];
[host release];
[super dealloc];
}
@end