[Telepathy-commits] [telepathy-gabble/master] Implement EnsureChannel for room lists; test that it works

Will Thompson will.thompson at collabora.co.uk
Thu Sep 25 10:03:25 PDT 2008


---
 src/roomlist-manager.c        |   11 +++++++++++
 tests/twisted/muc/roomlist.py |   16 ++++++++++++++++
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/roomlist-manager.c b/src/roomlist-manager.c
index 826a546..e16627a 100644
--- a/src/roomlist-manager.c
+++ b/src/roomlist-manager.c
@@ -435,6 +435,16 @@ gabble_roomlist_manager_request_channel (TpChannelManager *manager,
 }
 
 
+static gboolean
+gabble_roomlist_manager_ensure_channel (TpChannelManager *manager,
+                                        gpointer request_token,
+                                        GHashTable *request_properties)
+{
+  return gabble_roomlist_manager_handle_request (manager, request_token,
+      request_properties, FALSE);
+}
+
+
 static void
 channel_manager_iface_init (gpointer g_iface,
                             gpointer iface_data)
@@ -445,4 +455,5 @@ channel_manager_iface_init (gpointer g_iface,
   iface->foreach_channel_class = gabble_roomlist_manager_foreach_channel_class;
   iface->request_channel = gabble_roomlist_manager_request_channel;
   iface->create_channel = gabble_roomlist_manager_create_channel;
+  iface->ensure_channel = gabble_roomlist_manager_ensure_channel;
 }
diff --git a/tests/twisted/muc/roomlist.py b/tests/twisted/muc/roomlist.py
index 5215c91..49a4112 100644
--- a/tests/twisted/muc/roomlist.py
+++ b/tests/twisted/muc/roomlist.py
@@ -165,6 +165,22 @@ def test(q, bus, conn, stream):
 
     # FIXME: actually list the rooms!
 
+
+    call_async(q, requestotron, 'EnsureChannel',
+            { tp_name_prefix + '.Channel.ChannelType':
+                tp_name_prefix + '.Channel.Type.RoomList',
+              tp_name_prefix + '.Channel.TargetHandleType': 0,
+              tp_name_prefix + '.Channel.Type.RoomList.Server':
+                'conference.example.net',
+              })
+
+    ret = q.expect('dbus-return', method='EnsureChannel')
+    yours, ensured_path, ensured_props = ret.value
+
+    assert not yours
+    assert ensured_path == path2, (ensured_path, path2)
+
+
     conn.Disconnect()
 
     q.expect_many(
-- 
1.5.6.5




More information about the Telepathy-commits mailing list