adium 3355:00c947eb7046: Avoid wasting time trying to group a me...

commits at adium.im commits at adium.im
Mon Oct 11 17:51:43 UTC 2010


details:	http://hg.adium.im/adium/rev/00c947eb7046
revision:	3355:00c947eb7046
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
(transplanted from ca0f5c1a8856845bd71c04b08d40ff1f9e456e28)

diffs (34 lines):

diff -r 4c1ce49f878c -r 00c947eb7046 Source/AIContactController.m
--- a/Source/AIContactController.m	Sun Oct 10 11:27:15 2010 -0400
+++ b/Source/AIContactController.m	Mon Oct 11 11:24:25 2010 -0500
@@ -288,9 +288,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 %@",
@@ -1560,16 +1559,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