[telepathy-doc/master] Ensure channels we want

Davyd Madeley davyd at madeley.id.au
Wed Apr 1 00:46:22 PDT 2009


---
 docs/examples/glib_get_roster/example.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/docs/examples/glib_get_roster/example.c b/docs/examples/glib_get_roster/example.c
index bcd0fe8..8bcdcce 100644
--- a/docs/examples/glib_get_roster/example.c
+++ b/docs/examples/glib_get_roster/example.c
@@ -127,6 +127,29 @@ conn_ready (TpConnection	*conn,
 				conn, new_channels_cb,
 				NULL, NULL, NULL, &error);
 		handle_error (error);
+
+		/* explicitly ask for the publish and subscribe contact lists
+		 * these will be announced by NewChannels, so we don't need
+		 * to handle their callbacks (this does mean we also can't
+		 * handle their errors) */
+		GHashTable *request = tp_asv_new (
+			TP_IFACE_CHANNEL ".ChannelType", G_TYPE_STRING, TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
+			TP_IFACE_CHANNEL ".TargetHandleType", TP_TYPE_HANDLE, TP_HANDLE_TYPE_LIST,
+			NULL);
+
+		/* the 'publish' list */
+		tp_asv_set_string (request,
+			TP_IFACE_CHANNEL ".TargetID", "publish");
+		tp_cli_connection_interface_requests_call_ensure_channel (
+				conn, -1, request, NULL, NULL, NULL, NULL);
+
+		/* the 'subscribe' list */
+		tp_asv_set_string (request,
+			TP_IFACE_CHANNEL ".TargetID", "subscribe");
+		tp_cli_connection_interface_requests_call_ensure_channel (
+				conn, -1, request, NULL, NULL, NULL, NULL);
+
+		g_hash_table_destroy (request);
 	}
 }
 
-- 
1.5.6.5




More information about the telepathy-commits mailing list