adium-1.4 2676:791780625051: Include bookmarks in the contact co...

commits at adium.im commits at adium.im
Thu Oct 29 01:04:56 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/791780625051
revision:	2676:791780625051
author:		Zachary West <zacw at adium.im>
date:		Wed Oct 28 21:04:52 2009 -0400

Include bookmarks in the contact controller's contactDict, so that a -contactEnumerator also contains them. By way of updating properly, fixes #13221.

We weren't providing LO updates to observers when updating all contacts, since the enumerator was being used. This also removes a bookmark-specific iterator when using the enumerator is now sufficient.

diffs (49 lines):

diff -r f4ba67614e13 -r 791780625051 Source/AIContactController.m
--- a/Source/AIContactController.m	Wed Oct 28 20:48:18 2009 -0400
+++ b/Source/AIContactController.m	Wed Oct 28 21:04:52 2009 -0400
@@ -255,6 +255,7 @@
 			}
 			
 			[bookmarkDict setObject:bookmark forKey:bookmark.internalObjectID];
+			[contactDict setObject:bookmark forKey:bookmark.internalObjectID];
 			
 			//It's a newly created object, so set its initial attributes
 			[contactPropertiesObserverManager _updateAllAttributesOfObject:bookmark];
@@ -378,11 +379,6 @@
 	for (AIListContact *contact in [self contactEnumerator]) {
 		[contact restoreGrouping];
 	}
-	
-	//Restore the grouping of all list bookmarks
-	for (AIListBookmark *bookmark in [self allBookmarks]) {
-		[bookmark restoreGrouping];
-	}
 
 	//Stop delaying object notifications; this will automatically resort the contact list, so we're done.
 	[contactPropertiesObserverManager endListObjectNotificationsDelay];
@@ -1002,7 +998,7 @@
 /*!
  * @brief Returns a flat array of all contacts
  *
- * This does not include metacontacts
+ * This does not include metacontacts or bookmarks.
  */
 - (NSArray *)allContacts
 {
@@ -1010,7 +1006,7 @@
 
 	for (AIListContact *contact in self.contactEnumerator) {
 		/* We want only contacts, not metacontacts. For a given contact, -[contact parentContact] could be used to access the meta. */
-		if (![contact conformsToProtocol:@protocol(AIContainingObject)])
+		if (![contact conformsToProtocol:@protocol(AIContainingObject)] || [contact isKindOfClass:[AIListBookmark class]])
 			[result addObject:contact];
 	}
 	
@@ -1263,6 +1259,7 @@
 {
 	[self moveContact:listBookmark fromGroups:listBookmark.groups intoGroups:[NSSet set]];
 	[bookmarkDict removeObjectForKey:listBookmark.internalObjectID];
+	[contactDict removeObjectForKey:listBookmark.internalObjectID];
 	
 	[self saveContactList];
 }




More information about the commits mailing list