adium 3380:0157dd58ad43: Cut down on the NSDictionary use of ESO...

commits at adium.im commits at adium.im
Tue Oct 19 21:08:07 UTC 2010


details:	http://hg.adium.im/adium/rev/0157dd58ad43
revision:	3380:0157dd58ad43
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Tue Oct 19 23:06:03 2010 +0200

Cut down on the NSDictionary use of ESObjectWithProperties by using ivars when possible. This also makes code clearer and objects easier to debug.

Fixes #14055

diffs (truncated from 3745 to 1000 lines):

diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIAbstractAccount.m
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Tue Oct 19 23:06:03 2010 +0200
@@ -125,7 +125,7 @@
 		[adium.preferenceController registerPreferenceObserver:self forGroup:GROUP_ACCOUNT_STATUS];
 
 		//Update our display name and formattedUID immediately
-		[self updateStatusForKey:@"FormattedUID"];
+		[self updateStatusForKey:@"formattedUID"];
 		
 		//Init the account
 		[self initFUSDisconnecting];
@@ -321,7 +321,7 @@
 	//Set our formatted UID if necessary
 	if (![newProposedFormattedUID isEqualToString:self.formattedUID]) {
 		[self setPreference:newProposedFormattedUID
-					 forKey:@"FormattedUID"
+					 forKey:@"formattedUID"
 					  group:GROUP_ACCOUNT_STATUS];
 	}
 	
@@ -444,7 +444,7 @@
 
 	//Note the actual value we've set in CurrentDisplayName so we can compare against it later
 	[self setValue:displayName
-				   forProperty:@"CurrentDisplayName"
+				   forProperty:@"currentDisplayName"
 				   notify:NotifyNever];
 	
 	//Notify
