diff options
author | Will Thompson <will.thompson@collabora.co.uk> | 2009-08-23 01:24:13 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-09-17 16:41:00 +0800 |
commit | 7eb816f6c5ce610f767a40f387f0b4aef2a6e153 (patch) | |
tree | 23349546842067a3e52bd959ba07c418ba277b54 /libempathy | |
parent | 8dfca8c1e51261928a12bcf62014927ebd279206 (diff) | |
download | gsoc2013-empathy-7eb816f6c5ce610f767a40f387f0b4aef2a6e153.tar.gz gsoc2013-empathy-7eb816f6c5ce610f767a40f387f0b4aef2a6e153.tar.zst gsoc2013-empathy-7eb816f6c5ce610f767a40f387f0b4aef2a6e153.zip |
Get rid of the last two _run_ calls in Empathy
Hooray! Also, don't try to get known avatar tokens or capabilities if
the CM doesn't support them. This reduces the outrageous Debug spam
when I connect to a Haze account or (worse) a big IRC channel.
Fixes Gnome bug #532737
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-tp-contact-factory.c | 60 |
1 files changed, 29 insertions, 31 deletions
diff --git a/libempathy/empathy-tp-contact-factory.c b/libempathy/empathy-tp-contact-factory.c index c990b92f4..20e3f70a0 100644 --- a/libempathy/empathy-tp-contact-factory.c +++ b/libempathy/empathy-tp-contact-factory.c @@ -258,10 +258,13 @@ tp_contact_factory_avatar_tokens_foreach (gpointer key, } static void -tp_contact_factory_got_known_avatar_tokens (EmpathyTpContactFactory *tp_factory, - GHashTable *tokens, - const GError *error) +tp_contact_factory_got_known_avatar_tokens (TpConnection *connection, + GHashTable *tokens, + const GError *error, + gpointer user_data, + GObject *weak_object) { + EmpathyTpContactFactory *tp_factory = EMPATHY_TP_CONTACT_FACTORY (weak_object); EmpathyTpContactFactoryPriv *priv = GET_PRIV (tp_factory); TokensData data; @@ -290,7 +293,6 @@ tp_contact_factory_got_known_avatar_tokens (EmpathyTpContactFactory *tp_factory, } g_array_free (data.handles, TRUE); - g_hash_table_destroy (tokens); } static void @@ -360,12 +362,17 @@ tp_contact_factory_update_capabilities (EmpathyTpContactFactory *tp_factory, } static void -tp_contact_factory_got_capabilities (EmpathyTpContactFactory *tp_factory, - GPtrArray *capabilities, - const GError *error) +tp_contact_factory_got_capabilities (TpConnection *connection, + const GPtrArray *capabilities, + const GError *error, + gpointer user_data, + GObject *weak_object) { + EmpathyTpContactFactory *tp_factory; guint i; + tp_factory = EMPATHY_TP_CONTACT_FACTORY (weak_object); + if (error) { DEBUG ("Error: %s", error->message); /* FIXME Should set the capabilities of the contacts for which this request @@ -391,11 +398,7 @@ tp_contact_factory_got_capabilities (EmpathyTpContactFactory *tp_factory, channel_type, generic, specific); - - g_value_array_free (values); } - - g_ptr_array_free (capabilities, TRUE); } #if HAVE_GEOCLUE @@ -740,9 +743,6 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory, TpHandle self_handle; TpHandle handle; GArray handles = {(gchar *) &handle, 1}; - GHashTable *tokens; - GPtrArray *capabilities; - GError *error = NULL; EmpathyCapabilities caps; /* Keep a weak ref to that contact */ @@ -778,23 +778,21 @@ tp_contact_factory_add_contact (EmpathyTpContactFactory *tp_factory, empathy_contact_set_is_user (contact, self_handle == handle); /* FIXME: This should be done by TpContact */ - tp_cli_connection_interface_avatars_run_get_known_avatar_tokens (priv->connection, - -1, - &handles, - &tokens, - &error, - NULL); - tp_contact_factory_got_known_avatar_tokens (tp_factory, tokens, error); - g_clear_error (&error); - - tp_cli_connection_interface_capabilities_run_get_capabilities (priv->connection, - -1, - &handles, - &capabilities, - &error, - NULL); - tp_contact_factory_got_capabilities (tp_factory, capabilities, error); - g_clear_error (&error); + if (tp_proxy_has_interface_by_id (priv->connection, + TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS)) { + tp_cli_connection_interface_avatars_call_get_known_avatar_tokens ( + priv->connection, -1, &handles, + tp_contact_factory_got_known_avatar_tokens, NULL, NULL, + G_OBJECT (tp_factory)); + } + + if (tp_proxy_has_interface_by_id (priv->connection, + TP_IFACE_QUARK_CONNECTION_INTERFACE_CAPABILITIES)) { + tp_cli_connection_interface_capabilities_call_get_capabilities ( + priv->connection, -1, &handles, + tp_contact_factory_got_capabilities, NULL, NULL, + G_OBJECT (tp_factory)); + } if (tp_proxy_has_interface_by_id (TP_PROXY (priv->connection), TP_IFACE_QUARK_CONNECTION_INTERFACE_LOCATION)) { |