adium 3013:48d26702da22: Include the alias in the authorization ...

commits at adium.im commits at adium.im
Wed Dec 2 01:47:26 UTC 2009


details:	http://hg.adium.im/adium/rev/48d26702da22
revision:	3013:48d26702da22
author:		Zachary West <zacw at adium.im>
date:		Tue Dec 01 20:47:11 2009 -0500

Include the alias in the authorization window. Only include the account details if there's more than one account of that type.
(transplanted from 6ad1d654769aef3a260089494708ed2f0078e041)

diffs (55 lines):

diff -r 5f7f5121c73a -r 48d26702da22 Frameworks/Adium Framework/Source/AIAuthorizationRequestsWindowController.m
--- a/Frameworks/Adium Framework/Source/AIAuthorizationRequestsWindowController.m	Tue Dec 01 18:37:12 2009 -0500
+++ b/Frameworks/Adium Framework/Source/AIAuthorizationRequestsWindowController.m	Tue Dec 01 20:47:11 2009 -0500
@@ -13,6 +13,7 @@
 #import <Adium/AIServiceIcons.h>
 #import <Adium/AIContactControllerProtocol.h>
 #import <Adium/AIListContact.h>
+#import <Adium/AIAccountControllerProtocol.h>
 #import <AIUtilities/AIMenuAdditions.h>
 #import <AIUtilities/AIImageTextCell.h>
 #import <AIUtilities/AIImageAdditions.h>
@@ -490,9 +491,29 @@
 											   type:AIServiceIconLarge
 										   direction:AIIconNormal] imageByScalingToSize:NSMakeSize(MINIMUM_ROW_HEIGHT-2, MINIMUM_ROW_HEIGHT-2)];
 	} else if ([identifier isEqualToString:@"request"]) {
-		return [NSString stringWithFormat:AILocalizedString(@"%@ on the account %@", nil),
-				[[requests objectAtIndex:rowIndex] objectForKey:@"Remote Name"],
-				((AIAccount *)[[requests objectAtIndex:rowIndex] objectForKey:@"Account"]).explicitFormattedUID];
+		AIAccount *account = [[requests objectAtIndex:rowIndex] objectForKey:@"Account"];
+		NSString *displayName = [[requests objectAtIndex:rowIndex] objectForKey:@"Alias"];
+		NSString *UID = [[requests objectAtIndex:rowIndex] objectForKey:@"Remote Name"];
+		NSString *finalDisplay = nil;
+		
+		if (displayName && UID) {
+			finalDisplay = [NSString stringWithFormat:@"%@ (%@)", displayName, UID];
+		} else if (displayName) {
+			finalDisplay = displayName;
+		} else { // if (UID) {
+			finalDisplay = UID;
+		}
+		
+		NSArray *accounts = [adium.accountController accountsCompatibleWithService:account.service];
+		
+		if (accounts.count > 1) {
+			// Only show the account if it's the only one of its type.
+			return [NSString stringWithFormat:AILocalizedString(@"%@ on the account %@", nil),
+					finalDisplay,
+					((AIAccount *)[[requests objectAtIndex:rowIndex] objectForKey:@"Account"]).explicitFormattedUID];	
+		} else {
+			return finalDisplay;
+		}
 	}
 	
 	return nil;
diff -r 5f7f5121c73a -r 48d26702da22 Plugins/Purple Service/adiumPurpleAccounts.m
--- a/Plugins/Purple Service/adiumPurpleAccounts.m	Tue Dec 01 18:37:12 2009 -0500
+++ b/Plugins/Purple Service/adiumPurpleAccounts.m	Tue Dec 01 20:47:11 2009 -0500
@@ -57,6 +57,7 @@
 		nil];
 	
 	if (message && strlen(message)) [infoDict setObject:[NSString stringWithUTF8String:message] forKey:@"Reason"];
+	if (alias && strlen(alias)) [infoDict setObject:[NSString stringWithUTF8String:alias] forKey:@"Alias"];
 
 	//Note that CBPurpleAccount will retain ownership of this object to keep it around for us in case adiumPurpleAccountRequestClose() is called.
 	return [accountLookup(account) authorizationRequestWithDict:infoDict];




More information about the commits mailing list