@@ -459,13 +459,13 @@
  */
 - (NSString *)currentDisplayName
 {
-	return [self valueForProperty:@"CurrentDisplayName"];
+	return [self valueForProperty:@"currentDisplayName"];
 }
 
 - (void)retrievePasswordThenConnect
 {
 	AIPromptOption promptOption = AIPromptAsNeeded;
-	if ([self boolValueForProperty:@"Prompt For Password On Next Connect"]) 
+	if ([self boolValueForProperty:@"mustPromptForPasswordOnNextConnect"]) 
 		promptOption = AIPromptAlways;
 	else if (!self.service.requiresPassword)
 		promptOption = AIPromptNever;
@@ -488,14 +488,14 @@
  */
 - (void)updateCommonStatusForKey:(NSString *)key
 {
-    BOOL    areOnline = [self boolValueForProperty:@"Online"];
+    BOOL    areOnline = [self boolValueForProperty:@"isOnline"];
     
     //Online status changed
     //Call connect or disconnect as appropriate
-		if ([key isEqualToString:@"Online"]) {
+		if ([key isEqualToString:@"isOnline"]) {
 			if (self.shouldBeOnline && self.enabled) {
-				if (!areOnline && ![self boolValueForProperty:@"Connecting"]) {
-					if (self.service.supportsPassword && (!password || [self boolValueForProperty:@"Prompt For Password On Next Connect"])) {
+				if (!areOnline && ![self boolValueForProperty:@"isConnecting"]) {
+					if (self.service.supportsPassword && (!password || [self boolValueForProperty:@"mustPromptForPasswordOnNextConnect"])) {
 						[self retrievePasswordThenConnect];
 
 					} else {
@@ -506,17 +506,17 @@
 					}
 
 				}
-			} else if ((areOnline || ([self boolValueForProperty:@"Connecting"])) && ![self boolValueForProperty:@"Disconnecting"]) {
+			} else if ((areOnline || ([self boolValueForProperty:@"isConnecting"])) && ![self boolValueForProperty:@"isDisconnecting"]) {
 				//Disconnect
 				[self disconnect];
 			}
 
-		} else if ([key isEqualToString:@"StatusState"]) {
+		} else if ([key isEqualToString:@"accountStatus"]) {
 		if (areOnline) {
 			//Set the status state after filtering its statusMessage as appropriate
-			[self autoRefreshingOutgoingContentForStatusKey:@"StatusState"
+			[self autoRefreshingOutgoingContentForStatusKey:@"accountStatus"
 												   selector:@selector(gotFilteredStatusMessage:forStatusState:)
-													context:[self valueForProperty:@"StatusState"]];
+													context:[self valueForProperty:@"accountStatus"]];
 		} else {
 			//Check if account is 'enabled' in the accounts preferences.  If so, bring it online in the specified state.
 			[self setShouldBeOnline:YES];
@@ -527,10 +527,10 @@
 			[self autoRefreshingOutgoingContentForStatusKey:key selector:@selector(gotFilteredDisplayName:) context:nil];
 		}
 
-	} else if ([key isEqualToString:@"FormattedUID"]) {
+	} else if ([key isEqualToString:@"formattedUID"]) {
 		//Transfer formatted UID to status dictionary
-		[self setValue:[self preferenceForKey:@"FormattedUID" group:GROUP_ACCOUNT_STATUS]
-					   forProperty:@"FormattedUID"
+		[self setValue:[self preferenceForKey:@"formattedUID" group:GROUP_ACCOUNT_STATUS]
+					   forProperty:@"formattedUID"
 					   notify:NotifyNow];
 		
 	} else if ([key isEqualToString:@"Enabled"]) {
@@ -589,24 +589,24 @@
 		
 	} else {
 		//Store the status state as a property so it can be easily used elsewhere
-		[self setValue:statusState forProperty:@"StatusState" notify:NotifyLater];
+		[self setValue:statusState forProperty:@"accountStatus" notify:NotifyLater];
 		
 		//Update us to the new state
-		[self updateStatusForKey:@"StatusState"];
+		[self updateStatusForKey:@"accountStatus"];
 		
 		/* Set our IdleSince time if appropriate... this will just be set when the state is selected; the account
 		 * is thereafter responsible for updating any serverside settings as needed.  All of our current services will handle
 		 * updating idle time as it changes automatically. This is a per-account preference setting; it will override
 		 * any global idle setting for this account but won't change it. */	
-		if ([self.supportedPropertyKeys containsObject:@"IdleSince"]) {
+		if ([self.supportedPropertyKeys containsObject:@"idleSince"]) {
 			NSDate	*idleSince;
 			
 			idleSince = ([statusState shouldForceInitialIdleTime] ?
 						 [NSDate dateWithTimeIntervalSinceNow:-([statusState forcedInitialIdleTime]+1)] :
 						 nil);
 
-			if ([self preferenceForKey:@"IdleSince" group:GROUP_ACCOUNT_STATUS] != idleSince) {
-				[self setPreference:idleSince forKey:@"IdleSince" group:GROUP_ACCOUNT_STATUS];
+			if ([self preferenceForKey:@"idleSince" group:GROUP_ACCOUNT_STATUS] != idleSince) {
+				[self setPreference:idleSince forKey:@"idleSince" group:GROUP_ACCOUNT_STATUS];
 			}
 		}
 		
@@ -624,30 +624,30 @@
 - (void)setStatusStateAndRemainOffline:(AIStatus *)statusState
 {
 	//Store the status state as a property so it can be easily used elsewhere
-	[self setValue:statusState forProperty:@"StatusState" notify:NotifyNever];
+	[self setValue:statusState forProperty:@"accountStatus" notify:NotifyNever];
 
-	if ([self.supportedPropertyKeys containsObject:@"IdleSince"]) {
+	if ([self.supportedPropertyKeys containsObject:@"idleSince"]) {
 		NSDate	*idleSince;
 		
 		idleSince = (statusState.shouldForceInitialIdleTime ?
 					 [NSDate dateWithTimeIntervalSinceNow:-statusState.forcedInitialIdleTime] :
 					 nil);
 		
-		if ([self preferenceForKey:@"IdleSince" group:GROUP_ACCOUNT_STATUS] != idleSince) {
-			[self setPreference:idleSince forKey:@"IdleSince" group:GROUP_ACCOUNT_STATUS];
+		if ([self preferenceForKey:@"idleSince" group:GROUP_ACCOUNT_STATUS] != idleSince) {
+			[self setPreference:idleSince forKey:@"idleSince" group:GROUP_ACCOUNT_STATUS];
 		}		
 	}
 }
 
 /*!
- * @brief Callback from the threaded filter performed in [self updateStatusForKey:@"StatusState"]
+ * @brief Callback from the threaded filter performed in [self updateStatusForKey:@"accountStatus"]
  */
-- (void)gotFilteredStatusMessage:(NSAttributedString *)statusMessage forStatusState:(AIStatus *)statusState
+- (void)gotFilteredStatusMessage:(NSAttributedString *)inStatusMessage forStatusState:(AIStatus *)statusState
 {
-	[statusState setFilteredStatusMessage:[statusMessage string]];
+	[statusState setFilteredStatusMessage:[inStatusMessage string]];
 	
 	[self setStatusState:statusState
-	  usingStatusMessage:statusMessage];
+	  usingStatusMessage:inStatusMessage];
 }
 
 - (AIStatusSummary)statusSummary
@@ -658,13 +658,13 @@
 		return AIOfflineStatus;
 	} else {
 		if (statusType == AIAwayStatusType) {
-			if ([self valueForProperty:@"IdleSince"]) {
+			if ([self valueForProperty:@"idleSince"]) {
 				return AIAwayAndIdleStatus;
 			} else {
 				return AIAwayStatus;
 			}
 
-		} else if ([self valueForProperty:@"IdleSince"]) {
+		} else if ([self valueForProperty:@"idleSince"]) {
 			return AIIdleStatus;
 
 		} else {
@@ -676,8 +676,8 @@
 
 - (AIStatus *)statusState
 {
-	if ([self boolValueForProperty:@"Online"]) {
-		AIStatus	*statusState = [self valueForProperty:@"StatusState"];
+	if ([self boolValueForProperty:@"isOnline"]) {
+		AIStatus	*statusState = [self valueForProperty:@"accountStatus"];
 		if (!statusState) {
 			statusState = [adium.statusController defaultInitialStatusState];
 			[self setStatusStateAndRemainOffline:statusState];		
@@ -685,7 +685,7 @@
 		
 		return statusState;
 	} else {
-		AIStatus	*statusState = [self valueForProperty:@"StatusState"];
+		AIStatus	*statusState = [self valueForProperty:@"accountStatus"];
 		if (statusState && statusState.statusType == AIOfflineStatusType) {
 			//We're in an actual offline status; return it
 			return statusState;
@@ -701,7 +701,7 @@
  */
 - (AIStatus *)actualStatusState
 {
-	return [self valueForProperty:@"StatusState"];
+	return [self valueForProperty:@"accountStatus"];
 }
 
 - (NSString *)statusName
@@ -764,10 +764,10 @@
     if ((returnCode == AIPasswordPromptOKReturn) &&
 		((inPassword && [inPassword length]) || ![self.service requiresPassword])) {
 		[self setValue:nil
-					   forProperty:@"Prompt For Password On Next Connect"
+					   forProperty:@"mustPromptForPasswordOnNextConnect"
 					   notify:NotifyNever];
 
-		if (![self boolValueForProperty:@"Online"] && ![self valueForProperty:@"Connecting"]) {
+		if (![self boolValueForProperty:@"isOnline"] && ![self boolValueForProperty:@"isConnecting"]) {
 			[self setPasswordTemporarily:inPassword];
 
 			//Time to connect!
@@ -784,7 +784,7 @@
 	AILogWithSignature(@"%@", self);
 
 	[self setValue:[NSNumber numberWithBool:YES]
-				   forProperty:@"Prompt For Password On Next Connect"
+				   forProperty:@"mustPromptForPasswordOnNextConnect"
 				   notify:NotifyNever];
 	[self setPasswordTemporarily:nil];
 }
@@ -870,7 +870,7 @@
 {
 	NSAttributedString	*originalValue;
 	
-	if ([key isEqualToString:@"StatusState"]) {
+	if ([key isEqualToString:@"accountStatus"]) {
 		AIStatus *statusState = [self actualStatusState];
 		/* -[AIAccount actualStatusState] won't set usinto an initial state if we don't have one yet,
 		 * unlike -AIAccount.statusState. Although I expect that the default state will never have an associated
@@ -973,13 +973,13 @@
  */
 - (void)setValue:(id)value forProperty:(NSString *)key notify:(NotifyTiming)notify
 {
-	if ([key isEqualToString:@"Online"]) {
+	if ([key isEqualToString:@"isOnline"]) {
 		if ([value boolValue]) {
 			if ([autoRefreshingKeys count])	[self _startAttributedRefreshTimer];
 		} else {
 			[self _stopAttributedRefreshTimer];
 		}
-	} else if ([key isEqualToString:@"Disconnecting"]) {
+	} else if ([key isEqualToString:@"isDisconnecting"]) {
 		if ([value boolValue]) {
 			[self _stopAttributedRefreshTimer];	
 		}
@@ -1106,7 +1106,7 @@
  */
 - (BOOL)shouldBeOnline
 {
-	return [[self preferenceForKey:@"Online" group:GROUP_ACCOUNT_STATUS] boolValue];
+	return [[self preferenceForKey:@"isOnline" group:GROUP_ACCOUNT_STATUS] boolValue];
 }
 
 /*!
@@ -1121,7 +1121,7 @@
 - (void)setShouldBeOnline:(BOOL)shouldBeOnline
 {
 	[self setPreference:[NSNumber numberWithBool:shouldBeOnline]
-				 forKey:@"Online"
+				 forKey:@"isOnline"
 				  group:GROUP_ACCOUNT_STATUS];
 	
 	/* If the users says we should no longer be online, clear out any stored password.
@@ -1139,8 +1139,8 @@
 - (void)toggleOnline
 {
 	BOOL    online = self.online;
-	BOOL	connecting = [self boolValueForProperty:@"Connecting"];
-	BOOL	reconnecting = ([self valueForProperty:@"Waiting to Reconnect"] != nil);
+	BOOL	connecting = [self boolValueForProperty:@"isConnecting"];
+	BOOL	reconnecting = ([self valueForProperty:@"waitingToReconnect"] != nil);
 	
 	//If online or connecting set the account offline, otherwise set it to online
 	[self setShouldBeOnline:!(online || connecting || reconnecting)]; 	
@@ -1198,11 +1198,11 @@
 	}
     
 	//We are now online
-    [self setValue:nil forProperty:@"Connecting" notify:NotifyLater];
-    [self setValue:[NSNumber numberWithBool:YES] forProperty:@"Online" notify:NotifyLater];
-	[self setValue:nil forProperty:@"ConnectionProgressString" notify:NotifyLater];
-	[self setValue:nil forProperty:@"ConnectionProgressPercent" notify:NotifyLater];	
-    [self setValue:nil forProperty:@"Waiting to Reconnect" notify:NotifyLater];
+    [self setValue:nil forProperty:@"isConnecting" notify:NotifyLater];
+    [self setValue:[NSNumber numberWithBool:YES] forProperty:@"isOnline" notify:NotifyLater];
+	[self setValue:nil forProperty:@"connectionProgressString" notify:NotifyLater];
+	[self setValue:nil forProperty:@"connectionProgressPercent" notify:NotifyLater];	
+    [self setValue:nil forProperty:@"waitingToReconnect" notify:NotifyLater];
 	AILogWithSignature(@"*** status dictionary is now %@", propertiesDictionary);
 	
 	//Apply any changes
@@ -1225,16 +1225,16 @@
 
 	} else {
 		if ([self updateStatusImmediatelyAfterConnecting]) {
-			[self updateStatusForKey:@"StatusState"];
+			[self updateStatusForKey:@"accountStatus"];
 		}
 	}
 
-	[self updateStatusForKey:@"IdleSince"];
+	[self updateStatusForKey:@"idleSince"];
 }
 
 - (void)cancelAutoReconnect
 {
-    [self setValue:nil forProperty:@"Waiting to Reconnect" notify:NotifyNow];
+    [self setValue:nil forProperty:@"waitingToReconnect" notify:NotifyNow];
 
 	reconnectAttemptsPerformed = 0;
 
@@ -1250,7 +1250,7 @@
  */
 - (void)autoReconnectAfterDelay:(NSTimeInterval)delay
 {
-    [self setValue:[NSDate dateWithTimeIntervalSinceNow:delay] forProperty:@"Waiting to Reconnect" notify:NotifyNow];
+    [self setValue:[NSDate dateWithTimeIntervalSinceNow:delay] forProperty:@"waitingToReconnect" notify:NotifyNow];
 	[self performSelector:@selector(performAutoreconnect)
 			   withObject:nil
 			   afterDelay:delay];
@@ -1259,8 +1259,8 @@
 {
 	//If we still want to be online, and we're not yet online, continue with the reconnect
     if ([self shouldBeOnline] &&
-	   !self.online && ![self boolValueForProperty:@"Connecting"]) {
-		[self updateStatusForKey:@"Online"];
+	   !self.online && ![self boolValueForProperty:@"isConnecting"]) {
+		[self updateStatusForKey:@"isOnline"];
     }
 }
 
@@ -1316,8 +1316,8 @@
 	static NSSet *_contactProperties = nil;
 	
 	if (!_contactProperties)
-		_contactProperties = [[NSSet alloc] initWithObjects:@"Online",@"Warning",@"IdleSince",
-							  @"Idle",@"IsIdle",@"Signon Date",@"StatusName",@"StatusType",@"StatusMessage",@"Client",KEY_TYPING,nil];
+		_contactProperties = [[NSSet alloc] initWithObjects:@"isOnline",@"Warning",@"idleSince",
+							  @"idle",@"isIdle",@"Signon Date",@"listObjectStatusName",@"listObjectStatusType",@"listObjectStatusMessage",@"Client",KEY_TYPING,nil];
 	
 	return _contactProperties;
 }
@@ -1328,22 +1328,22 @@
 - (void)didDisconnect
 {
 	//If we were online, display a status message in all of our open chats noting our disconnection
-	if ([self boolValueForProperty:@"Online"]) {
+	if ([self boolValueForProperty:@"isOnline"]) {
 		for (AIChat *chat in adium.interfaceController.openChats) {
 			if (chat.account != self || !chat.isOpen)
 				continue;
 			
 			//Display a connected message in all open chats
-			AIContentEvent *statusMessage = [AIContentEvent eventInChat:chat
+			AIContentEvent *newStatusMessage = [AIContentEvent eventInChat:chat
 															 withSource:chat.account
 															destination:chat.account
 																   date:[NSDate date]
 																message:[[[NSAttributedString alloc] initWithString:AILocalizedStringFromTableInBundle(@"You have disconnected", nil, [NSBundle bundleForClass:[AIAccount class]], "Displayed in an open chat when its account has been connected")] autorelease]
 															   withType:@"disconnected"];
 			
-			[statusMessage setCoalescingKey:ACCOUNT_STATUS_UPDATE_COALESCING_KEY];
+			[newStatusMessage setCoalescingKey:ACCOUNT_STATUS_UPDATE_COALESCING_KEY];
 
-			[adium.contentController receiveContentObject:statusMessage];
+			[adium.contentController receiveContentObject:newStatusMessage];
 			
 			if (chat.isGroupChat)
 				[chat removeAllParticipatingContactsSilently];
@@ -1351,9 +1351,9 @@
 	}
 	
 	//We are now offline
-	[self setValue:nil forProperty:@"Disconnecting" notify:NotifyLater];
-	[self setValue:nil forProperty:@"Connecting" notify:NotifyLater];
-	[self setValue:nil forProperty:@"Online" notify:NotifyLater];
+	[self setValue:nil forProperty:@"isDisconnecting" notify:NotifyLater];
+	[self setValue:nil forProperty:@"isConnecting" notify:NotifyLater];
+	[self setValue:nil forProperty:@"isOnline" notify:NotifyLater];
 	
 	//Stop all autorefreshing keys
 	[self stopAutoRefreshingStatusKey:nil];
@@ -1365,7 +1365,7 @@
 	[self removeAllContacts];
 	
 	//If we were disconnected unexpectedly, attempt a reconnect. Give subclasses a chance to handle the disconnection error.
-	if (reconnectAttemptsPerformed > 1 && [self boolValueForProperty:@"Waiting for Network"]) {
+	if (reconnectAttemptsPerformed > 1 && [self boolValueForProperty:@"isWaitingForNetwork"]) {
 		// If we know this connection is waiting for the network to return, don't bother continuing to reconnect.
 		// Let it try for 2 times and then cancel and wait for the network to return.
 		[self cancelAutoReconnect];
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIAccount.h
--- a/Frameworks/Adium Framework/Source/AIAccount.h	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIAccount.h	Tue Oct 19 23:06:03 2010 +0200
@@ -237,6 +237,23 @@
 	NSTimer								*delayedUpdateStatusTimer;
 	NSMutableArray			*delayedUpdateStatusTargets;
 	NSTimer								*silenceAllContactUpdatesTimer;
+	
+	// Former properties	
+	NSString				*formattedUID;
+	
+	AIStatus				*accountStatus;
+	BOOL					isConnecting;
+	NSDate					*waitingToReconnect;
+	BOOL					isDisconnecting;
+	
+	BOOL					isWaitingForNetwork;
+	
+	NSInteger				connectionProgressPercent;
+	NSString				*connectionProgressString;
+	
+	BOOL					mustPromptForPasswordOnNextConnect;
+	
+	NSString				*currentDisplayName;
 }
 
 - (void)initAccount;
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIAccount.m
--- a/Frameworks/Adium Framework/Source/AIAccount.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIAccount.m	Tue Oct 19 23:06:03 2010 +0200
@@ -120,6 +120,17 @@
 {
 }
 
+- (void)dealloc
+{
+	[formattedUID release]; formattedUID = nil;
+	[accountStatus release]; accountStatus = nil;
+	[waitingToReconnect release]; waitingToReconnect = nil;
+	[connectionProgressString release]; connectionProgressString = nil;
+	[currentDisplayName release]; currentDisplayName = nil;
+	
+	[super dealloc];
+}
+
 /*!
  * @brief Connect
  *
@@ -128,7 +139,7 @@
 - (void)connect
 {
 	//We are connecting
-	[self setValue:[NSNumber numberWithBool:YES] forProperty:@"Connecting" notify:NotifyNow];
+	[self setValue:[NSNumber numberWithBool:YES] forProperty:@"isConnecting" notify:NotifyNow];
 }
 
 /*!
@@ -166,7 +177,7 @@
 - (void)disconnect
 {
 	[self cancelAutoReconnect];
-	[self setValue:nil forProperty:@"Connecting" notify:NotifyLater];
+	[self setValue:nil forProperty:@"isConnecting" notify:NotifyLater];
 
 	[self notifyOfChangedPropertiesSilently:NO];
 }
@@ -444,8 +455,8 @@
  *
  * Returns an array of properties supported by this account.  This account will not be informed of changes to keys
  * it does not support.  Available keys are:
- *   @"Display Name", @"Online", @"Offline", @"IdleSince", @"IdleManuallySet", @"User Icon"
- *   @"TextProfile", @"DefaultUserIconFilename", @"StatusState"
+ *   @"Display Name", @"isOnline", @"Offline", @"idleSince", @"IdleManuallySet", @"User Icon"
+ *   @"textProfile", @"DefaultUserIconFilename", @"accountStatus"
  * @return NSSet of supported keys
  */
 - (NSSet *)supportedPropertyKeys
@@ -453,11 +464,11 @@
 	static	NSSet	*supportedPropertyKeys = nil;
 	if (!supportedPropertyKeys) {
 		supportedPropertyKeys = [[NSSet alloc] initWithObjects:
-			@"Online",
-			@"FormattedUID",
+			@"isOnline",
+			@"formattedUID",
 			KEY_ACCOUNT_DISPLAY_NAME,
 			@"Display Name",
-			@"StatusState",
+			@"accountStatus",
 			KEY_USE_USER_ICON, KEY_USER_ICON, KEY_DEFAULT_USER_ICON,
 			@"Enabled",
 			nil];
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIAccountMenu.m
--- a/Frameworks/Adium Framework/Source/AIAccountMenu.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIAccountMenu.m	Tue Oct 19 23:06:03 2010 +0200
@@ -402,9 +402,9 @@
 	
 	if (account.enabled) {
 		if (showTitleVerbs) {
-			if ([account boolValueForProperty:@"Connecting"] || [account valueForProperty:@"Waiting to Reconnect"]) {
+			if ([account boolValueForProperty:@"isConnecting"] || [account valueForProperty:@"waitingToReconnect"]) {
 				titleFormat = ACCOUNT_CONNECTING_ACTION_MENU_TITLE;
-			} else if ([account boolValueForProperty:@"Disconnecting"]) {
+			} else if ([account boolValueForProperty:@"isDisconnecting"]) {
 				titleFormat = ACCOUNT_DISCONNECTING_ACTION_MENU_TITLE;
 			} else {
 				//Display 'connect' or 'disconnect' before the account name
@@ -412,7 +412,7 @@
 			}
 			
 		} else {
-			if ([account boolValueForProperty:@"Connecting"]) {
+			if ([account boolValueForProperty:@"isConnecting"]) {
 				titleFormat = ACCOUNT_CONNECT_PARENS_MENU_TITLE;
 			}
 		}
@@ -439,12 +439,12 @@
 			[self rebuildMenu];
 			rebuilt = YES;
 
-		} else if ([inModifiedKeys containsObject:@"Online"] ||
-				   [inModifiedKeys containsObject:@"Connecting"] ||
-				   [inModifiedKeys containsObject:@"Waiting to Reconnect"] ||
-				   [inModifiedKeys containsObject:@"Disconnecting"] ||
-				   [inModifiedKeys containsObject:@"IdleSince"] ||
-				   [inModifiedKeys containsObject:@"StatusState"]) {
+		} else if ([inModifiedKeys containsObject:@"isOnline"] ||
+				   [inModifiedKeys containsObject:@"isConnecting"] ||
+				   [inModifiedKeys containsObject:@"waitingToReconnect"] ||
+				   [inModifiedKeys containsObject:@"isDisconnecting"] ||
+				   [inModifiedKeys containsObject:@"idleSince"] ||
+				   [inModifiedKeys containsObject:@"accountStatus"]) {
 			//Update menu items to reflect status changes
 
 			//Update the changed menu item (or rebuild the entire menu if this item should be removed or added)
@@ -463,7 +463,7 @@
 			}
 		}
 
-		if ((submenuType == AIAccountOptionsSubmenu) && [inModifiedKeys containsObject:@"Online"]) {
+		if ((submenuType == AIAccountOptionsSubmenu) && [inModifiedKeys containsObject:@"isOnline"]) {
 			if (rebuilt) menuItem = [self menuItemForAccount:(AIAccount *)inObject];
 
 			//Append the account actions menu
@@ -472,7 +472,7 @@
 			}
 		}
 		
-		if ((submenuType == AIAccountStatusSubmenu) && [inObject.service isSocialNetworkingService] && [inModifiedKeys containsObject:@"Online"]) {
+		if ((submenuType == AIAccountStatusSubmenu) && [inObject.service isSocialNetworkingService] && [inModifiedKeys containsObject:@"isOnline"]) {
 			menuItem = [self menuItemForAccount:(AIAccount *)inObject];
 			
 			if (menuItem) {
@@ -504,7 +504,7 @@
 		[adium.accountController addAccount:inAccount];
         
 		//Put new accounts online by default
-		[inAccount setPreference:[NSNumber numberWithBool:YES] forKey:@"Online" group:GROUP_ACCOUNT_STATUS];
+		[inAccount setPreference:[NSNumber numberWithBool:YES] forKey:@"isOnline" group:GROUP_ACCOUNT_STATUS];
 	}
 }
 
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIChat.h
--- a/Frameworks/Adium Framework/Source/AIChat.h	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.h	Tue Oct 19 23:06:03 2010 +0200
@@ -19,6 +19,8 @@
 #import <Adium/AIListObject.h>
 #import <Adium/AIInterfaceControllerProtocol.h>
 
+#import "AIMessageTabViewItem.h"
+
 @class AIAccount, AIListObject, AIListContact, AIContentObject, AIEmoticon;
 
 #define Chat_OrderDidChange						@"Chat_OrderDidChange"
@@ -31,9 +33,9 @@
 #define Chat_SourceChanged 						@"Chat_SourceChanged"
 #define Chat_DestinationChanged 				@"Chat_DestinationChanged"
 
-#define KEY_UNVIEWED_CONTENT	@"UnviewedContent"
-#define KEY_UNVIEWED_MENTION	@"UnviewedMention"
-#define KEY_TYPING				@"Typing"
+#define KEY_UNVIEWED_CONTENT	@"unviewedContent"
+#define KEY_UNVIEWED_MENTION	@"unviewedMention"
+#define KEY_TYPING				@"typing"
 
 #define	KEY_CHAT_TIMED_OUT		@"Timed Out"
 #define KEY_CHAT_CLOSED_WINDOW	@"Closed Window"
@@ -125,6 +127,27 @@
 	BOOL				enableTypingNotifications;
 	
 	NSMutableSet		*customEmoticons;
+	
+	// Former properties
+	NSImage				*tabStateIcon;
+	
+	NSDictionary		*chatCreationInfo;
+	
+	BOOL				accountJoined;
+	
+	NSInteger			unviewedMention;
+	NSInteger			unviewedContent;
+	
+	AIMessageTabViewItem *messageTabViewItem;
+	
+	NSTimer				*enteredTextTimer;
+	
+	NSInteger			ourTypingState;
+	AITypingState		typing;
+	
+	NSDictionary		*securityDetails;
+	
+	BOOL				secureMessagingLastEncryptedState;
 }
 
 + (id)chatForAccount:(AIAccount *)inAccount;
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIChat.m
--- a/Frameworks/Adium Framework/Source/AIChat.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIChat.m	Tue Oct 19 23:06:03 2010 +0200
@@ -75,6 +75,8 @@
 		hasSentOrReceivedContent = NO;
 		showJoinLeave = YES;
 		pendingOutgoingContentObjects = [[NSMutableArray alloc] init];
+		
+		topic = @"";
 
 		AILog(@"[AIChat: %x initForAccount]",self);
 	}
@@ -101,6 +103,12 @@
 	[customEmoticons release]; customEmoticons = nil;
 	[topic release]; [topicSetter release];
 	
+	[tabStateIcon release]; tabStateIcon = nil;
+    [chatCreationInfo release]; chatCreationInfo = nil;
+    [messageTabViewItem release]; messageTabViewItem = nil;
+    [enteredTextTimer release]; enteredTextTimer = nil;
+    [securityDetails release]; securityDetails = nil;
+	
 	[super dealloc];
 }
 
@@ -162,13 +170,13 @@
  */
 - (NSDictionary *)chatCreationDictionary
 {
-	return [self valueForProperty:@"ChatCreationInfo"];
+	return chatCreationInfo;
 }
 
 - (void)setChatCreationDictionary:(NSDictionary *)inDict
 {
 	[self setValue:inDict
-				   forProperty:@"ChatCreationInfo"
+				   forProperty:@"chatCreationInfo"
 				   notify:NotifyNever];
 }
 
@@ -217,15 +225,15 @@
 	
 }
 //Secure chatting ------------------------------------------------------------------------------------------------------
-- (void)setSecurityDetails:(NSDictionary *)securityDetails
+- (void)setSecurityDetails:(NSDictionary *)inSecurityDetails
 {
-	[self setValue:securityDetails
-				   forProperty:@"SecurityDetails"
+	[self setValue:inSecurityDetails
+				   forProperty:@"securityDetails"
 				   notify:NotifyNow];
 }
 - (NSDictionary *)securityDetails
 {
-	return [self valueForProperty:@"SecurityDetails"];
+	return securityDetails;
 }
 
 - (BOOL)isSecure
@@ -236,8 +244,7 @@
 - (AIEncryptionStatus)encryptionStatus
 {
 	AIEncryptionStatus	encryptionStatus = EncryptionStatus_None;
-
-	NSDictionary		*securityDetails = self.securityDetails;
+	
 	if (securityDetails) {
 		NSNumber *detailsStatus;
 		if ((detailsStatus = [securityDetails objectForKey:@"EncryptionStatus"])) {
@@ -581,7 +588,7 @@
 
 - (NSUInteger)unviewedMentionCount
 {
-	return [self integerValueForProperty:KEY_UNVIEWED_MENTION];	
+	return [self integerValueForProperty:KEY_UNVIEWED_MENTION];
 }
 
 - (void)incrementUnviewedContentCount
@@ -925,7 +932,7 @@
 
 - (id <AIChatContainer>)chatContainer
 {
-	return [self valueForProperty:@"MessageTabViewItem"];
+	return messageTabViewItem;
 }
 
 - (id)handleCloseScriptCommand:(NSCloseCommand *)closeCommand
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIContactHidingController.m
--- a/Frameworks/Adium Framework/Source/AIContactHidingController.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIContactHidingController.m	Tue Oct 19 23:06:03 2010 +0200
@@ -158,12 +158,12 @@
 	if (!hideOfflineIdleOrMobileContacts)
 		return YES;
 	
-	BOOL online = listObject.online || [listObject boolValueForProperty:@"Signed Off"] || [listObject boolValueForProperty:@"New Object"];
+	BOOL online = listObject.online || [listObject boolValueForProperty:@"signedOff"] || [listObject boolValueForProperty:@"New Object"];
 	
 	if (!showOfflineContacts && !online)
 		return NO;
 		
-	if (!showIdleContacts && [listObject boolValueForProperty:@"IsIdle"])
+	if (!showIdleContacts && [listObject boolValueForProperty:@"isIdle"])
 		return NO;
 	
 	if (!showMobileContacts && listObject.isMobile)
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIContactMenu.m
--- a/Frameworks/Adium Framework/Source/AIContactMenu.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIContactMenu.m	Tue Oct 19 23:06:03 2010 +0200
@@ -312,11 +312,11 @@
 	if ([inObject isKindOfClass:[AIListContact class]]) {
 
 		//Update menu items to reflect status changes
-		if ([inModifiedKeys containsObject:@"Online"] ||
-			[inModifiedKeys containsObject:@"Connecting"] ||
-			[inModifiedKeys containsObject:@"Disconnecting"] ||
-			[inModifiedKeys containsObject:@"IdleSince"] ||
-			[inModifiedKeys containsObject:@"StatusType"]) {
+		if ([inModifiedKeys containsObject:@"isOnline"] ||
+			[inModifiedKeys containsObject:@"isConnecting"] ||
+			[inModifiedKeys containsObject:@"isDisconnecting"] ||
+			[inModifiedKeys containsObject:@"idleSince"] ||
+			[inModifiedKeys containsObject:@"listObjectStatusType"]) {
 
 			//Note that this will return nil if we don't ahve a menu item for inObject
 			NSMenuItem	*menuItem = [self existingMenuItemForContact:(AIListContact *)inObject];
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIListBookmark.h
--- a/Frameworks/Adium Framework/Source/AIListBookmark.h	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.h	Tue Oct 19 23:06:03 2010 +0200
@@ -19,6 +19,8 @@
 
 	NSString			*password;
 	NSString			*name;
+	
+	NSString			*unreadStatus;
 }
 
 - (id)initWithChat:(AIChat *)inChat;
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIListBookmark.m
--- a/Frameworks/Adium Framework/Source/AIListBookmark.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIListBookmark.m	Tue Oct 19 23:06:03 2010 +0200
@@ -51,7 +51,7 @@
 		[adium.chatController registerChatObserver:self];
 		
 		[self.account addObserver:self
-					   forKeyPath:@"Online"
+					   forKeyPath:@"isOnline"
 						  options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionInitial)
 						  context:NULL];
 		
@@ -122,7 +122,7 @@
 	
 	[[NSNotificationCenter defaultCenter] removeObserver:self];
 	[adium.chatController unregisterChatObserver:self];
-	[self.account removeObserver:self forKeyPath:@"Online"];
+	[self.account removeObserver:self forKeyPath:@"isOnline"];
 
 	[super dealloc];
 }
@@ -345,7 +345,7 @@
 #pragma mark -
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {
-	if ([keyPath isEqualToString:@"Online"] && object == self.account) {
+	if ([keyPath isEqualToString:@"isOnline"] && object == self.account) {
 		// If an account is just initially signing on, a -setOnline:notify:silently will still broadcast an event for the contact.
 		// The initial delay an account (usually) sets is done after they're set as online, so these bookmarks would always fire.
 		// Thus, we have to use the secondary, silent notification so that the online gets propogated without the events.
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIListContact.h
--- a/Frameworks/Adium Framework/Source/AIListContact.h	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIListContact.h	Tue Oct 19 23:06:03 2010 +0200
@@ -18,7 +18,7 @@
 #import <Adium/AIAccount.h>
 #import <Adium/AIChat.h>
 
-#define KEY_AB_UNIQUE_ID		@"AB Unique ID"
+#define KEY_AB_UNIQUE_ID		@"ABUniqueID"
 
 @class ABPerson, AIListGroup, AIMetaContact;
 
@@ -27,6 +27,33 @@
 	AIMetaContact *metaContact;
 	NSMutableSet *m_remoteGroupNames;
 	NSString		*internalUniqueObjectID;
+	
+	// Former properties
+	NSColor			*textColor;
+	NSColor			*invertedTextColor;
+	NSColor			*labelColor;
+	
+	NSNumber		*imageOpacity;
+	BOOL			isEvent;
+	
+	NSString		*ABUniqueID;
+	
+	NSAttributedString	*textProfile;
+	
+	BOOL			isBlocked;
+	BOOL			isIdle;
+	NSInteger		idle;
+	NSDate			*idleSince;
+	NSString		*idleReadable;
+	
+	BOOL			notAStranger;
+	BOOL			isMobile;
+	
+	NSString		*serverDisplayName;
+	NSString		*formattedUID;
+	
+	BOOL			signedOff;
+	BOOL			signedOn;
 }
 
 - (id)initWithUID:(NSString *)inUID account:(AIAccount *)inAccount service:(AIService *)inService;
diff -r 9e337ae3cbf3 -r 0157dd58ad43 Frameworks/Adium Framework/Source/AIListContact.m
--- a/Frameworks/Adium Framework/Source/AIListContact.m	Tue Oct 19 22:39:01 2010 +0200
+++ b/Frameworks/Adium Framework/Source/AIListContact.m	Tue Oct 19 23:06:03 2010 +0200
@@ -80,6 +80,17 @@
 	[m_remoteGroupNames release]; m_remoteGroupNames = nil;
 	[internalUniqueObjectID release]; internalUniqueObjectID = nil;
 	
+	[textColor release]; textColor = nil;
+	[invertedTextColor release]; invertedTextColor = nil;
+	[labelColor release]; labelColor = nil;
+	[imageOpacity release]; imageOpacity = nil;
+	[ABUniqueID release]; ABUniqueID = nil;
+	[textProfile release]; textProfile = nil;
+	[idleSince release]; idleSince = nil;
+	[idleReadable release]; idleReadable = nil;
+	[serverDisplayName release]; serverDisplayName = nil;
+	[formattedUID release]; formattedUID = nil;
+	
 	[super dealloc];
 }
 
@@ -179,7 +190,7 @@
 	
 	if (self.isStranger != (remoteGroupCount == 0)) {
 		[self setValue:[NSNumber numberWithBool:remoteGroupCount > 0]
-		   forProperty:@"NotAStranger"
+		   forProperty:@"notAStranger"
 				notify:NotifyLater];
 		[self notifyOfChangedPropertiesSilently:YES];
 	}
@@ -248,7 +259,7 @@
  */
 - (NSString *)serversideDisplayName
 {
-	return [self valueForProperty:@"Server Display Name"];	
+	return [self valueForProperty:@"serverDisplayName"];	
 }
 
 - (void)setServersideAlias:(NSString *)alias 
@@ -258,10 +269,10 @@
 	BOOL displayNameChanges = NO;
 	
 	//This is the server display name.  Set it as such.
-	if (![alias isEqualToString:[self valueForProperty:@"Server Display Name"]]) {
+	if (![alias isEqualToString:[self valueForProperty:@"serverDisplayName"]]) {
 		//Set the server display name property as the full display name
 		[self setValue:alias
-					   forProperty:@"Server Display Name"
+					   forProperty:@"serverDisplayName"
 					   notify:NotifyLater];
 		
 		changes = YES;
@@ -340,18 +351,18 @@
 {
 	if (online != self.online) {
 		[self setValue:[NSNumber numberWithBool:online]
-					   forProperty:@"Online"
+					   forProperty:@"isOnline"
 					   notify:notify];
 		
 		if (!silent) {
 			[self setValue:[NSNumber numberWithBool:YES] 
-						   forProperty:(online ? @"Signed On" : @"Signed Off")
+						   forProperty:(online ? @"signedOn" : @"signedOff")
 						   notify:notify];
 			[self setValue:nil 
-						   forProperty:(online ? @"Signed Off" : @"Signed On")
+						   forProperty:(online ? @"signedOff" : @"signedOn")
 						   notify:notify];
 			[self setValue:nil
-						   forProperty:(online ? @"Signed On" : @"Signed Off")
+						   forProperty:(online ? @"signedOn" : @"signedOff")
 					   afterDelay:CONTACT_SIGN_ON_OR_OFF_PERSISTENCE_DELAY];
 		}
 		
@@ -392,34 +403,34 @@
  * @param idleSinceDate The date this contact went idle. Only relevant if isIdle is YES
  * @param notify The NotifyTiming
  */
-- (void)setIdle:(BOOL)isIdle sinceDate:(NSDate *)idleSinceDate notify:(NotifyTiming)notify
+- (void)setIdle:(BOOL)inIsIdle sinceDate:(NSDate *)idleSinceDate notify:(NotifyTiming)notify
 {
-	if (isIdle) {
+	if (inIsIdle) {
 		if (idleSinceDate) {
 			[self setValue:idleSinceDate
-						   forProperty:@"IdleSince"
+						   forProperty:@"idleSince"
 						   notify:NotifyLater];
 		} else {
 			//No idleSinceDate means we are Idle but don't know how long, so set to -1
 			[self setValue:[NSNumber numberWithInt:-1]
-						   forProperty:@"Idle"
+						   forProperty:@"idle"
 						   notify:NotifyLater];
 		}
 	} else {
 		[self setValue:nil
-					   forProperty:@"IdleSince"
+					   forProperty:@"idleSince"
 					   notify:NotifyLater];
 		[self setValue:nil
-					   forProperty:@"Idle"
+					   forProperty:@"idle"
 					   notify:NotifyLater];
 	}
 	
-	/* @"Idle", for a contact with an IdleSince date, will be changing every minute.  @"IsIdle" provides observers a way
+	/* @"idle", for a contact with an IdleSince date, will be changing every minute.  @"isIdle" provides observers a way
 	* to perform an action when the contact becomes/comes back from idle, regardless of whether an IdleSince is available,
 	* without having to do that action every minute for other contacts.
 	*/
-	[self setValue:[NSNumber numberWithBool:isIdle]
-				   forProperty:@"IsIdle"
+	[self setValue:[NSNumber numberWithBool:inIsIdle]
+				   forProperty:@"isIdle"
 				   notify:NotifyLater];
 	
 	//Apply any changes
@@ -482,7 +493,7 @@
 - (void)setProfile:(NSAttributedString *)profile notify:(NotifyTiming)notify
 {
 	[self setValue:profile
-				   forProperty:@"TextProfile" 
+				   forProperty:@"textProfile" 
 				   notify:notify];
 }
 
@@ -491,7 +502,7 @@
  */
 - (NSAttributedString *)profile
 {
-	return [self valueForProperty:@"TextProfile"];
+	return [self valueForProperty:@"textProfile"];
 }
 
 /*!
@@ -501,7 +512,7 @@
  */
 - (BOOL)isStranger
 {
-	return ![self boolValueForProperty:@"NotAStranger"];
+	return ![self boolValueForProperty:@"notAStranger"];
 }
 
 /*!
@@ -517,16 +528,16 @@
  */
 - (BOOL)isMobile
 {
-	return [self boolValueForProperty:@"IsMobile"];
+	return [self boolValueForProperty:@"isMobile"];
 }
 
 /*!
  * @brief Set if this contact is mobile
  */
-- (void)setIsMobile:(BOOL)isMobile notify:(NotifyTiming)notify
+- (void)setIsMobile:(BOOL)inIsMobile notify:(NotifyTiming)notify
 {
-	[self setValue:[NSNumber numberWithBool:isMobile]
-				   forProperty:@"IsMobile"




More information about the commits mailing list