[Pkg-telepathy-commits] [telepathy-glib-1] 201/212: TpBaseContactList: only implement Blocking1 if we can_block()

Simon McVittie smcv at debian.org
Wed May 14 12:09:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian
in repository telepathy-glib-1.

commit 4f087c183930ca215e0406ca9c6ecef65a7cc073
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Tue Apr 22 11:50:39 2014 +0100

    TpBaseContactList: only implement Blocking1 if we can_block()
    
    This is what Gabble wants - a core-only XMPP server can't block contacts,
    so we need to perform feature discovery before we can say whether we
    can block anyone.
    
    We now provide two opportunities to implement Blocking1. The one used in
    telepathy-glib's own regression tests is appropriate for a proprietary
    protocol where there is only one deployed server, so either there's a
    way to block contacts, or there isn't - in this case, we can start
    implementing the interface as soon as the Connection is constructed.
    The second opportunity is used by Gabble, and is the last possible
    chance to say Blocking1 is implemented, just before StatusChanged
    is emitted on D-Bus.
    
    Reviewed-by: Xavier Claessens <xavier.claessens at collabora.com>
    Bug: https://bugs.freedesktop.org/show_bug.cgi?id=77189
---
 telepathy-glib/base-contact-list.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/telepathy-glib/base-contact-list.c b/telepathy-glib/base-contact-list.c
index 6ab8663..ec7ef1c 100644
--- a/telepathy-glib/base-contact-list.c
+++ b/telepathy-glib/base-contact-list.c
@@ -483,6 +483,8 @@ enum {
     N_PROPS
 };
 
+static void _tp_base_contact_list_implement_contact_blocking (
+    TpBaseContactList *self);
 static void
 tp_base_contact_list_contacts_changed_internal (TpBaseContactList *self,
     TpHandleSet *changed, TpHandleSet *removed, gboolean is_initial_roster);
@@ -646,6 +648,10 @@ status_changed_cb (TpBaseConnection *conn,
     {
       update_immutable_contact_list_properties (self);
       update_immutable_contact_groups_properties (self);
+
+      /* last chance to implement blocking */
+      if (tp_base_contact_list_can_block (self))
+        _tp_base_contact_list_implement_contact_blocking (self);
     }
   else if (status == TP_CONNECTION_STATUS_DISCONNECTED)
     {
@@ -657,8 +663,6 @@ static void _tp_base_contact_list_implement_contact_list (
     TpBaseContactList *self);
 static void _tp_base_contact_list_implement_contact_groups (
     TpBaseContactList *self);
-static void _tp_base_contact_list_implement_contact_blocking (
-    TpBaseContactList *self);
 
 static void
 tp_base_contact_list_constructed (GObject *object)
@@ -716,7 +720,10 @@ tp_base_contact_list_constructed (GObject *object)
       g_return_if_fail (iface->unblock_contacts_async != NULL);
       g_return_if_fail (iface->unblock_contacts_finish != NULL);
 
-      _tp_base_contact_list_implement_contact_blocking (self);
+      /* maybe we implement blocking unconditionally? if so,
+       * no need to wait until status-changed */
+      if (tp_base_contact_list_can_block (self))
+        _tp_base_contact_list_implement_contact_blocking (self);
     }
 
   self->priv->contact_repo = tp_base_connection_get_handles (self->priv->conn,
@@ -4928,6 +4935,9 @@ _tp_base_contact_list_implement_contact_blocking (TpBaseContactList *self)
   TpBlockableContactListInterface *iface;
   guint flags = 0;
 
+  if (self->priv->contact_blocking_skeleton != NULL)
+    return;
+
   self->priv->contact_blocking_skeleton =
       _tp_gdbus_connection_interface_contact_blocking1_skeleton_new ();
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-telepathy/telepathy-glib-1.git



More information about the Pkg-telepathy-commits mailing list