[empathy] Don't request roomlist channel if not supported (#614002)



commit 5c93e102dc5ac20a01a805e1f8bfc5d1986fedb0
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Mar 26 12:52:47 2010 +0100

    Don't request roomlist channel if not supported (#614002)

 src/empathy-new-chatroom-dialog.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index d12a9b0..d4302dc 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -482,6 +482,8 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 	EmpathyAccountChooser *account_chooser;
 	gboolean               listing = FALSE;
 	gboolean               expanded = FALSE;
+	TpConnection          *connection;
+	EmpathyDispatcher     *dispatcher;
 
 	if (dialog->room_list) {
 		g_object_unref (dialog->room_list);
@@ -498,13 +500,24 @@ new_chatroom_dialog_account_changed_cb (GtkComboBox             *combobox,
 
 	account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
 	dialog->account = empathy_account_chooser_dup_account (account_chooser);
+	connection = empathy_account_chooser_get_connection (account_chooser);
 	if (dialog->account == NULL)
 		goto out;
 
 	dialog->status_changed_id = g_signal_connect (dialog->account,
 		      "status-changed", G_CALLBACK (account_status_changed_cb), dialog);
 
-	dialog->room_list = empathy_tp_roomlist_new (dialog->account);
+	dispatcher = empathy_dispatcher_dup_singleton ();
+
+	if (connection != NULL &&
+	    empathy_dispatcher_find_requestable_channel_classes (dispatcher,
+		connection, TP_IFACE_CHANNEL_TYPE_ROOM_LIST,
+		TP_HANDLE_TYPE_NONE, NULL) != NULL) {
+		/* Roomlist channels are supported */
+		dialog->room_list = empathy_tp_roomlist_new (dialog->account);
+	}
+
+	g_object_unref (dispatcher);
 
 	if (dialog->room_list) {
 		g_signal_connect (dialog->room_list, "destroy",



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]