/soc/2015/nakulgulati/main: 41404ce76eac: Merge with 8db484a4b1f...

Nakul at rock.pidgin.im Nakul at rock.pidgin.im
Mon Jul 20 06:51:57 EDT 2015


Changeset: 41404ce76eacbc9cb3d84f21204e7c5d372ba0a8
Author:	 Nakul Gulati
Date:	 2015-07-20 03:49 +0800
Branch:	 hangouts
URL: https://hg.pidgin.im/soc/2015/nakulgulati/main/rev/41404ce76eac

Description:

Merge with 8db484a4b1f1d9c04af4c984d376e35370529ddc

diffstat:

 libpurple/protocols/hangouts/api.h      |   2 +
 libpurple/protocols/hangouts/auth.c     |  36 ++++++++++++++++++++++++++------
 libpurple/protocols/hangouts/auth.h     |   2 +
 libpurple/protocols/hangouts/hangouts.c |  32 ++++++++++++++++++++++++++++-
 4 files changed, 64 insertions(+), 8 deletions(-)

diffs (163 lines):

diff --git a/libpurple/protocols/hangouts/api.h b/libpurple/protocols/hangouts/api.h
--- a/libpurple/protocols/hangouts/api.h
+++ b/libpurple/protocols/hangouts/api.h
@@ -44,4 +44,6 @@
 GType
 hangouts_api_get_type(void);
 
+typedef struct _hangouts_api_data hangouts_api_data;
+
 #endif /* _API_H */
diff --git a/libpurple/protocols/hangouts/auth.c b/libpurple/protocols/hangouts/auth.c
--- a/libpurple/protocols/hangouts/auth.c
+++ b/libpurple/protocols/hangouts/auth.c
@@ -31,8 +31,8 @@ typedef struct
 	gpointer user_data;
 	gchar *token;
 	gchar *token_secret;
-
-	gchar *sign_method, *sign_url;
+	gchar *sign_method;
+	gchar *sign_url;
 } _hangouts_oauth_data;
 
 typedef struct
@@ -45,6 +45,23 @@ typedef struct
 	gchar *redirect_uri;
 } _hangouts_oauth_token_request_data;
 
