Adium

Changeset 15331

Show
Ignore:
Timestamp:
02/23/2006 03:23:59 PM (3 years ago)
Author:
catfish_man
Message:

Adding support for %senderColor% for Kopete compatibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m

    r15325 r15331  
    4545#define APPEND_NEXT_MESSAGE_NO_SCROLL   @"appendNextMessageNoScroll(\"%@\");" 
    4646 
     47#define VALID_SENDER_COLORS_ARRAY [[NSArray alloc] initWithObjects:@"red", @"blue" , @"gray", @"magenta", @"violet", @"olive", @"yellowgreen", @"darkred", @"darkgreen", @"darksalmon", @"darkcyan", @"darkyellow", @"mediumpurple", @"peru", @"olivedrab", @"royalred", @"darkorange", @"slateblue", @"slategray", @"goldenrod", @"orangered", @"tomato", @"dogderblue", @"steelblue", @"deeppink", @"saddlebrown", @"coral", @"royalblue", nil] 
     48 
     49static NSArray *validSenderColors; 
     50 
    4751@interface NSMutableString (AIKeywordReplacementAdditions) 
    4852- (void) replaceKeyword:(NSString *)word withString:(NSString *)newWord; 
     
    630634        [inString replaceKeyword:@"%senderStatusIcon%" 
    631635                                  withString:[self statusIconPathForListObject:[content source]]]; 
     636         
     637        if(!validSenderColors) validSenderColors = VALID_SENDER_COLORS_ARRAY; 
     638        [inString replaceKeyword:@"%senderColor%" 
     639                                  withString:[validSenderColors objectAtIndex:([[[content source] UID] hash] % ([validSenderColors count] - 1))]]; 
    632640         
    633641        //Replaces %time{x}% with a timestamp formatted like x (using NSDateFormatter)