[Adium-commits] adium 1966:470a947d2d79: Remove useless override

adium-commits at adiumx.com adium-commits at adiumx.com
Fri Apr 24 21:42:47 UTC 2009


details:	http://hg.adiumx.com/adium/rev/470a947d2d79
revision:	1966:470a947d2d79
author:		David Smith <catfish.man at gmail.com>
date:		Fri Apr 24 14:04:15 2009 -0700

Remove useless override
Subject: adium 1967:59bd3023bd53: This was no longer correct

details:	http://hg.adiumx.com/adium/rev/59bd3023bd53
revision:	1967:59bd3023bd53
author:		David Smith <catfish.man at gmail.com>
date:		Fri Apr 24 14:42:30 2009 -0700

This was no longer correct
Subject: adium 1968:6c94121fc1c1: Automated merge with ssh://hg@hg.adiumx.com/adium

details:	http://hg.adiumx.com/adium/rev/6c94121fc1c1
revision:	1968:6c94121fc1c1
author:		David Smith <catfish.man at gmail.com>
date:		Fri Apr 24 14:42:40 2009 -0700

Automated merge with ssh://hg@hg.adiumx.com/adium

diffstat:

 Adium.xcodeproj/project.pbxproj                               |   3 -
 Frameworks/Adium Framework/Source/AIAbstractListController.m  |   2 +-
 Frameworks/Adium Framework/Source/AIContactHidingController.m |   8 +-
 Frameworks/Adium Framework/Source/AIListBookmark.m            |  33 ++++-
 Frameworks/Adium Framework/Source/AIListObject.m              |  28 ++-
 Frameworks/AutoHyperlinks Framework/Source/AHLinkLexer.l      |   1 +
 Plugins/Twitter Plugin/AITwitterAccount.m                     |   2 +
 Source/AIContactController.h                                  |   3 +-
 Source/AIContactController.m                                  |  24 ++-
 Source/AIListWindowController.m                               |  76 ++++--------
 Source/NEHGrowlPlugin.m                                       |   8 -
 11 files changed, 98 insertions(+), 90 deletions(-)

diffs (399 lines):

diff -r 18b74afae09c -r 6c94121fc1c1 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Fri Apr 24 09:41:40 2009 -0700
+++ b/Adium.xcodeproj/project.pbxproj	Fri Apr 24 14:42:40 2009 -0700
@@ -12625,7 +12625,6 @@
 				GCC_WARN_UNUSED_VARIABLE = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				PREBINDING = NO;
-				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				SDKROOT = macosx10.5;
 				STRIP_INSTALLED_PRODUCT = NO;
 				VALID_ARCHS = "i386 ppc ppc64 ppc7400 ppc970 x86_64";
@@ -12670,7 +12669,6 @@
 				MACOSX_DEPLOYMENT_TARGET = 10.5;
 				PLIST_FILE_OUTPUT_FORMAT = binary;
 				PREBINDING = NO;
-				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				SDKROOT = macosx10.5;
 				VALID_ARCHS = "i386 ppc ppc64 ppc7400 ppc970 x86_64";
 				WARNING_CFLAGS = "-Wall";
@@ -12717,7 +12715,6 @@
 				MACOSX_DEPLOYMENT_TARGET = 10.5;
 				PLIST_FILE_OUTPUT_FORMAT = binary;
 				PREBINDING = NO;
-				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				SDKROOT = macosx10.5;
 				STRIP_INSTALLED_PRODUCT = NO;
 				VALID_ARCHS = "i386 ppc ppc64 ppc7400 ppc970 x86_64";
