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