adium 5902:16b03b8cc757: Signing in works! But only for an hour,...

commits at adium.im commits at adium.im
Wed Apr 1 10:06:51 UTC 2015


details:	http://hg.adium.im/adium/rev/16b03b8cc757
revision:	5902:16b03b8cc757
branch:		GoogleOAuth2
author:		Thijs Alkemade <me at thijsalkema.de>
date:		Wed Apr 01 12:05:55 2015 +0200

Signing in works! But only for an hour, the refresh_token is unused.

diffs (55 lines):

diff -r f84e4565f51c -r 16b03b8cc757 Plugins/Purple Service/AIPurpleGTalkAccountViewController.m
--- 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{
diff -r f84e4565f51c -r 16b03b8cc757 Plugins/Purple Service/libpurple_extensions/auth_gtalk.c
--- 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;




More information about the commits mailing list