adium-1.4 2856:afd127c0a25c: Simplify the logic of watching auth...

commits at adium.im commits at adium.im
Tue Dec 1 01:36:20 UTC 2009


details:	http://hg.adium.im/adium-1.4/rev/afd127c0a25c
revision:	2856:afd127c0a25c
author:		Zachary West <zacw at adium.im>
date:		Mon Nov 30 20:36:16 2009 -0500

Simplify the logic of watching authorization requests. We don't need to do this over-retaining nonsense.

diffs (88 lines):

diff -r b50d42c93fe0 -r afd127c0a25c Frameworks/Adium Framework/Source/AdiumAuthorization.m
--- a/Frameworks/Adium Framework/Source/AdiumAuthorization.m	Mon Nov 30 19:54:22 2009 -0500
+++ b/Frameworks/Adium Framework/Source/AdiumAuthorization.m	Mon Nov 30 20:36:16 2009 -0500
@@ -48,7 +48,6 @@
 		// Always ignore requests from blocked contacts. Don't even show it to the user.
 		AILogWithSignature(@"Authorization request with dict %@ ignored due to %@ being blocked", inDict, listContact);
 		[inAccount authorizationWithDict:inDict response:AIAuthorizationNoResponse];
-		
 		return nil;
 	}
 	
@@ -58,22 +57,15 @@
 									 forListObject:(AIListObject *)listContact
 										  userInfo:nil
 					  previouslyPerformedActionIDs:nil];
+
+	[[AIAuthorizationRequestsWindowController sharedController] addRequestWithDict:inDict];
 	
-	NSMutableDictionary *dictWithAccount = [inDict mutableCopy];
-	
-	[dictWithAccount setObject:inAccount forKey:@"Account"];
-
-	[[AIAuthorizationRequestsWindowController sharedController] addRequestWithDict:dictWithAccount];
-
-	// We intentionally continue to retain the dictWithAccount so we can possibly remove it later.
-	return dictWithAccount;
+	return inDict;
 }
 
 + (void)closeAuthorizationForUIHandle:(id)handle
 {
 	[[AIAuthorizationRequestsWindowController sharedController] removeRequest:handle];
-	
-	[handle release];
 }
 
 #pragma mark Event descriptions
diff -r b50d42c93fe0 -r afd127c0a25c Plugins/Purple Service/CBPurpleAccount.h
--- a/Plugins/Purple Service/CBPurpleAccount.h	Mon Nov 30 19:54:22 2009 -0500
+++ b/Plugins/Purple Service/CBPurpleAccount.h	Mon Nov 30 20:36:16 2009 -0500
@@ -134,7 +134,7 @@
 
 - (void)removeContact:(AIListContact *)theContact;
 
-- (NSWindowController *)authorizationRequestWithDict:(NSDictionary*)dict;
+- (id)authorizationRequestWithDict:(NSDictionary*)dict;
 
 - (void)addChat:(AIChat *)chat;
 - (void)typingUpdateForIMChat:(AIChat *)chat typing:(NSNumber *)typing;
diff -r b50d42c93fe0 -r afd127c0a25c Plugins/Purple Service/CBPurpleAccount.m
--- a/Plugins/Purple Service/CBPurpleAccount.m	Mon Nov 30 19:54:22 2009 -0500
+++ b/Plugins/Purple Service/CBPurpleAccount.m	Mon Nov 30 20:36:16 2009 -0500
@@ -718,8 +718,7 @@
 
 - (id)authorizationRequestWithDict:(NSDictionary*)dict
 {
-	// We retain this in case libpurple wants to close the request early. It is freed below.
-	return [[AdiumAuthorization showAuthorizationRequestWithDict:dict forAccount:self] retain];
+	return [AdiumAuthorization showAuthorizationRequestWithDict:dict forAccount:self];
 }
 
 - (void)authorizationWithDict:(NSDictionary *)infoDict response:(AIAuthorizationResponse)authorizationResponse
@@ -742,14 +741,8 @@
 		//libpurple will remove its reference to the handle for this request, which is inDict, in response to this callback invocation
 		if (callback) {
 			[purpleAdapter doAuthRequestCbValue:callback withUserDataValue:[[[infoDict objectForKey:@"userData"] retain] autorelease]];
-
-			/* Retained in -[self authorizationRequestWithDict:].  We kept it around before now in case libpurle wanted us to close it early, such as because the
-			 * account disconnected.
-			 */
-			[infoDict release];
 		} else {
 			[purpleAdapter closeAuthRequestWithHandle:infoDict];
-			
 		}
 	}
 }
diff -r b50d42c93fe0 -r afd127c0a25c Plugins/Purple Service/adiumPurpleAccounts.m
--- a/Plugins/Purple Service/adiumPurpleAccounts.m	Mon Nov 30 19:54:22 2009 -0500
+++ b/Plugins/Purple Service/adiumPurpleAccounts.m	Mon Nov 30 20:36:16 2009 -0500
@@ -50,6 +50,7 @@
 										void *user_data)
 {
 	NSMutableDictionary	*infoDict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ 		accountLookup(account), @"Account",
 		[NSString stringWithUTF8String:remote_user], @"Remote Name",
 		[NSValue valueWithPointer:authorize_cb], @"authorizeCB",
 		[NSValue valueWithPointer:deny_cb], @"denyCB",




More information about the commits mailing list