diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-15 17:38:00 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-15 17:38:42 +0800 |
commit | fa3199f694e274e3d9e33406699a78a62858a97b (patch) | |
tree | 1d792f633f11d680769d7ebd0053635a6d43cdfb | |
parent | 94520441d0d22f6fc8361770f66c1a1ac27e011c (diff) | |
download | gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar.gz gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar.bz2 gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar.lz gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar.xz gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.tar.zst gsoc2013-empathy-fa3199f694e274e3d9e33406699a78a62858a97b.zip |
sanity-cleaning: set fallback-servers on Facebook accounts
https://bugzilla.gnome.org/show_bug.cgi?id=672120
-rw-r--r-- | src/empathy-sanity-cleaning.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/src/empathy-sanity-cleaning.c b/src/empathy-sanity-cleaning.c index 740d84206..70e5de273 100644 --- a/src/empathy-sanity-cleaning.c +++ b/src/empathy-sanity-cleaning.c @@ -38,7 +38,7 @@ * If the number stored in gsettings is lower than it, all the tasks will * be executed. */ -#define SANITY_CLEANING_NUMBER 1 +#define SANITY_CLEANING_NUMBER 2 static void account_update_parameters_cb (GObject *source, @@ -101,11 +101,52 @@ fix_xmpp_account_priority (TpAccountManager *am) } static void +set_facebook_account_fallback_server (TpAccountManager *am) +{ + GList *accounts, *l; + + accounts = tp_account_manager_get_valid_accounts (am); + for (l = accounts; l != NULL; l = g_list_next (l)) + { + TpAccount *account = l->data; + GHashTable *params; + gchar *fallback_servers[] = { + "chat.facebook.com:443", + NULL }; + + if (tp_strdiff (tp_account_get_service (account), "facebook")) + continue; + + params = (GHashTable *) tp_account_get_parameters (account); + if (params == NULL) + continue; + + if (tp_asv_get_strv (params, "fallback-servers") != NULL) + continue; + + DEBUG ("Setting chat.facebook.com:443 as a fallback on account '%s'", + tp_account_get_path_suffix (account)); + + params = tp_asv_new ( + "fallback-servers", G_TYPE_STRV, fallback_servers, + NULL); + + tp_account_update_parameters_async (account, params, NULL, + account_update_parameters_cb, NULL); + + g_hash_table_unref (params); + } + + g_list_free (accounts); +} + +static void run_sanity_cleaning_tasks (TpAccountManager *am) { DEBUG ("Starting sanity cleaning tasks"); fix_xmpp_account_priority (am); + set_facebook_account_fallback_server (am); } static void |