[evolution-data-server] Add a debug print for OAUTH2_DEBUG=1 when obtaining authentication token



commit edfff988978e803d5c6649e02bc98cf2e8171bf4
Author: Milan Crha <mcrha redhat com>
Date:   Tue Jan 23 19:13:58 2018 +0100

    Add a debug print for OAUTH2_DEBUG=1 when obtaining authentication token

 .../e-credentials-prompter-impl-oauth2.c           |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/libedataserverui/e-credentials-prompter-impl-oauth2.c 
b/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
index 5cf02d0..ef7f83b 100644
--- a/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
+++ b/src/libedataserverui/e-credentials-prompter-impl-oauth2.c
@@ -57,6 +57,17 @@ G_DEFINE_TYPE (ECredentialsPrompterImplOAuth2, e_credentials_prompter_impl_oauth
 
 #ifdef ENABLE_OAUTH2
 
+static gboolean
+cpi_oauth2_get_debug (void)
+{
+       static gint oauth2_debug = -1;
+
+       if (oauth2_debug == -1)
+               oauth2_debug = g_strcmp0 (g_getenv ("OAUTH2_DEBUG"), "1") == 0 ? 1 : 0;
+
+       return oauth2_debug == 1;
+}
+
 static gchar *
 cpi_oauth2_create_auth_uri (EOAuth2Service *service,
                            ESource *source)
@@ -354,6 +365,10 @@ cpi_oauth2_document_load_changed_cb (WebKitWebView *web_view,
        if (!title || !uri)
                return;
 
+       if (cpi_oauth2_get_debug ()) {
+               g_print ("[OAuth2] Loaded URI: '%s'\n", uri);
+       }
+
        g_return_if_fail (prompter_oauth2->priv->service != NULL);
 
        if ((e_oauth2_service_get_flags (prompter_oauth2->priv->service) & 
E_OAUTH2_SERVICE_FLAG_EXTRACT_REQUIRES_PAGE_CONTENT) != 0) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]