[Telepathy-commits] [telepathy-gabble/master] claims buddies left their activities when the view is closed

Guillaume Desmottes guillaume.desmottes at collabora.co.uk
Fri Sep 26 10:02:39 PDT 2008


20080717083239-7fe3f-fb2de1d7956fc9f0560fde2562fb2159e9d154c5.gz
---
 src/olpc-view.c                            |   19 +++++++++++++++++++
 tests/twisted/olpc/olpc-activity-search.py |    9 +++++++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/src/olpc-view.c b/src/olpc-view.c
index fcd3130..bba8a4e 100644
--- a/src/olpc-view.c
+++ b/src/olpc-view.c
@@ -400,6 +400,21 @@ olpc_view_get_activities (GabbleSvcOLPCView *iface,
 }
 
 static void
+buddy_left_activities_foreach (TpHandleSet *set,
+                               TpHandle buddy,
+                               GabbleOlpcView *self)
+{
+  GabbleOlpcViewPrivate *priv = GABBLE_OLPC_VIEW_GET_PRIVATE (self);
+
+  /* Remove all the activity of this buddy */
+  if (!g_hash_table_remove (priv->buddy_rooms, GUINT_TO_POINTER (buddy)))
+    return;
+
+  g_signal_emit (G_OBJECT (self), signals[BUDDY_ACTIVITIES_CHANGED],
+      0, buddy);
+}
+
+static void
 olpc_view_close (GabbleSvcOLPCView *iface,
                  DBusGMethodInvocation *context)
 {
@@ -448,6 +463,10 @@ olpc_view_close (GabbleSvcOLPCView *iface,
 
   lm_message_unref (msg);
 
+  /* Claim that all the buddies left their activities */
+  tp_handle_set_foreach (priv->buddies,
+      (TpHandleSetMemberFunc) buddy_left_activities_foreach, self);
+
   g_signal_emit (G_OBJECT (self), signals[CLOSED], 0);
 }
 
diff --git a/tests/twisted/olpc/olpc-activity-search.py b/tests/twisted/olpc/olpc-activity-search.py
index 409234b..5f487b3 100644
--- a/tests/twisted/olpc/olpc-activity-search.py
+++ b/tests/twisted/olpc/olpc-activity-search.py
@@ -453,6 +453,15 @@ def test(q, bus, conn, stream):
     # close view 0
     close_view(q, view0_iface, '0')
 
+    # Jean and Fernand left activity4
+    q.expect_many(
+            EventPattern('dbus-signal', signal='ActivitiesChanged',
+                interface='org.laptop.Telepathy.BuddyInfo',
+                args=[handles['jean'], []]),
+            EventPattern('dbus-signal', signal='ActivitiesChanged',
+                interface='org.laptop.Telepathy.BuddyInfo',
+                args=[handles['fernand'], []]))
+
     # close view 1
     close_view(q, view1_iface, '1')
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list