/soc/2015/nakulgulati/main: 8db484a4b1f1: hangouts: uberauth aut...

[email protected]
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: 8db484a4b1f1d9c04af4c984d376e35370529ddc
Author:	 Nakul Gulati
Date:	 2015-07-20 03:40 +0800
Branch:	 hangouts-uberauth
URL: https://hg.pidgin.im/soc/2015/nakulgulati/main/rev/8db484a4b1f1

Description:

hangouts: uberauth auth route

diffstat:

 libpurple/protocols/hangouts/api.h  |   2 ++
 libpurple/protocols/hangouts/auth.c |  36 +++++++++++++++++++++++++++++-------
 libpurple/protocols/hangouts/auth.h |   2 ++
 3 files changed, 33 insertions(+), 7 deletions(-)

diffs (108 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);

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.