adium-1.4 3073:ca0f5c1a8856: Avoid wasting time trying to group ...

commits at adium.im commits at adium.im
Mon Oct 11 16:24:35 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/ca0f5c1a8856
revision:	3073:ca0f5c1a8856
author:		Evan Schoenberg
date:		Mon Oct 11 11:24:25 2010 -0500

Avoid wasting time trying to group a metacontact with itself. Buglet found through debug logging in #13871 - refs #13871

diffs (34 lines):

diff -r 17ffa2f367a1 -r ca0f5c1a8856 Source/AIContactController.m
--- a/Source/AIContactController.m	Sat Oct 09 19:26:43 2010 +0200
+++ b/Source/AIContactController.m	Mon Oct 11 11:24:25 2010 -0500
@@ -285,9 +285,8 @@
 	
 	if (listContact.canJoinMetaContacts) {
 		AIListObject *existingObject = [localGroup objectWithService:listContact.service UID:listContact.UID];
-		if (existingObject) {
-			//If an object exists in this group with the same UID and serviceID, create a MetaContact
-			//for the two.
+		if (existingObject && (existingObject != listContact)) {
+			/* If an object exists in this group with the same UID and serviceID, create a MetaContact for the two. */
 			AIMetaContact *metaContact = [self groupContacts:[NSArray arrayWithObjects:listContact,existingObject,nil]];
 			
 			AILogWithSignature(@"%@ and %@ match; grouped into %@",
@@ -1541,16 +1540,15 @@
 	}
 	
 	if (contact.existsServerside) {
+		/* This is an AIListContact for an online account; just perform the serverside move */
 		if (contact.account.online)
 			[contact.account moveListObjects:[NSArray arrayWithObject:contact] fromGroups:oldGroups toGroups:groups];
 	} else {
 		[self _moveContactLocally:contact fromGroups:oldGroups toGroups:groups];
 		
 		if ([contact conformsToProtocol:@protocol(AIContainingObject)]) {
-			id<AIContainingObject> container = (id<AIContainingObject>)contact;
-			
 			//This is a meta contact, move the objects within it.
-			for (AIListContact *child in container) {
+			for (AIListContact *child in (id<AIContainingObject>)contact) {
 				//Only move the contact if it is actually listed on the account in question
 				if (child.account.online && !child.isStranger)
 					[child.account moveListObjects:[NSArray arrayWithObject:child] fromGroups:oldGroups toGroups:groups];




More information about the commits mailing list