[gnome-online-accounts] tplinker: allow to ignore some accounts to make debugging easier



commit ab16c3df772495414a246bab3ed4c898b37b3cb7
Author: Marco Barisione <marco barisione collabora co uk>
Date:   Tue Jul 9 13:19:36 2013 +0100

    tplinker: allow to ignore some accounts to make debugging easier
    
    If $GOA_TELEPATHY_DEBUG_ACCOUNT_FILTER is set then only accounts
    containing that string in their ID are handled.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696267

 src/daemon/goatpaccountlinker.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/daemon/goatpaccountlinker.c b/src/daemon/goatpaccountlinker.c
index 4a282d2..0a3886a 100644
--- a/src/daemon/goatpaccountlinker.c
+++ b/src/daemon/goatpaccountlinker.c
@@ -199,6 +199,23 @@ create_goa_account (GoaTpAccountLinker *self,
   g_free (provider);
 }
 
+static gboolean
+is_account_filtered (TpAccount *tp_account)
+{
+  const gchar *env;
+  const gchar *id;
+
+  env = g_getenv ("GOA_TELEPATHY_DEBUG_ACCOUNT_FILTER");
+  if (env == NULL || env[0] == '\0')
+    return FALSE;
+
+  id = get_id_from_tp_account (tp_account);
+  if (g_strstr_len (id, -1, env) != NULL)
+    return FALSE; /* "env" is contained in "id" */
+  else
+    return TRUE;
+}
+
 static void
 tp_account_added (GoaTpAccountLinker *self,
                   TpAccount          *tp_account)
@@ -214,6 +231,12 @@ tp_account_added (GoaTpAccountLinker *self,
       return;
     }
 
+  if (is_account_filtered (tp_account))
+    {
+      goa_debug ("The account %s is ignored for debugging reasons", id);
+      return;
+    }
+
   goa_debug ("Telepathy account found: %s", id);
 
   g_hash_table_replace (priv->tp_accounts, g_strdup (id),


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