adium-1.4 3568:8edc9f32d9ff: When a subcontact of a metacontact ...

commits at adium.im commits at adium.im
Mon Jul 11 13:50:00 UTC 2011


details:	http://hg.adium.im/adium-1.4/rev/8edc9f32d9ff
revision:	3568:8edc9f32d9ff
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Mon Jul 11 15:49:07 2011 +0200

When a subcontact of a metacontact is typing or has unviewed content, apply the status coloring to the metacontact as well, so the metacontact gets highlighted even if this subcontact is not the prefered contact.

Fixes #14493

diffs (94 lines):

diff -r a8e4da84a3ce -r 8edc9f32d9ff Frameworks/Adium Framework/Source/AIListContactCell.m
--- a/Frameworks/Adium Framework/Source/AIListContactCell.m	Mon Jul 11 10:25:11 2011 +0200
+++ b/Frameworks/Adium Framework/Source/AIListContactCell.m	Mon Jul 11 15:49:07 2011 +0200
@@ -669,9 +669,6 @@
 - (NSColor *)textColor
 {
 	NSColor	*theTextColor;
-	//BOOL	isEvent = [listObject boolValueForProperty:@"Is Event"];
-	/* XXX If it's an event, we may want to be inheriting from more than just the metacontact's preferred contact...
-	 * this is the only case for that which I've come across */
 	if (shouldUseContactTextColors && (theTextColor = [listObject valueForProperty:@"Text Color"])) {
 		return theTextColor;
 	} else {
diff -r a8e4da84a3ce -r 8edc9f32d9ff Source/AIContactStatusColoringPlugin.m
--- a/Source/AIContactStatusColoringPlugin.m	Mon Jul 11 10:25:11 2011 +0200
+++ b/Source/AIContactStatusColoringPlugin.m	Mon Jul 11 15:49:07 2011 +0200
@@ -146,6 +146,8 @@
     NSInteger				unviewedContent;
 	CGFloat			opacity = FULL_IMAGE_OPACITY;
 	BOOL			isEvent = NO;
+	// Only in the case the other contact is typing or has unread contact should we apply it to the meta contact as well
+	BOOL			applyToMetaToo = NO;
 
     //Prefetch the value for unviewed content, we need it multiple times below
     unviewedContent = [inContact integerValueForProperty:KEY_UNVIEWED_CONTENT];
@@ -160,6 +162,7 @@
             invertedColor = unviewedContentInvertedColor;
             labelColor = unviewedContentLabelColor;
 			isEvent = YES;
+			applyToMetaToo = YES;
         }
     }
 
@@ -189,7 +192,7 @@
             invertedColor = typingInvertedColor;
             labelColor = typingLabelColor;
 			isEvent = YES;
-			
+			applyToMetaToo = YES;
         }
     }
 
@@ -226,21 +229,40 @@
     }
 
     //Apply the color and opacity
-    [inContact setValue:color
-			forProperty:@"Text Color"
-				 notify:NotifyNever];
+	
+	[inContact setValue:color
+						  forProperty:@"Text Color"
+							   notify:NotifyNever];
     [inContact setValue:invertedColor
-			forProperty:@"Inverted Text Color"
-				 notify:NotifyNever];
+						  forProperty:@"Inverted Text Color"
+							   notify:NotifyNever];
     [inContact setValue:labelColor
-			forProperty:@"Label Color"
-				 notify:NotifyNever];
+						  forProperty:@"Label Color"
+							   notify:NotifyNever];
 	[inContact setValue:[NSNumber numberWithDouble:opacity]
-			forProperty:@"Image Opacity"
-				 notify:NotifyNever];
+						  forProperty:@"Image Opacity"
+							   notify:NotifyNever];
 	[inContact setValue:[NSNumber numberWithBool:isEvent]
-			forProperty:@"Is Event"
-				 notify:NotifyNever];
+						  forProperty:@"Is Event"
+							   notify:NotifyNever];
+	
+	if (applyToMetaToo && [inContact metaContact]) {
+		[[inContact metaContact] setValue:color
+							  forProperty:@"Text Color"
+								   notify:NotifyNever];
+		[[inContact metaContact] setValue:invertedColor
+							  forProperty:@"Inverted Text Color"
+								   notify:NotifyNever];
+		[[inContact metaContact] setValue:labelColor
+							  forProperty:@"Label Color"
+								   notify:NotifyNever];
+		[[inContact metaContact] setValue:[NSNumber numberWithDouble:opacity]
+							  forProperty:@"Image Opacity"
+								   notify:NotifyNever];
+		[[inContact metaContact] setValue:[NSNumber numberWithBool:isEvent]
+							  forProperty:@"Is Event"
+								   notify:NotifyNever];
+	}
 }
 
 //Flash all handles with unviewed content




More information about the commits mailing list