[next] telepathy-glib: TpContact does not always request avatar

Xavier Claessens xclaesse at kemper.freedesktop.org
Fri May 11 08:49:42 PDT 2012


Module: telepathy-glib
Branch: next
Commit: 22a4438161874e36e27282bd3d24a909f4b16f70
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=22a4438161874e36e27282bd3d24a909f4b16f70

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Fri May 11 14:08:03 2012 +0200

TpContact does not always request avatar

If AVATAR_TOKEN was already prepared and we upgrade to have AVATAR_DATA,
the avatar won't be requested

---

 telepathy-glib/contact.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index 6211cd2..9166888 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -3560,16 +3560,21 @@ contacts_context_queue_features (ContactsContext *context)
 #endif
     }
 
-  if (!contacts_context_supports_iface (context,
+  if ((feature_flags & CONTACT_FEATURE_FLAG_AVATAR_TOKEN) != 0 &&
+      !contacts_context_supports_iface (context,
         TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS) &&
       tp_proxy_has_interface_by_id (context->connection,
         TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS))
     {
-      if ((feature_flags & CONTACT_FEATURE_FLAG_AVATAR_TOKEN) != 0)
-        g_queue_push_tail (&context->todo, contacts_get_avatar_tokens);
+      g_queue_push_tail (&context->todo, contacts_get_avatar_tokens);
+    }
 
-      if ((feature_flags & CONTACT_FEATURE_FLAG_AVATAR_DATA) != 0)
-        g_queue_push_tail (&context->todo, contacts_get_avatar_data);
+  /* There is no contact attribute for avatar data, always use slow path */
+  if ((feature_flags & CONTACT_FEATURE_FLAG_AVATAR_DATA) != 0 &&
+      tp_proxy_has_interface_by_id (context->connection,
+        TP_IFACE_QUARK_CONNECTION_INTERFACE_AVATARS))
+    {
+      g_queue_push_tail (&context->todo, contacts_get_avatar_data);
     }
 
   if ((feature_flags & CONTACT_FEATURE_FLAG_LOCATION) != 0 &&
@@ -3669,12 +3674,6 @@ tp_contact_set_attributes (TpContact *contact,
         }
     }
 
-  /* There is no attribute for avatar data. If we want it, let's just
-   * pretend it is ready. If avatar is in cache, that will be true as
-   * soon as the token is set from attributes */
-  if (wanted & CONTACT_FEATURE_FLAG_AVATAR_DATA)
-    contact->priv->has_features |= CONTACT_FEATURE_FLAG_AVATAR_DATA;
-
   if (wanted & CONTACT_FEATURE_FLAG_AVATAR_TOKEN)
     {
       s = tp_asv_get_string (asv,



More information about the telepathy-commits mailing list