adium-1.4 3089:9d4fb0b87d2b: Fixed use of the global default use...

commits at adium.im commits at adium.im
Mon Oct 18 03:52:23 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/9d4fb0b87d2b
revision:	3089:9d4fb0b87d2b
author:		Evan Schoenberg
date:		Sun Oct 17 22:52:13 2010 -0500

Fixed use of the global default user icon (which is provided by the Address Book 'me' card) and documented the code better. This was broken in [a31185c44a8e] (r1275) back in 3/2009.

diffs (28 lines):

diff -r 1bfe0f691c27 -r 9d4fb0b87d2b Frameworks/Adium Framework/Source/AIAbstractAccount.m
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Sat Oct 16 15:43:29 2010 -0500
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Sun Oct 17 22:52:13 2010 -0500
@@ -195,11 +195,23 @@
 {
 	NSData	*userIconData = nil;
 
-	// If we locally have an icon set, or we're not temporary and a global one is set, use that.
 	if ([[self preferenceForKey:KEY_USE_USER_ICON group:GROUP_ACCOUNT_STATUS] boolValue]) {
+		/* If this account is set to use an account-specific icon, load it */
 		userIconData = [self preferenceForKey:KEY_USER_ICON group:GROUP_ACCOUNT_STATUS];		
+
+		/* Note that we don't load KEY_DEFAULT_USER_ICON; if the user chooses to have an account-specific icon, then
+		 * deletes that icon, this indicates that no icon at all should be used for the account.
+		 */		
 	} else if (!isTemporary && [[adium.preferenceController preferenceForKey:KEY_USE_USER_ICON group:GROUP_ACCOUNT_STATUS] boolValue]) {
 		userIconData = [adium.preferenceController preferenceForKey:KEY_USER_ICON group:GROUP_ACCOUNT_STATUS];
+		
+		/* If there isn't an icon set manually at the global level, we still need to check for one under KEY_DEFAULT_USER_ICON.
+		 * KEY_DEFAULT_USER_ICON is used by a fallback icon source (e.g. via the Address Book 'me' card via the AB plugin)
+		 * and stored under a separate key so that it can be distinguished from a manually specified icon.
+		 */
+		if (!userIconData)
+			userIconData = [adium.preferenceController preferenceForKey:KEY_DEFAULT_USER_ICON
+																  group:GROUP_ACCOUNT_STATUS];
 	}
 
 	return userIconData;




More information about the commits mailing list