adium 3372:c3a3446aeb16: Fixed use of the global default user ic...

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


details:	http://hg.adium.im/adium/rev/c3a3446aeb16
revision:	3372:c3a3446aeb16
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.
(transplanted from 9d4fb0b87d2bb667a307c47f2d26a2c0d66f66dd)

diffs (28 lines):

diff -r 613b8f4a5511 -r c3a3446aeb16 Frameworks/Adium Framework/Source/AIAbstractAccount.m
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Sun Oct 17 16:09:35 2010 -0400
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m	Sun Oct 17 22:52:13 2010 -0500
@@ -205,11 +205,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