Include bookmarks in the contact controller's contactDict, so that a -contactEnumerator also contains them. By way of updating properly, fixes #13221.
authorZachary West <zacw@adium.im>
Wed Oct 28 21:04:52 2009 -0400 (2009-10-28)
changeset 28059b757472094b
parent 2804 2b6a6cd8c92f
child 2806 5585035f872b
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.
Source/AIContactController.m
     1.1 --- a/Source/AIContactController.m	Wed Oct 28 20:48:18 2009 -0400
     1.2 +++ b/Source/AIContactController.m	Wed Oct 28 21:04:52 2009 -0400
     1.3 @@ -255,6 +255,7 @@
     1.4  			}
     1.5  			
     1.6  			[bookmarkDict setObject:bookmark forKey:bookmark.internalObjectID];
     1.7 +			[contactDict setObject:bookmark forKey:bookmark.internalObjectID];
     1.8  			
     1.9  			//It's a newly created object, so set its initial attributes
    1.10  			[contactPropertiesObserverManager _updateAllAttributesOfObject:bookmark];
    1.11 @@ -378,11 +379,6 @@
    1.12  	for (AIListContact *contact in [self contactEnumerator]) {
    1.13  		[contact restoreGrouping];
    1.14  	}
    1.15 -	
    1.16 -	//Restore the grouping of all list bookmarks
    1.17 -	for (AIListBookmark *bookmark in [self allBookmarks]) {
    1.18 -		[bookmark restoreGrouping];
    1.19 -	}
    1.20  
    1.21  	//Stop delaying object notifications; this will automatically resort the contact list, so we're done.
    1.22  	[contactPropertiesObserverManager endListObjectNotificationsDelay];
    1.23 @@ -1002,7 +998,7 @@
    1.24  /*!
    1.25   * @brief Returns a flat array of all contacts
    1.26   *
    1.27 - * This does not include metacontacts
    1.28 + * This does not include metacontacts or bookmarks.
    1.29   */
    1.30  - (NSArray *)allContacts
    1.31  {
    1.32 @@ -1010,7 +1006,7 @@
    1.33  
    1.34  	for (AIListContact *contact in self.contactEnumerator) {
    1.35  		/* We want only contacts, not metacontacts. For a given contact, -[contact parentContact] could be used to access the meta. */
    1.36 -		if (![contact conformsToProtocol:@protocol(AIContainingObject)])
    1.37 +		if (![contact conformsToProtocol:@protocol(AIContainingObject)] || [contact isKindOfClass:[AIListBookmark class]])
    1.38  			[result addObject:contact];
    1.39  	}
    1.40  	
    1.41 @@ -1263,6 +1259,7 @@
    1.42  {
    1.43  	[self moveContact:listBookmark fromGroups:listBookmark.groups intoGroups:[NSSet set]];
    1.44  	[bookmarkDict removeObjectForKey:listBookmark.internalObjectID];
    1.45 +	[contactDict removeObjectForKey:listBookmark.internalObjectID];
    1.46  	
    1.47  	[self saveContactList];
    1.48  }