[telepathy-doc/master] A bit more on room listing

Davyd Madeley davyd at madeley.id.au
Thu Apr 9 18:38:03 PDT 2009


---
 docs/book/C/channel.xml                      |   16 +++++++++++++++-
 docs/examples/glib_jabber_muc/example.c      |   18 ++++++++++++++++++
 docs/examples/python_irc_roomlist/example.py |    2 ++
 3 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/docs/book/C/channel.xml b/docs/book/C/channel.xml
index 08842ac..eaf9e23 100644
--- a/docs/book/C/channel.xml
+++ b/docs/book/C/channel.xml
@@ -1039,6 +1039,14 @@
     <xref linkend="example.channel.roomlist.requestglib"/> shows a code
     example.
    </para>
+
+   <note>
+    <para>
+     You can discover the default conferencing server by omitting the
+     <property>Server</property> property and then reading the value on
+     the newly created channel.
+    </para>
+   </note>
     
    <example id="example.channel.roomlist.examplemap">
     <title>Example Maps For Requesting a Room List</title>
@@ -1091,7 +1099,8 @@
     It can take some time for the information on the available rooms to be
     collected, thus the room list is returned via the
     <methodname>GotRooms</methodname> signal. Clients should connect this
-    signal before calling <methodname>ListRooms</methodname>.
+    signal before calling <methodname>ListRooms</methodname>. See
+    <xref linkend="example.channel.roomlist.listrooms"/>.
    </para>
 
    <para>
@@ -1165,6 +1174,11 @@
      </tgroup>
     </informaltable>
 
+    <example id="example.channel.roomlist.listrooms"
+             file="python_irc_roomlist/example.py">
+     <title>ListRooms</title>
+    </example>
+
   </sect1>
 
 </chapter>
diff --git a/docs/examples/glib_jabber_muc/example.c b/docs/examples/glib_jabber_muc/example.c
index 2b4cb0f..300be2a 100644
--- a/docs/examples/glib_jabber_muc/example.c
+++ b/docs/examples/glib_jabber_muc/example.c
@@ -4,6 +4,7 @@
 
 #include <telepathy-glib/connection-manager.h>
 #include <telepathy-glib/connection.h>
+#include <telepathy-glib/channel.h>
 #include <telepathy-glib/interfaces.h>
 #include <telepathy-glib/gtypes.h>
 #include <telepathy-glib/util.h>
@@ -78,6 +79,14 @@ get_channels_cb (TpProxy	*proxy,
 }
 
 static void
+roomlist_channel_ready (TpChannel	*channel,
+		        const GError	*in_error,
+			gpointer	 user_data)
+{
+	handle_error (in_error);
+}
+
+static void
 create_roomlist_cb (TpConnection	*conn,
 		    const char		*object_path,
 		    GHashTable		*props,
@@ -86,8 +95,16 @@ create_roomlist_cb (TpConnection	*conn,
 		    GObject		*weak_obj)
 {
 	handle_error (in_error);
+	GError *error = NULL;
 
 	g_print (" > create_roomlist_cb (%s)\n", object_path);
+
+	TpChannel *channel = tp_channel_new_from_properties (conn,
+			object_path, props, &error);
+	handle_error (error);
+
+	tp_channel_call_when_ready (channel, roomlist_channel_ready, NULL);
+	tp_asv_dump (props);
 }
 
 static void
@@ -209,6 +226,7 @@ cm_ready (TpConnectionManager	*cm,
 			"password", G_TYPE_STRING, password,
 			"require-encryption", G_TYPE_BOOLEAN, TRUE,
 			"ignore-ssl-errors", G_TYPE_BOOLEAN, TRUE,
+			"fallback-conference-server", G_TYPE_STRING, "conference.collabora.co.uk",
 			NULL);
 
 	tp_cli_connection_manager_call_request_connection (cm, -1,
diff --git a/docs/examples/python_irc_roomlist/example.py b/docs/examples/python_irc_roomlist/example.py
index 0e1ec9d..361369d 100755
--- a/docs/examples/python_irc_roomlist/example.py
+++ b/docs/examples/python_irc_roomlist/example.py
@@ -87,6 +87,7 @@ class Example(object):
                                                  reply_handler = self.got_roomlist,
                                                  error_handler = self.error)
 
+    # begin example.channel.roomlist.listrooms
     def got_roomlist(self, channel_path):
         print 'Got Roomlist Channel'
         channel = telepathy.client.Channel(self.conn.service_name, channel_path)
@@ -109,6 +110,7 @@ class Example(object):
             # close the room list channel
             channel[CHANNEL].Close(reply_handler = generic_handler,
                                    error_handler = self.error)
+    # end example.channel.roomlist.listrooms
 
     def error(self, error):
         print 'Error:', error
-- 
1.5.6.5




More information about the telepathy-commits mailing list