|
David@0
|
1 |
/* |
|
David@0
|
2 |
* Adium is the legal property of its developers, whose names are listed in the copyright file included |
|
David@0
|
3 |
* with this source distribution. |
|
David@0
|
4 |
* |
|
David@0
|
5 |
* This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
|
David@0
|
6 |
* General Public License as published by the Free Software Foundation; either version 2 of the License, |
|
David@0
|
7 |
* or (at your option) any later version. |
|
David@0
|
8 |
* |
|
David@0
|
9 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
|
David@0
|
10 |
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
|
David@0
|
11 |
* Public License for more details. |
|
David@0
|
12 |
* |
|
David@0
|
13 |
* You should have received a copy of the GNU General Public License along with this program; if not, |
|
David@0
|
14 |
* write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
|
David@0
|
15 |
*/ |
|
David@0
|
16 |
|
|
David@0
|
17 |
#import <Adium/AIContentObject.h> |
|
David@0
|
18 |
#import <Adium/AIContentStatus.h> |
|
David@0
|
19 |
|
|
David@0
|
20 |
@implementation AIContentStatus |
|
David@0
|
21 |
|
|
David@0
|
22 |
//Create a new status content object |
|
David@0
|
23 |
+ (id)statusInChat:(AIChat *)inChat |
|
David@0
|
24 |
withSource:(id)inSource |
|
David@0
|
25 |
destination:(id)inDest |
|
David@0
|
26 |
date:(NSDate *)inDate |
|
David@0
|
27 |
message:(NSAttributedString *)inMessage |
|
David@0
|
28 |
withType:(NSString *)inStatus |
|
David@0
|
29 |
{ |
|
David@0
|
30 |
return [[[self alloc] initWithChat:inChat |
|
David@0
|
31 |
source:inSource |
|
David@0
|
32 |
destination:inDest |
|
David@0
|
33 |
date:inDate |
|
David@0
|
34 |
message:inMessage |
|
David@0
|
35 |
withType:inStatus] autorelease]; |
|
David@0
|
36 |
} |
|
David@0
|
37 |
|
|
David@0
|
38 |
//init |
|
David@0
|
39 |
- (id)initWithChat:(AIChat *)inChat |
|
David@0
|
40 |
source:(id)inSource |
|
David@0
|
41 |
destination:(id)inDest |
|
David@0
|
42 |
date:(NSDate *)inDate |
|
David@0
|
43 |
message:(NSAttributedString *)inMessage |
|
David@0
|
44 |
withType:(NSString *)inStatus |
|
David@0
|
45 |
{ |
|
David@515
|
46 |
if ((self = [super initWithChat:inChat source:inSource destination:inDest date:inDate message:inMessage])) { |
|
David@515
|
47 |
//Filter so that triggers in messages can be resolved, don't track status changes |
|
David@515
|
48 |
filterContent = YES; |
|
David@515
|
49 |
trackContent = NO; |
|
David@515
|
50 |
|
|
David@515
|
51 |
//Store source and dest |
|
David@515
|
52 |
statusType = [inStatus retain]; |
|
David@515
|
53 |
} |
|
David@0
|
54 |
|
|
David@515
|
55 |
return self; |
|
David@0
|
56 |
} |
|
David@0
|
57 |
|
|
David@0
|
58 |
//Dealloc |
|
David@0
|
59 |
- (void)dealloc |
|
David@0
|
60 |
{ |
|
David@0
|
61 |
[statusType release]; statusType = nil; |
|
David@0
|
62 |
[loggedMessage release]; loggedMessage = nil; |
|
David@0
|
63 |
[coalescingKey release]; coalescingKey = nil; |
|
David@0
|
64 |
|
|
David@515
|
65 |
[super dealloc]; |
|
David@0
|
66 |
} |
|
David@0
|
67 |
|
|
David@0
|
68 |
- (NSMutableArray *)displayClasses |
|
David@0
|
69 |
{ |
|
David@0
|
70 |
NSMutableArray *classes = [super displayClasses]; |
|
David@0
|
71 |
|
|
David@0
|
72 |
//The notion of direction is not very useful on statuses |
|
zacw@2620
|
73 |
NSUInteger idxin = [classes indexOfObject:@"incoming"]; |
|
zacw@2620
|
74 |
if(idxin != NSNotFound) |
|
zacw@2620
|
75 |
[classes removeObjectAtIndex:idxin]; |
|
zacw@2620
|
76 |
|
|
zacw@2620
|
77 |
NSUInteger idxout = [classes indexOfObject:@"outgoing"]; |
|
zacw@2620
|
78 |
if(idxout != NSNotFound) |
|
zacw@2620
|
79 |
[classes removeObjectAtIndex:idxout]; |
|
David@0
|
80 |
|
|
David@0
|
81 |
[classes addObject:@"status"]; |
|
David@0
|
82 |
[classes addObject:statusType]; |
|
David@0
|
83 |
return classes; |
|
David@0
|
84 |
} |
|
David@0
|
85 |
|
|
David@0
|
86 |
//Content Identifier |
|
David@0
|
87 |
- (NSString *)type |
|
David@0
|
88 |
{ |
|
David@0
|
89 |
return CONTENT_STATUS_TYPE; |
|
David@0
|
90 |
} |
|
David@0
|
91 |
|
|
David@0
|
92 |
//The type of status change this is |
|
David@515
|
93 |
@synthesize status = statusType; |
|
David@515
|
94 |
@synthesize loggedMessage; |
|
David@515
|
95 |
@synthesize coalescingKey; |
|
David@0
|
96 |
|
|
David@0
|
97 |
@end |