1.1 --- a/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Wed Oct 28 14:27:46 2009 -0400
1.2 +++ b/Plugins/WebKit Message View/AIWebkitMessageViewStyle.m Thu Oct 29 12:57:14 2009 -0400
1.3 @@ -55,8 +55,6 @@
1.4 // We set back, when the user finishes editing, the correct topic, which wipes out the existance of the span before. We don't need to undo the dbl click action.
1.5 #define TOPIC_INDIVIDUAL_WRAPPER @"<span id=\"topicEdit\" ondblclick=\"this.setAttribute('contentEditable', true); this.focus();\">%@</span>"
1.6
1.7 -static NSArray *validSenderColors;
1.8 -
1.9 @interface NSMutableString (AIKeywordReplacementAdditions)
1.10 - (void) replaceKeyword:(NSString *)word withString:(NSString *)newWord;
1.11 - (void) safeReplaceCharactersInRange:(NSRange)range withString:(NSString *)newWord;
1.12 @@ -247,6 +245,21 @@
1.13
1.14 @synthesize allowsCustomBackground, allowsUserIcons, allowsColors, userIconMask;
1.15
1.16 +- (NSArray *)validSenderColors
1.17 +{
1.18 + if(!checkedSenderColors) {
1.19 + NSURL *url = [NSURL fileURLWithPath:[stylePath stringByAppendingPathComponent:@"Incoming/SenderColors.txt"]];
1.20 + NSString *senderColorsFile = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:NULL];
1.21 +
1.22 + if(senderColorsFile)
1.23 + validSenderColors = [[senderColorsFile componentsSeparatedByString:@":"] retain];
1.24 +
1.25 + checkedSenderColors = YES;
1.26 + }
1.27 +
1.28 + return validSenderColors;
1.29 +}
1.30 +
1.31 - (BOOL)isBackgroundTransparent
1.32 {
1.33 //Our custom background is only transparent if the user has set a custom color with an alpha component less than 1.0
1.34 @@ -776,15 +789,8 @@
1.35 [inString replaceKeyword:@"%messageClasses%"
1.36 withString:[(contentIsSimilar ? @"consecutive " : @"") stringByAppendingString:[[content displayClasses] componentsJoinedByString:@" "]]];
1.37
1.38 - if(!validSenderColors) {
1.39 - NSURL *url = [NSURL fileURLWithPath:[stylePath stringByAppendingPathComponent:@"Incoming/SenderColors.txt"]];
1.40 - NSString *senderColorsFile = [NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:NULL];
1.41 -
1.42 - if(senderColorsFile)
1.43 - validSenderColors = [[senderColorsFile componentsSeparatedByString:@":"] retain];
1.44 - }
1.45 [inString replaceKeyword:@"%senderColor%"
1.46 - withString:[NSColor representedColorForObject:contentSource.UID withValidColors:validSenderColors]];
1.47 + withString:[NSColor representedColorForObject:contentSource.UID withValidColors:self.validSenderColors]];
1.48
1.49 //HAX. The odd conditional here detects the rtl html that our html parser spits out.
1.50 [inString replaceKeyword:@"%messageDirection%"
1.51 @@ -1149,8 +1155,11 @@
1.52 AIListContact *listObject = chat.listObject;
1.53 NSString *iconPath = nil;
1.54
1.55 - [inString replaceKeyword:@"%senderColor%"
1.56 - withString:[NSColor representedColorForObject:listObject.UID withValidColors:validSenderColors]];
1.57 + [inString replaceKeyword:@"%incomingColor%"
1.58 + withString:[NSColor representedColorForObject:listObject.UID withValidColors:self.validSenderColors]];
1.59 +
1.60 + [inString replaceKeyword:@"%outgoingColor%"
1.61 + withString:[NSColor representedColorForObject:chat.account.UID withValidColors:self.validSenderColors]];
1.62
1.63 if (listObject) {
1.64 iconPath = [listObject valueForProperty:KEY_WEBKIT_USER_ICON];