[telepathy-gabble/master] Tell CapChannelManagers that their caps are going to be reset

Sjoerd Simons sjoerd.simons at collabora.co.uk
Tue Dec 29 05:34:48 PST 2009


---
 src/caps-channel-manager.c |   14 ++++++++++++++
 src/caps-channel-manager.h |    7 +++++++
 src/connection.c           |   11 +++++++++++
 3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/src/caps-channel-manager.c b/src/caps-channel-manager.c
index 7ec98b5..c0f3241 100644
--- a/src/caps-channel-manager.c
+++ b/src/caps-channel-manager.c
@@ -59,6 +59,20 @@ gabble_caps_channel_manager_get_type (void)
 }
 
 /* Virtual-method wrappers */
+void
+gabble_caps_channel_manager_reset_capabilities (
+    GabbleCapsChannelManager *caps_manager)
+{
+  GabbleCapsChannelManagerIface *iface =
+    GABBLE_CAPS_CHANNEL_MANAGER_GET_INTERFACE (caps_manager);
+  GabbleCapsChannelManagerResetCapsFunc method = iface->reset_caps;
+
+  if (method != NULL)
+    {
+      method (caps_manager);
+    }
+  /* ... else assume there is no need to rest the  caps */
+}
 
 void
 gabble_caps_channel_manager_get_contact_capabilities (
diff --git a/src/caps-channel-manager.h b/src/caps-channel-manager.h
index 8ebcd87..821bb6b 100644
--- a/src/caps-channel-manager.h
+++ b/src/caps-channel-manager.h
@@ -60,6 +60,9 @@ typedef void (*GabbleCapsChannelManagerGetContactCapsFunc) (
     const GabbleCapabilitySet *caps,
     GPtrArray *arr);
 
+typedef void (*GabbleCapsChannelManagerResetCapsFunc) (
+    GabbleCapsChannelManager *manager);
+
 typedef void (*GabbleCapsChannelManagerAddCapFunc) (
     GabbleCapsChannelManager *manager,
     GHashTable *cap,
@@ -72,6 +75,9 @@ typedef void (*GabbleCapsChannelManagerRepresentClientFunc) (
     const gchar * const *cap_tokens,
     GabbleCapabilitySet *cap_set);
 
+void gabble_caps_channel_manager_reset_capabilities (
+    GabbleCapsChannelManager *caps_manager);
+
 void gabble_caps_channel_manager_get_contact_capabilities (
     GabbleCapsChannelManager *caps_manager,
     TpHandle handle,
@@ -88,6 +94,7 @@ void gabble_caps_channel_manager_represent_client (
 struct _GabbleCapsChannelManagerIface {
     GTypeInterface parent;
 
+    GabbleCapsChannelManagerResetCapsFunc reset_caps;
     GabbleCapsChannelManagerGetContactCapsFunc get_contact_caps;
     GabbleCapsChannelManagerRepresentClientFunc represent_client;
 
diff --git a/src/connection.c b/src/connection.c
index 1d91a45..803c2a5 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -2730,6 +2730,17 @@ gabble_connection_update_capabilities (
    * advertising spurious caps in initial presence */
   gabble_capability_set_clear (self->priv->bonus_caps);
 
+  tp_base_connection_channel_manager_iter_init (&iter, base);
+
+  while (tp_base_connection_channel_manager_iter_next (&iter, &manager))
+    {
+      /* all channel managers must implement the capability interface */
+      g_assert (GABBLE_IS_CAPS_CHANNEL_MANAGER (manager));
+
+      gabble_caps_channel_manager_reset_capabilities (
+          GABBLE_CAPS_CHANNEL_MANAGER (manager));
+    }
+
   DEBUG ("enter");
 
   for (i = 0; i < clients->len; i++)
-- 
1.5.6.5




More information about the telepathy-commits mailing list