X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=blobdiff_plain;f=src%2Fplugins%2Fgdata%2Fcm_gdata_contacts.c;h=86fc265a5a665923a26f11aee4369c6d02f1d54f;hp=6cde920674f8cc8bcd973f5cf04ff8df2fd56808;hb=1a9b1d83726cd36c15325d5c5893617cc47b8675;hpb=8f65fc9f8be8d30ba67d8f4a64256e8645aa0dc1 diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c index 6cde92067..86fc265a5 100644 --- a/src/plugins/gdata/cm_gdata_contacts.c +++ b/src/plugins/gdata/cm_gdata_contacts.c @@ -31,6 +31,7 @@ #include "addr_compl.h" #include "main.h" +#include "passwordstore.h" #include "prefs_common.h" #include "mainwindow.h" #include "common/log.h" @@ -521,6 +522,8 @@ static guchar* decode(const gchar *in) static void query() { + gchar *token; + if(cm_gdata_contacts_query_running) { debug_print("GData plugin: Network query already in progress"); @@ -551,10 +554,13 @@ static void query() { #if GDATA_CHECK_VERSION(0,17,2) /* Try to restore from saved refresh token.*/ - if(cm_gdata_config.oauth2_refresh_token) + if((token = passwd_store_get(PWS_PLUGIN, + "GData", GDATA_TOKEN_PWD_STRING)) != NULL) { log_message(LOG_PROTOCOL, _("GData plugin: Trying to refresh authorization\n")); - gdata_oauth2_authorizer_set_refresh_token(authorizer, cm_gdata_config.oauth2_refresh_token); + gdata_oauth2_authorizer_set_refresh_token(authorizer, token); + memset(token, 0, strlen(token)); + g_free(token); gdata_authorizer_refresh_authorization_async(GDATA_AUTHORIZER(authorizer), NULL, (GAsyncReadyCallback)cm_gdata_refresh_ready, NULL); } else @@ -618,6 +624,8 @@ gboolean cm_gdata_update_contacts_cache(void) void cm_gdata_contacts_done(void) { + gchar *pass; + g_free(contacts_group_id); contacts_group_id = NULL; @@ -629,7 +637,11 @@ void cm_gdata_contacts_done(void) { #if GDATA_CHECK_VERSION(0,17,2) /* store refresh token */ - cm_gdata_config.oauth2_refresh_token = gdata_oauth2_authorizer_dup_refresh_token(authorizer); + pass = gdata_oauth2_authorizer_dup_refresh_token(authorizer); + passwd_store_set(PWS_PLUGIN, "GData", GDATA_TOKEN_PWD_STRING, pass, + FALSE); + memset(pass, 0, strlen(pass)); + g_free(pass); #endif g_object_unref(G_OBJECT(authorizer));