+typedef struct
+{
+	gchar *APISID;
+	gchar *HSID;
+	gchar *NID;
+	gchar *SAPISID;
+	gchar *SID;
+	gchar *SSID;
+} _hangouts_oauth_cookies;
+
+gchar *
+hangouts_auth_get_authorization_header(gchar *access_token)
+{
+	gchar *header = g_print("Bearer %s",access_token);
+	return header;
+}
+
 void
 hangouts_auth_with_authentication_code_cb(PurpleHttpConnection *gc,
 	PurpleHttpResponse *response, gpointer user_data){
@@ -180,8 +197,11 @@ hangouts_auth_get_session_cookies_got_cb
 	/*purple_debug_misc("hangouts-prpl", "cookies_got response: %s", raw);*/
 
 	PurpleHttpCookieJar *cookie_jar;
+	PurpleHttpRequest *request;
 
-	cookie_jar = purple_http_conn_get_cookie_jar(gc);
+	request = purple_http_conn_get_request(gc);
+
+	cookie_jar = purple_http_request_get_cookie_jar(request);
 
 	gchar *cookies = purple_http_cookie_jar_dump(cookie_jar);
 	gchar *GAPS = purple_http_cookie_jar_get(cookie_jar,"GAPS");
@@ -204,9 +224,11 @@ hangouts_auth_get_session_cookies_uberau
 	gchar *auth_data, *url, *uberauth;
 	PurpleHttpCookieJar *cookie_jar;
 
+	cookie_jar = purple_http_conn_get_cookie_jar(gc);
+
 	uberauth = purple_http_response_get_data(response, NULL);
+
 	purple_debug_misc("hangouts-prpl", "uberauth: %s", uberauth);
-
 	auth_data = g_strdup_printf("Bearer %s",user_data);
 	url = g_strdup_printf("https://accounts.google.com/MergeSession?"
 			"service=mail&continue=http://www.google.com&uberauth=%s",uberauth);
@@ -224,18 +246,18 @@ hangouts_auth_get_session_cookies(Purple
 {
 	purple_debug_misc("hangouts-prpl", "cookies");
 	PurpleHttpRequest *request;
-	PurpleHttpKeepalivePool *keep_alive_pool;
+	PurpleHttpCookieJar *cookie_jar;
 	gchar *auth_data;
 
-	//keep_alive_pool = purple_http_keepalive_pool_new();
+	cookie_jar = purple_http_cookie_jar_new();
 
 	auth_data = g_strdup_printf("Bearer %s",access_token);
 
 	request = purple_http_request_new("https://accounts.google.com/accounts/OAuthLogin"
 			"?source=hangups&issueuberauth=1");
 	purple_http_request_set_method(request,"GET");
+	purple_http_request_set_cookie_jar(request, cookie_jar);
 	purple_http_request_header_set(request,"Authorization",auth_data);
-	//purple_http_request_set_keepalive_pool(request, keep_alive_pool);
 
 	purple_http_request(gc,request,hangouts_auth_get_session_cookies_uberauth_cb,access_token);
 
diff --git a/libpurple/protocols/hangouts/auth.h b/libpurple/protocols/hangouts/auth.h
--- a/libpurple/protocols/hangouts/auth.h
+++ b/libpurple/protocols/hangouts/auth.h
@@ -41,6 +41,8 @@ typedef struct _hangouts_oauth_data hang
 
 typedef struct _hangouts_oauth_token_request_data hangouts_oauth_token_request_data;
 
+typedef struct _hangouts_oauth_cookies hangouts_oauth_cookies;
+
 
 void hangouts_oauth_data_free(hangouts_oauth_data *data);
 void hangouts_auth_with_authentication_code(PurpleConnection *gc);
diff --git a/libpurple/protocols/hangouts/hangouts.c b/libpurple/protocols/hangouts/hangouts.c
--- a/libpurple/protocols/hangouts/hangouts.c
+++ b/libpurple/protocols/hangouts/hangouts.c
@@ -29,12 +29,21 @@
 #include "protocols.h"
 #include "roomlist.h"
 #include "version.h"
+#include "libpurple/util.h"
 
 #include "hangouts.h"
 #include "auth.h"
 
 static PurpleProtocol *_hangouts_protocol = NULL;
 
+gchar *uberauth="";
+
+
+void
+get_uberauth(PurpleHttpConnection *hc,	PurpleHttpResponse *response, gpointer user_data)
+{
+}
+
 static void
 hangouts_login(PurpleAccount *acct)
 {
@@ -48,7 +57,28 @@ hangouts_login(PurpleAccount *acct)
 
 	purple_debug_misc("hangouts-prpl", "login; account username: %s;",username);
 
-	hangouts_auth_with_authentication_code(gc);
+	//hangouts_auth_with_authentication_code(gc);
+	gchar *access_token = "ya29.sAFqEySvY_kujc-YjKJKUsuc7jWEeYH9fUkUDwBLvHZFIdORgaIY-82eWgDx3OE";
+	hangouts_auth_get_session_cookies(gc,access_token);
+
+	/*purple_debug_misc("hangouts-prpl", "uberauth");
+	PurpleHttpRequest *request;*/
+	/*gchar *auth_data, *url, *uberauth;*/
+	//PurpleHttpCookieJar *cookie_jar;
+
+	/*uberauth = purple_http_response_get_data(response, NULL);
+	purple_debug_misc("hangouts-prpl", "uberauth: %s", uberauth);*/
+	/*PurpleHttpCookieJar *cookie_jar;
+	cookie_jar = purple_http_cookie_jar_new();
+
+	auth_data = g_strdup_printf("Bearer %s","ya29.owEK_4dOrUVYKWPZZc7u1VLPyAy529RzOe3HjryXcTsUreGrMhYpMvCl0fBAc1G--038piAwk1c8ww");
+	url = "https://accounts.google.com/MergeSession?service=mail&continue=http://www.google.com&uberauth=APh-3FyXVKIRXo4sA-ePgs_2pWQFASboldGClyyt1shiSGV3KnyZu8E4N7DDIoz1knepZkCKoFlzWrJlqrUA1NmOUbcVonQCdUsMSj6LFmqKJ8HbH7lyJd24_ZT1JblIcFWlTegGbcPhNmKs0h8_7kM3BQhlvmJy2cr_7idhYaypKyG1OdT0ajEpLCf3nZDZVfhmVeig_ik2DHU7u_rod6giJu3kVAT3Fw0_fXc3r7yRrTw0UlzIX5vFCy_Xp4yHXT68H-QI9ayvg25HUyIB62wZ5aKZLqwsZ04FPHjan3G2g1CM6eFQLNhhdtEmefoPjEeJPyUT3uF4aRr7qYm8RtOcd0B-qMjVowRMO4JfB3uZA5g1fivQj5kTtJ5oLS5RiP62BdXV-JzjoBlwqxc1VWypMq6BcdS24dzG3h834zcMCFagRZ2Uvq0Igx0nFRu8bPZsqDjEtOp7zv-il61l8FzgVcSCdk0YCZrBBlft8gROg3_fWJbfbGsnKB58cNHCHLmD_GOv97YCup6Lu72tpx7UtDK7gw6rPBzuTRpyCMnn3eKYwFEk0VkXT9oJcm_Q_aVo0Cnj8i6gpeLuGaoiM9rsDRo96YszuVE7Y2tfnAUcReoCa9g2R-VXMCPUvutBS_RuuXdODYpbDcg5sxMxsnuBghaCmjyh2w2-Qup-9IBztPzytwT6QXhBG3lcBFjPy0xTSakJItM3d4SCPWg8oBUE-Er4f-zigw";
+
+	request = purple_http_request_new(url);
+	purple_http_request_set_method(request,"GET");
+	purple_http_request_header_set(request,"Authorization",auth_data);
+	purple_http_request_set_cookie_jar(request,cookie_jar);
+	purple_http_request(gc,request,hangouts_auth_get_session_cookies_got_cb,gc);*/
 
 }
 



More information about the Commits mailing list