aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Gorcester <andrewsg@u.washington.edu>2010-03-29 23:33:32 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-29 23:33:32 +0800
commitc3d5568a05b65ec18ff7ff6012be6420340bebab (patch)
tree4b105eea184df3a2e0920d687e91606f80bad2e1 /src
parentc3057afe0d6ffddc4b7223fab51751473dfb1a1f (diff)
downloadgsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar.gz
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar.bz2
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar.lz
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar.xz
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.tar.zst
gsoc2013-empathy-c3d5568a05b65ec18ff7ff6012be6420340bebab.zip
new-chatroom-dialog: filter CM not implementing groupchat
Diffstat (limited to 'src')
-rw-r--r--src/empathy-new-chatroom-dialog.c46
1 files changed, 45 insertions, 1 deletions
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index a2f3b4be9..d12a9b0a1 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -32,6 +32,8 @@
#include <glib/gi18n.h>
#include <glib/gprintf.h>
+#include <telepathy-glib/interfaces.h>
+
#include <libempathy/empathy-tp-roomlist.h>
#include <libempathy/empathy-chatroom.h>
#include <libempathy/empathy-utils.h>
@@ -131,6 +133,48 @@ static void new_chatroom_dialog_button_close_error_clicked_cb (GtkButton
static EmpathyNewChatroomDialog *dialog_p = NULL;
+/**
+ * empathy_account_chooser_filter_supports_multichat:
+ * @account: a #TpAccount
+ * @user_data: user data or %NULL
+ *
+ * An #EmpathyAccountChooserFilterFunc that returns accounts that both
+ * support multiuser text chat and are connected.
+ *
+ * Return value: TRUE if @account both supports muc and is connected
+ */
+static gboolean
+empathy_account_chooser_filter_supports_multichat (TpAccount *account,
+ gpointer user_data)
+{
+ TpConnection *connection;
+ EmpathyDispatcher *dispatcher;
+ GList *classes;
+
+ if (tp_account_get_connection_status (account, NULL) !=
+ TP_CONNECTION_STATUS_CONNECTED)
+ return FALSE;
+
+ /* check if CM supports multiuser text chat */
+ connection = tp_account_get_connection (account);
+ if (connection == NULL)
+ return FALSE;
+
+ dispatcher = empathy_dispatcher_dup_singleton ();
+
+ classes = empathy_dispatcher_find_requestable_channel_classes
+ (dispatcher, connection, TP_IFACE_CHANNEL_TYPE_TEXT,
+ TP_HANDLE_TYPE_ROOM, NULL);
+
+ g_object_unref (dispatcher);
+
+ if (classes == NULL)
+ return FALSE;
+
+ g_list_free (classes);
+ return TRUE;
+}
+
void
empathy_new_chatroom_dialog_show (GtkWindow *parent)
{
@@ -202,7 +246,7 @@ empathy_new_chatroom_dialog_show (GtkWindow *parent)
/* Account chooser for custom */
dialog->account_chooser = empathy_account_chooser_new ();
empathy_account_chooser_set_filter (EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser),
- empathy_account_chooser_filter_is_connected,
+ empathy_account_chooser_filter_supports_multichat,
NULL);
gtk_table_attach_defaults (GTK_TABLE (dialog->table_info),
dialog->account_chooser,