diff -r 18b74afae09c -r 6c94121fc1c1 Frameworks/Adium Framework/Source/AIAbstractListController.m
--- a/Frameworks/Adium Framework/Source/AIAbstractListController.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIAbstractListController.m	Fri Apr 24 14:42:40 2009 -0700
@@ -673,7 +673,7 @@
 //
 - (BOOL)outlineView:(NSOutlineView *)outlineView expandStateOfItem:(AIProxyListObject *)item
 {
-    return !item || ((id<AIContainingObject>)(item.listObject)).expanded;
+    return !item || ((id<AIContainingObject>)(item.listObject)).expanded || [item.listObject boolValueForProperty:@"ExpandedByFiltering"];
 }
 
 /*!
diff -r 18b74afae09c -r 6c94121fc1c1 Frameworks/Adium Framework/Source/AIContactHidingController.m
--- a/Frameworks/Adium Framework/Source/AIContactHidingController.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIContactHidingController.m	Fri Apr 24 14:42:40 2009 -0700
@@ -135,10 +135,6 @@
 	if (![container containsObject:listObject])
 		return NO;
 	
-	// Don't do any processing for a contact that's always visible.
-	if (listObject.alwaysVisible)
-		return YES;
-	
 	if ([listObject conformsToProtocol:@protocol(AIContainingObject)]) {
 		// A meta contact must meet the criteria for a contact to be visible and also have at least 1 contained contact
 		return ([(id<AIContainingObject>)listObject visibleCount] > 0 || ([listObject boolValueForProperty:@"New Object"] &&
@@ -152,6 +148,10 @@
 		return [self evaluatePredicateOnListObject:listObject withSearchString:searchString];
 	}
 	
+	// Don't do any processing for a contact that's always visible.
+	if (listObject.alwaysVisible)
+		return YES;
+	
 	if ([listObject isKindOfClass:[AIListBookmark class]])
 		return ((AIListBookmark *)listObject).account.online;
 	
diff -r 18b74afae09c -r 6c94121fc1c1 Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.m	Fri Apr 24 14:42:40 2009 -0700
@@ -69,11 +69,15 @@
 
 -(id)initWithChat:(AIChat *)inChat
 {
-	return [self initWithUID:[NSString stringWithFormat:@"Bookmark:%@", inChat.uniqueChatID]
-					 account:inChat.account
-					 service:inChat.account.service
-				  dictionary:inChat.chatCreationDictionary
-						name:inChat.name];
+	if ((self = [self initWithUID:[NSString stringWithFormat:@"Bookmark:%@", inChat.uniqueChatID]
+						  account:inChat.account
+						  service:inChat.account.service
+					   dictionary:inChat.chatCreationDictionary
+							 name:inChat.name])) {
+		[self setDisplayName:inChat.displayName];
+	}
+	
+	return self;
 }
 
 - (id)initWithCoder:(NSCoder *)decoder
@@ -148,6 +152,23 @@
 }
 
 /*!
+ * @brief Internal ID for this object
+ *
+ * An object ID generated by Adium that is shared by all objects which are, to most intents and purposes, identical to
+ * this object.  Ths ID is composed of the service ID and UID, so any object with identical services and object IDs
+ * will have the same value here.
+ */
+- (NSString *)internalObjectID
+{
+	if (!internalObjectID) {
+		// We're not like any other bookmarks by the same name.
+		internalObjectID = [[NSString stringWithFormat:@"%@.%@.%@", self.service.serviceID, self.UID, self.account.UID] retain];
+	}
+	
+	return internalObjectID;
+}
+
+/*!
  * @brief Set our display name
  *
  * Update the display name of our chat if our display name changes.
@@ -280,7 +301,7 @@
 - (BOOL)chatIsOurs:(AIChat *)chat
 {
 	return (chat &&
-			[chat.name isEqualToString:self.name] &&
+			[chat.name isEqualToString:[self.account.service normalizeChatName:self.name]] &&
 			chat.account == self.account &&
 			((!chat.chatCreationDictionary && !self.chatCreationDictionary) ||
 			 ([chat.chatCreationDictionary isEqualToDictionary:self.chatCreationDictionary])));
diff -r 18b74afae09c -r 6c94121fc1c1 Frameworks/Adium Framework/Source/AIListObject.m
--- a/Frameworks/Adium Framework/Source/AIListObject.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIListObject.m	Fri Apr 24 14:42:40 2009 -0700
@@ -37,6 +37,7 @@
 
 @interface AIListObject ()
 - (void)setContainingGroup:(AIListGroup *)inGroup;
+- (void)setupObservedValues;
 @end
 
 /*!
@@ -60,17 +61,9 @@
 
 		largestOrder = 1.0;
 		smallestOrder = 1.0;
-
-		[adium.preferenceController addObserver:self
-									forKeyPath:@"Always Visible.Visible"
-									  ofObject:self
-									   options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
-									   context:NULL];
 		
-		[self observeValueForKeyPath:@"Always Visible.Visible"
-							ofObject:nil
-							  change:nil
-							 context:NULL];
+		// Delay until the next run loop so bookmarks can instantiate their values first.
+		[self performSelector:@selector(setupObservedValues) withObject:nil afterDelay:0.0];
 	}
 
 	return self;
@@ -88,6 +81,20 @@
 	[super dealloc];
 }
 
+- (void)setupObservedValues
+{
+	[adium.preferenceController addObserver:self
+	 forKeyPath:@"Always Visible.Visible"
+	 ofObject:self
+	 options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial
+	 context:NULL];
+	
+	[self observeValueForKeyPath:@"Always Visible.Visible"
+						ofObject:nil
+						  change:nil
+						 context:NULL];	
+}
+
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {
 	if ([keyPath hasSuffix:@"Visible"]) {
@@ -144,7 +151,6 @@
 	return [NSString stringWithFormat:@"%@.%@",inServiceID, inUID];
 }
 
-
 //Visibility -----------------------------------------------------------------------------------------------------------
 #pragma mark Visibility
 
diff -r 18b74afae09c -r 6c94121fc1c1 Frameworks/AutoHyperlinks Framework/Source/AHLinkLexer.l
--- a/Frameworks/AutoHyperlinks Framework/Source/AHLinkLexer.l	Fri Apr 24 09:41:40 2009 -0700
+++ b/Frameworks/AutoHyperlinks Framework/Source/AHLinkLexer.l	Fri Apr 24 14:42:40 2009 -0700
@@ -125,6 +125,7 @@
 svn(\+ssh)?:\/\/        |
 notes:\/\/              |
 gopher:\/\/             |
+git:\/\/				|
 x-man-page:\/\/         {yyextra = yyleng; BEGIN CANONICAL;}
 
 mailto:{mailSpec}       {return AH_MAILTO_VALID;}
diff -r 18b74afae09c -r 6c94121fc1c1 Plugins/Twitter Plugin/AITwitterAccount.m
--- a/Plugins/Twitter Plugin/AITwitterAccount.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Plugins/Twitter Plugin/AITwitterAccount.m	Fri Apr 24 14:42:40 2009 -0700
@@ -204,6 +204,8 @@
 														   onAccount:self 
 													chatCreationInfo:nil];
 		
+		[newTimelineChat setDisplayName:self.timelineChatName];
+		
 		timelineBookmark = [adium.contactController bookmarkForChat:newTimelineChat];
 
 		[adium.contactController moveContact:timelineBookmark intoGroups:[NSSet setWithObject:[adium.contactController groupWithUID:TWITTER_REMOTE_GROUP_NAME]]];
diff -r 18b74afae09c -r 6c94121fc1c1 Source/AIContactController.h
--- a/Source/AIContactController.h	Fri Apr 24 09:41:40 2009 -0700
+++ b/Source/AIContactController.h	Fri Apr 24 14:42:40 2009 -0700
@@ -37,8 +37,7 @@
 	NSMutableDictionary		*contactDict;
 	NSMutableDictionary		*metaContactDict;
 	NSMutableDictionary		*contactToMetaContactLookupDict;
-	
-	NSMutableArray			*bookmarksArray;
+	NSMutableDictionary		*bookmarkDict;
 	
 	//Contact List and Groups
 	AIContactList			*contactList;
diff -r 18b74afae09c -r 6c94121fc1c1 Source/AIContactController.m
--- a/Source/AIContactController.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Source/AIContactController.m	Fri Apr 24 14:42:40 2009 -0700
@@ -117,9 +117,9 @@
 		contactDict = [[NSMutableDictionary alloc] init];
 		groupDict = [[NSMutableDictionary alloc] init];
 		metaContactDict = [[NSMutableDictionary alloc] init];
+		bookmarkDict = [[NSMutableDictionary alloc] init];
 		contactToMetaContactLookupDict = [[NSMutableDictionary alloc] init];
 		contactLists = [[NSMutableArray alloc] init];
-		bookmarksArray = [[NSMutableArray alloc] init];
 
 		contactPropertiesObserverManager = [AIContactObserverManager sharedManager];
 	}
@@ -168,7 +168,7 @@
 	[metaContactDict release];
 	[contactToMetaContactLookupDict release];
 	[contactLists release];
-	[bookmarksArray release];
+	[bookmarkDict release];
 	
 	[contactPropertiesObserverManager release];
 
@@ -244,7 +244,12 @@
 		AIListBookmark	*bookmark = [NSKeyedUnarchiver unarchiveObjectWithData:data];
 
 		if(bookmark) {
-			[bookmarksArray addObject:bookmark];
+			if ([bookmarkDict objectForKey:bookmark.internalObjectID]) {
+				// In case we end up with two bookmarks with the same internalObjectID; this should be almost impossible.
+				[self removeBookmark:[bookmarkDict objectForKey:bookmark.internalObjectID]];
+			}
+			
+			[bookmarkDict setObject:bookmark forKey:bookmark.internalObjectID];
 			
 			//It's a newly created object, so set its initial attributes
 			[contactPropertiesObserverManager _updateAllAttributesOfObject:bookmark];
@@ -1012,7 +1017,7 @@
  */
 - (NSArray *)allBookmarks
 {
-	return [[bookmarksArray copy] autorelease];
+	return [[[bookmarkDict allValues] copy] autorelease];
 }
 
 /*!
@@ -1203,7 +1208,7 @@
 	AIListBookmark *existingBookmark = nil;
 	
 	for(AIListBookmark *listBookmark in self.allBookmarks) {
-		if([listBookmark.name isEqualToString:inName] &&
+		if([listBookmark.name isEqualToString:[inAccount.service normalizeChatName:inName]] &&
 			listBookmark.account == inAccount &&
 			((!listBookmark.chatCreationDictionary && !inCreationInfo) ||
 			 ([listBookmark.chatCreationDictionary isEqualToDictionary:inCreationInfo]))) {
@@ -1226,7 +1231,12 @@
 	if (!bookmark) {
 		bookmark = [[[AIListBookmark alloc] initWithChat:inChat] autorelease];
 		
-		[bookmarksArray addObject:bookmark];
+		if ([bookmarkDict objectForKey:bookmark.internalObjectID]) {
+			// In case we end up with two bookmarks with the same internalObjectID; this should be almost impossible.
+			[self removeBookmark:[bookmarkDict objectForKey:bookmark.internalObjectID]];
+		}
+		
+		[bookmarkDict setObject:bookmark forKey:bookmark.internalObjectID];
 		
 		[self saveContactList];
 	}
@@ -1243,7 +1253,7 @@
 - (void)removeBookmark:(AIListBookmark *)listBookmark
 {
 	[self moveContact:listBookmark intoGroups:[NSSet set]];
-	[bookmarksArray removeObject:listBookmark];
+	[bookmarkDict removeObjectForKey:listBookmark.internalObjectID];
 	
 	[self saveContactList];
 }
diff -r 18b74afae09c -r 6c94121fc1c1 Source/AIListWindowController.m
--- a/Source/AIListWindowController.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Source/AIListWindowController.m	Fri Apr 24 14:42:40 2009 -0700
@@ -1666,54 +1666,34 @@
 		return;
 	
 	if (!filterBarExpandedGroups && ![[sender stringValue] isEqualToString:@""]) {
-		// Temporarily expand all groups when performing a search.
-		NSMutableArray *groupsToExpand = [NSMutableArray array];
-		NSUInteger rows = [contactListView numberOfRows];
-		for (int i = 0; i < rows; i++) {
-			AIProxyListObject *proxyObject = [contactListView itemAtRow:i];
-			if ([proxyObject isKindOfClass:[AIListGroup class]] && ((AIListGroup *)proxyObject).expanded == NO)
-				[groupsToExpand addObject:proxyObject];
-		}
-		
-		if (groupsToExpand.count) {
-			for (AIProxyListObject *proxyObject in groupsToExpand) {
-				// Force the listgroup to save its expanded status
-				AIListGroup *proxiedObject = (AIListGroup *)proxyObject;
-				
-				[proxiedObject setPreference:[NSNumber numberWithBool:proxiedObject.expanded]
-									  forKey:@"IsExpanded"
-									   group:@"Contact List"];
-				
-				// Set the group as expanded
-				[contactListView expandItem:proxyObject];
-			}			
-		}
-		
-		filterBarExpandedGroups = YES;
-		
-	} else if (filterBarExpandedGroups && [[sender stringValue] isEqualToString:@""]) {
-		// Restore saved expansion status when returning to no search.
-		
-		// Temporarily expand all groups when performing a search.
-		NSMutableArray *groupsToCollapse = [NSMutableArray array];
-		NSUInteger rows = [contactListView numberOfRows];
-		for (int i = 0; i < rows; i++) {
-			AIProxyListObject *proxyObject = [contactListView itemAtRow:i];
-			
-			if ([proxyObject isKindOfClass:[AIListGroup class]] &&
-				![[(AIListGroup *)proxyObject preferenceForKey:@"IsExpanded" group:@"Contact List"] boolValue]) {
-				[groupsToCollapse addObject:proxyObject];
-			}
-		}
-		
-		if (groupsToCollapse.count) {
-			for (AIProxyListObject *proxyObject in groupsToCollapse) {
-				[contactListView collapseItem:proxyObject];
-			}			
-		}
-		
-		filterBarExpandedGroups = NO;
-	}
+        BOOL modified = NO;
+        for (AIListObject *listObject in [self.contactList containedObjects]) {
+            if ([listObject isKindOfClass:[AIListGroup class]] && [(AIListGroup *)listObject isExpanded] == NO) {
+                [listObject setValue:[NSNumber numberWithBool:YES] forProperty:@"ExpandedByFiltering" notify:NotifyNever];
+                modified = YES;
+            }
+        }
+        
+        filterBarExpandedGroups = YES;
+        
+        if (modified) {
+            [contactListView reloadData];
+        }
+    } else if (filterBarExpandedGroups && [[sender stringValue] isEqualToString:@""]) {
+        BOOL modified = NO;
+        for (AIListObject *listObject in [self.contactList containedObjects]) {
+            if ([listObject isKindOfClass:[AIListGroup class]] && [listObject boolValueForProperty:@"ExpandedByFiltering"]) {
+                [listObject setValue:[NSNumber numberWithBool:NO] forProperty:@"ExpandedByFiltering" notify:NotifyNever];
+                modified = YES;
+            }
+        }
+        
+        filterBarExpandedGroups = NO;
+        
+        if (modified) {
+            [contactListView reloadData];
+        }
+    }
 	
 	if ([[AIContactHidingController sharedController] filterContacts:[sender stringValue]]) {
 		// Select the first contact; we're guaranteed at least one visible contact.
diff -r 18b74afae09c -r 6c94121fc1c1 Source/NEHGrowlPlugin.m
--- a/Source/NEHGrowlPlugin.m	Fri Apr 24 09:41:40 2009 -0700
+++ b/Source/NEHGrowlPlugin.m	Fri Apr 24 14:42:40 2009 -0700
@@ -81,14 +81,6 @@
 }
 
 /*!
- * @brief Deallocate
- */
-- (void)dealloc
-{
-	[super dealloc];
-}
-
-/*!
  * @brief Adium finished launching
  *
  * Delays one more run loop so any events which are registered on this notification are guaranteed to be complete




More information about the commits mailing list