[Commits] [SCM] claws branch, master, updated. 3.16.0-220-g70d4cce
holger at claws-mail.org
holger at claws-mail.org
Mon Jun 25 23:27:04 CEST 2018
The branch, master has been updated
via 70d4cce5c4200119be1a50ce23b1c227c0056f67 (commit)
via a6913537c97260ec3e51914e66f4443b61fe81a0 (commit)
from ccdcff149d86e07199748d1470472c855ffbd91e (commit)
Summary of changes:
src/plugins/gdata/cm_gdata_contacts.c | 55 +++++++++++++++++++++++++--------
1 file changed, 42 insertions(+), 13 deletions(-)
- Log -----------------------------------------------------------------
commit 70d4cce5c4200119be1a50ce23b1c227c0056f67
Author: Holger Berndt <hb at claws-mail.org>
Date: Mon Jun 25 23:22:26 2018 +0200
GData plugin: Request interactive auth only in case of auth issues
At the same time, make (now potentially ignored) errors more visible
in the status bar in the same way as background mail fetching errors
are reported.
Fixes bug #3754
Modified version of the patch by Viacheslav Gagara on that bug report.
diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index e8d1034..1c6ba7d 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -501,6 +501,7 @@ static void cm_gdata_interactive_auth()
static void cm_gdata_refresh_ready(GDataOAuth2Authorizer *auth, GAsyncResult *res, gpointer data)
{
GError *error = NULL;
+ gboolean start_interactive_auth = FALSE;
if(gdata_authorizer_refresh_authorization_finish(GDATA_AUTHORIZER(auth), res, &error) == FALSE)
{
@@ -508,10 +509,25 @@ static void cm_gdata_refresh_ready(GDataOAuth2Authorizer *auth, GAsyncResult *re
if(!g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
{
log_error(LOG_PROTOCOL, _("GData plugin: Authorization refresh error: %s\n"), error->message);
+
+ if(mainwindow_get_mainwindow())
+ {
+ mainwindow_show_error();
+ }
}
+
+ /* Only start an interactive auth session in case of authorization issues, but not
+ * for e.g. sporadic network issues or other non-authorization-related problems. */
+ start_interactive_auth =
+ g_error_matches(error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED) ||
+ g_error_matches(error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_FORBIDDEN);
+
g_error_free(error);
- cm_gdata_interactive_auth();
+ if(start_interactive_auth)
+ {
+ cm_gdata_interactive_auth();
+ }
return;
}
commit a6913537c97260ec3e51914e66f4443b61fe81a0
Author: Holger Berndt <hb at claws-mail.org>
Date: Sun Jun 24 16:16:46 2018 +0200
GData plugin: Only allow one interactive auth session at a time
diff --git a/src/plugins/gdata/cm_gdata_contacts.c b/src/plugins/gdata/cm_gdata_contacts.c
index 342b277..e8d1034 100644
--- a/src/plugins/gdata/cm_gdata_contacts.c
+++ b/src/plugins/gdata/cm_gdata_contacts.c
@@ -458,27 +458,40 @@ static void cm_gdata_auth_ready(GDataOAuth2Authorizer *auth, GAsyncResult *res,
static void cm_gdata_interactive_auth()
{
- gchar *auth_uri;
- gchar *auth_code;
+ static gboolean interactive_auth_running = FALSE;
- log_message(LOG_PROTOCOL, _("GData plugin: Starting interactive authorization\n"));
+ gchar *auth_uri;
auth_uri = gdata_oauth2_authorizer_build_authentication_uri(authorizer, cm_gdata_config.username, FALSE);
g_return_if_fail(auth_uri);
- auth_code = ask_user_for_auth_code(auth_uri);
-
- if(auth_code)
+ if(!interactive_auth_running)
{
- cm_gdata_contacts_query_running = TRUE;
- log_message(LOG_PROTOCOL, _("GData plugin: Got authorization code, requesting authorization\n"));
- gdata_oauth2_authorizer_request_authorization_async(authorizer, auth_code, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
- memset(auth_code, 0, strlen(auth_code));
- g_free(auth_code);
+ gchar *auth_code;
+
+ interactive_auth_running = TRUE;
+
+ log_message(LOG_PROTOCOL, _("GData plugin: Starting interactive authorization\n"));
+
+ auth_code = ask_user_for_auth_code(auth_uri);
+
+ if(auth_code)
+ {
+ cm_gdata_contacts_query_running = TRUE;
+ log_message(LOG_PROTOCOL, _("GData plugin: Got authorization code, requesting authorization\n"));
+ gdata_oauth2_authorizer_request_authorization_async(authorizer, auth_code, NULL, (GAsyncReadyCallback)cm_gdata_auth_ready, NULL);
+ memset(auth_code, 0, strlen(auth_code));
+ g_free(auth_code);
+ }
+ else
+ {
+ log_warning(LOG_PROTOCOL, _("GData plugin: No authorization code received, authorization request cancelled\n"));
+ }
+ interactive_auth_running = FALSE;
}
else
{
- log_warning(LOG_PROTOCOL, _("GData plugin: No authorization code received, authorization request cancelled\n"));
+ log_message(LOG_PROTOCOL, _("GData plugin: Interactive authorization still running, no additional session started\n"));
}
g_free(auth_uri);
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list