-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathATGroup.m
More file actions
99 lines (74 loc) · 1.7 KB
/
ATGroup.m
File metadata and controls
99 lines (74 loc) · 1.7 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
94
95
96
97
98
99
//
// ATGroup.m
// ATMail
//
// Created by ‚“c@–¾Žj on 06/04/09.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "ATGroup.h"
@implementation ATGroup
- (id)initWith:(NSString *)aDisplayName with:(NSArray *)aMailboxList
{
[super init];
[self setDisplayName:aDisplayName];
[self setMailboxList:aMailboxList];
return self;
}
- (void) dealloc
{
[self setDisplayName:nil];
[self setMailboxList:nil];
[super dealloc];
}
- (void)encodeWithCoder:(NSCoder*)coder
{
[coder encodeObject:displayName forKey:@"displayName"];
[coder encodeObject:mailboxList forKey:@"mailboxList"];
}
- (id)initWithCoder:(NSCoder*)decoder
{
self = [super init];
[self setDisplayName:[decoder decodeObjectForKey:@"displayName"]];
[self setMailboxList:[decoder decodeObjectForKey:@"mailboxList"]];
return self;
}
- (void)setDisplayName:(NSString *)aDisplayName
{
[displayName release];
displayName = [aDisplayName copy];
}
- (NSString *)displayName
{
return displayName;
}
- (void)setMailboxList:(NSArray *)aMailboxList
{
[mailboxList release];
mailboxList = [aMailboxList copy];
}
- (NSArray *)mailboxList
{
return mailboxList;
}
- (NSString *)value
{
return [self stringValue];
}
- (NSString *)stringValue
{
NSMutableString *aString = [NSMutableString stringWithFormat:@"%@:", [self displayName]];
if ([self mailboxList])
{
NSEnumerator *enumerator = [[self mailboxList] objectEnumerator];
id aMailbox = [enumerator nextObject];
if (aMailbox)
[aString appendString:[aMailbox stringValue]];
while (aMailbox = [enumerator nextObject])
{
[aString appendFormat:@", %@", [aMailbox stringValue]];
}
}
[aString appendString:@";"];
return aString;
}
@end