]> git.0d.be Git - empathy.git/commitdiff
Don't request roomlist channel if not supported (#614002)
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 26 Mar 2010 11:52:47 +0000 (12:52 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 30 Mar 2010 09:20:59 +0000 (11:20 +0200)
src/empathy-new-chatroom-dialog.c

index d12a9b0a1c26264343e6b7868c106a180aea8655..d4302dc555630b4645254bfcc34bc9d12ad72db5 100644 (file)
@@ -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",