Inspired by the patch from ypisetsky, ensure AIFacebookXMPPOAuthWebViewWindowController doesn't keep multiple cookies around with the same name, by using a dictionary instead of a set for the cookies.
Fixes #15705
1.1 --- a/Plugins/Purple Service/AIFacebookXMPPOAuthWebViewWindowController.h Sun Jul 22 14:20:15 2012 +0200
1.2 +++ b/Plugins/Purple Service/AIFacebookXMPPOAuthWebViewWindowController.h Wed Jul 25 01:01:46 2012 +0200
1.3 @@ -14,7 +14,7 @@
1.4 @interface AIFacebookXMPPOAuthWebViewWindowController : AIWindowController {
1.5 IBOutlet WebView *webView;
1.6 IBOutlet NSProgressIndicator *spinner;
1.7 - NSMutableSet *cookies;
1.8 + NSMutableDictionary *cookies;
1.9
1.10 AIFacebookXMPPAccount *account;
1.11
1.12 @@ -28,7 +28,7 @@
1.13 @property (nonatomic, retain) IBOutlet WebView *webView;
1.14 @property (nonatomic, retain) IBOutlet NSProgressIndicator *spinner;
1.15
1.16 -@property (nonatomic, retain) NSMutableSet *cookies;
1.17 +@property (nonatomic, retain) NSMutableDictionary *cookies;
1.18 @property (nonatomic, retain) AIFacebookXMPPAccount *account;
1.19
1.20 @property (nonatomic, retain) NSString *autoFillUsername;
2.1 --- a/Plugins/Purple Service/AIFacebookXMPPOAuthWebViewWindowController.m Sun Jul 22 14:20:15 2012 +0200
2.2 +++ b/Plugins/Purple Service/AIFacebookXMPPOAuthWebViewWindowController.m Wed Jul 25 01:01:46 2012 +0200
2.3 @@ -28,7 +28,7 @@
2.4 - (id)init
2.5 {
2.6 if ((self = [super initWithWindowNibName:@"AIFacebookXMPPOauthWebViewWindow"])) {
2.7 - self.cookies = [[[NSMutableSet alloc] init] autorelease];
2.8 + self.cookies = [[[NSMutableDictionary alloc] init] autorelease];
2.9 }
2.10 return self;
2.11 }
2.12 @@ -163,7 +163,10 @@
2.13 - (void)addCookiesFromResponse:(NSHTTPURLResponse *)response
2.14 {
2.15 NSArray *newCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:[response allHeaderFields] forURL:[response URL]];
2.16 - [cookies addObjectsFromArray:newCookies];
2.17 +
2.18 + for (NSHTTPCookie *newCookie in newCookies) {
2.19 + [cookies setObject:newCookie forKey:newCookie.name];
2.20 + }
2.21 }
2.22
2.23 - (void)addCookiesToRequest:(NSMutableURLRequest *)request