adium-1.4 3389:90a8ddc300fd: Max priority is 127, not 255; X-FAC...
commits at adium.im
commits at adium.im
Wed Mar 9 05:45:25 UTC 2011
details: http://hg.adium.im/adium-1.4/rev/90a8ddc300fd
revision: 3389:90a8ddc300fd
branch: facebook-xmpp
author: Evan Schoenberg
date: Tue Mar 08 23:27:54 2011 -0600
Max priority is 127, not 255; X-FACEBOOK-PLATFORM will now be used first where applicable
Subject: adium-1.4 3390:dc60412e591d: Added a AILibpurpleDidInitialize notification which is useful for performing actions once all libpurple plugins and prpsl are guaranteed to have been loaded.
details: http://hg.adium.im/adium-1.4/rev/dc60412e591d
revision: 3390:dc60412e591d
branch: facebook-xmpp
author: Evan Schoenberg
date: Tue Mar 08 23:29:24 2011 -0600
Added a AILibpurpleDidInitialize notification which is useful for performing actions once all libpurple plugins and prpsl are guaranteed to have been loaded.
Subject: adium-1.4 3391:aaa065c24e99: Make use of AILibpurpleDidInitialize to add the fb auth mech
details: http://hg.adium.im/adium-1.4/rev/aaa065c24e99
revision: 3391:aaa065c24e99
branch: facebook-xmpp
author: Evan Schoenberg
date: Tue Mar 08 23:29:50 2011 -0600
Make use of AILibpurpleDidInitialize to add the fb auth mech
Subject: adium-1.4 3392:deeb7fda7a0e: Don't remove mechs; this was previously needed because of the bug fixed in [90a8ddc300fd]. We now add the fb mech when libpurple initializes; we don't need to do it at each connect (which, in turn was adding it in a duplicate fashion with every connect cycle)
details: http://hg.adium.im/adium-1.4/rev/deeb7fda7a0e
revision: 3392:deeb7fda7a0e
branch: facebook-xmpp
author: Evan Schoenberg
date: Tue Mar 08 23:31:06 2011 -0600
Don't remove mechs; this was previously needed because of the bug fixed in [90a8ddc300fd]. We now add the fb mech when libpurple initializes; we don't need to do it at each connect (which, in turn was adding it in a duplicate fashion with every connect cycle)
Subject: adium-1.4 3393:5807e50e35dd: The session secret is used with each connect cycle, and it should be stable. Store it when we get it during OAuth, then retrieve it when connecting. Refs #15038 (fixing the most broken part; the account now works across restarting ADium)
details: http://hg.adium.im/adium-1.4/rev/5807e50e35dd
revision: 3393:5807e50e35dd
branch: facebook-xmpp
author: Evan Schoenberg
date: Tue Mar 08 23:44:01 2011 -0600
The session secret is used with each connect cycle, and it should be stable. Store it when we get it during OAuth, then retrieve it when connecting. Refs #15038 (fixing the most broken part; the account now works across restarting ADium)
diffs (139 lines):
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/AIFacebookXMPPAccount.m
--- a/Plugins/Purple Service/AIFacebookXMPPAccount.m Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/AIFacebookXMPPAccount.m Tue Mar 08 23:44:01 2011 -0600
@@ -44,14 +44,11 @@
- (void)configurePurpleAccount
{
[super configurePurpleAccount];
-
+
purple_account_set_username(account, self.purpleAccountName);
- jabber_auth_remove_mech(jabber_auth_get_digest_md5_mech());
- jabber_auth_remove_mech(jabber_auth_get_cyrus_mech());
- jabber_auth_add_mech(jabber_auth_get_fb_mech());
purple_account_set_string(account, "connection_security", "");
purple_account_set_string(account, "fb_api_key", "819fd0b010d15eac1b36648f0126ece3");
- purple_account_set_string(account, "fb_api_secret", [[self sessionSecret] UTF8String]);
+ purple_account_set_string(account, "fb_api_secret", [[self preferenceForKey:@"FBSessionSecret" group:GROUP_ACCOUNT_STATUS] UTF8String]);
}
- (const char *)purpleAccountName
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/AIFacebookXMPPAccountViewController.m
--- a/Plugins/Purple Service/AIFacebookXMPPAccountViewController.m Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/AIFacebookXMPPAccountViewController.m Tue Mar 08 23:44:01 2011 -0600
@@ -95,12 +95,17 @@
NSString *secret = [[[NSString alloc] initWithData:secretData encoding:NSUTF8StringEncoding] autorelease];
secret = [secret substringWithRange:NSMakeRange(1, [secret length] - 2)]; // strip off the quotes
+ /* Passwords are keyed by UID, so we need to make this change before storing the password */
+ [account filterAndSetUID:uuid];
+ [account setFormattedUID:name notify:NotifyNever];
+
[[adium accountController] setPassword:sessionKey forAccount:account];
[account setPasswordTemporarily:sessionKey];
- [(AIFacebookXMPPAccount *)account setSessionSecret:secret];
+
+ [account setPreference:secret
+ forKey:@"FBSessionSecret"
+ group:GROUP_ACCOUNT_STATUS];
- [account filterAndSetUID:uuid];
- [account setFormattedUID:name notify:NotifyNever];
NSString *connectHost = @"FBXMPP";
[account setPreference:connectHost
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/AIFacebookXMPPService.m
--- a/Plugins/Purple Service/AIFacebookXMPPService.m Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/AIFacebookXMPPService.m Tue Mar 08 23:44:01 2011 -0600
@@ -12,8 +12,37 @@
#import "AIFacebookXMPPService.h"
+#import "AILibpurplePlugin.h"
+#import <Libpurple/auth.h>
+#import "auth_fb.h"
+
@implementation AIFacebookXMPPService
+- (id)init
+{
+ if ((self = [super init])) {
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(libpurpleDidInit:)
+ name:AILibpurpleDidInitialize
+ object:nil];
+ }
+
+ return self;
+}
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+
+ [super dealloc];
+}
+
+- (void)libpurpleDidInit:(NSNotification *)notification
+{
+ AILog(@"Adding mech for fb");
+ jabber_auth_add_mech(jabber_auth_get_fb_mech());
+}
+
//Account Creation
- (Class)accountClass{
return [AIFacebookXMPPAccount class];
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/AILibpurplePlugin.h
--- a/Plugins/Purple Service/AILibpurplePlugin.h Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/AILibpurplePlugin.h Tue Mar 08 23:44:01 2011 -0600
@@ -13,3 +13,12 @@
*/
- (void)loadLibpurplePlugin;
@end
+
+/*!
+ * @brief Notification that libpurple did initialize.
+ *
+ * Posted on NSNotificationCenter's defaultCenter.
+ *
+ * All plugins which are going to be loaded will be loaded before this is posted.
+ */
+#define AILibpurpleDidInitialize @"AILibpurpleDidInitialize"
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/adiumPurpleCore.m
--- a/Plugins/Purple Service/adiumPurpleCore.m Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/adiumPurpleCore.m Tue Mar 08 23:44:01 2011 -0600
@@ -37,12 +37,6 @@
#import <AIUtilities/AIFileManagerAdditions.h>
#import <Adium/AIAccountControllerProtocol.h>
-
-#warning This include and the jabber_auth_add_mech() will be part of the FacebookXMPP account's initialization
-#import "auth.h"
-#import "auth_fb.h"
-
-
#pragma mark Debug
// Debug ------------------------------------------------------------------------------------------------------
static void adiumPurpleDebugPrint(PurpleDebugLevel level, const char *category, const char *debug_msg)
@@ -237,7 +231,8 @@
load_external_plugins();
- jabber_auth_add_mech(jabber_auth_get_fb_mech());
+ [[NSNotificationCenter defaultCenter] postNotificationName:AILibpurpleDidInitialize
+ object:nil];
}
static void adiumPurpleCoreQuit(void)
diff -r 153eb0ac7c31 -r 5807e50e35dd Plugins/Purple Service/libpurple_extensions/auth_fb.c
--- a/Plugins/Purple Service/libpurple_extensions/auth_fb.c Sun Mar 06 19:06:08 2011 -0800
+++ b/Plugins/Purple Service/libpurple_extensions/auth_fb.c Tue Mar 08 23:44:01 2011 -0600
@@ -143,7 +143,7 @@
}
static JabberSaslMech fb_mech = {
- 255, /* priority */
+ 127, /* priority; gint8 (-128 to 127). higher will be tried sooner if offerred by the server */
"X-FACEBOOK-PLATFORM", /* name */
fb_start,
fb_handle_challenge, /* handle_challenge */
More information about the commits
mailing list