adium/adium

16b03b8cc757
Parents f84e4565f51c
Children 680a579a4b3c
Signing in works! But only for an hour, the refresh_token is unused.
--- a/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 11:51:37 2015 +0200
+++ b/Plugins/Purple Service/AIPurpleGTalkAccountViewController.m Wed Apr 01 12:05:55 2015 +0200
@@ -18,6 +18,8 @@
#import "JSONKit.h"
+#import <Adium/AIAccountControllerProtocol.h>
+
#define ADIUM_GTALK_CLIENT_ID @"853036734951.apps.googleusercontent.com"
#define ADIUM_GTALK_SECRET @"TSXNUaq34k_0YU7DZT4HbmQd"
@@ -123,6 +125,8 @@
NSDictionary *responseDict = [response objectFromJSONDataWithParseOptions:JKParseOptionNone error:&error];
AILogWithSignature(@"%@", responseDict);
+
+ [[adium accountController] setPassword:[responseDict objectForKey:@"access_token"] forAccount:account];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
--- a/Plugins/Purple Service/libpurple_extensions/auth_gtalk.c Wed Apr 01 11:51:37 2015 +0200
+++ b/Plugins/Purple Service/libpurple_extensions/auth_gtalk.c Wed Apr 01 12:05:55 2015 +0200
@@ -31,17 +31,28 @@
#include "jabber.h"
#include "auth.h"
-#define PACKAGE "pidgin"
-
static JabberSaslState
gtalk_start(JabberStream *js, xmlnode *packet, xmlnode **response, char **error)
{
+ gchar *enc_out;
xmlnode *auth = xmlnode_new("auth");
+ GString *resp;
+
xmlnode_set_namespace(auth, "urn:ietf:params:xml:ns:xmpp-sasl");
xmlnode_set_attrib(auth, "mechanism", "X-OAUTH2");
xmlnode_set_attrib(auth, "auth:service", "oauth2");
xmlnode_set_attrib(auth, "xmlns:auth", "http://www.google.com/talk/protocol/auth");
+ resp = g_string_new("");
+ resp = g_string_append_c(resp, '\0');
+ resp = g_string_append(resp, js->user->node);
+ resp = g_string_append_c(resp, '\0');
+ resp = g_string_append(resp, purple_connection_get_password(js->gc));
+
+ enc_out = purple_base64_encode((guchar *)resp->str, resp->len);
+
+ xmlnode_insert_data(auth, enc_out, -1);
+
*response = auth;
return JABBER_SASL_STATE_CONTINUE;