aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-16 20:00:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2009-12-17 18:38:50 +0800
commitc4ffa18abd28523741b079ab2913fcdff7f39865 (patch)
tree4277a9192a3f8365e9a82536b784a534e6ab8df3 /libempathy-gtk
parent0af3c68b4c8c9392174d780712f5d4a12d0e13e6 (diff)
downloadgsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar.gz
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar.bz2
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar.lz
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar.xz
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.tar.zst
gsoc2013-empathy-c4ffa18abd28523741b079ab2913fcdff7f39865.zip
new-call-dialog: filter out CM which doesn't support calls
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-new-call-dialog.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-new-call-dialog.c b/libempathy-gtk/empathy-new-call-dialog.c
index 2118c6710..67bfb589d 100644
--- a/libempathy-gtk/empathy-new-call-dialog.c
+++ b/libempathy-gtk/empathy-new-call-dialog.c
@@ -26,6 +26,8 @@
#include <gtk/gtk.h>
#include <glib/gi18n-lib.h>
+#include <telepathy-glib/interfaces.h>
+
#include <libempathy/empathy-tp-contact-factory.h>
#include <libempathy/empathy-contact-manager.h>
#include <libempathy/empathy-call-factory.h>
@@ -107,6 +109,38 @@ empathy_new_call_dialog_got_response (EmpathyContactSelectorDialog *dialog,
g_object_unref (factory);
}
+static gboolean
+empathy_new_call_dialog_account_filter (EmpathyContactSelectorDialog *dialog,
+ TpAccount *account)
+{
+ TpConnection *connection;
+ EmpathyDispatcher *dispatcher;
+ GList *classes;
+
+ if (tp_account_get_connection_status (account, NULL) !=
+ TP_CONNECTION_STATUS_CONNECTED)
+ return FALSE;
+
+ /* check if CM supports calls */
+ 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_STREAMED_MEDIA,
+ TP_HANDLE_TYPE_CONTACT, NULL);
+
+ g_object_unref (dispatcher);
+
+ if (classes == NULL)
+ return FALSE;
+
+ g_list_free (classes);
+ return TRUE;
+}
+
static GObject *
empathy_new_call_dialog_constructor (GType type,
guint n_props,
@@ -178,6 +212,7 @@ empathy_new_call_dialog_class_init (
object_class->constructor = empathy_new_call_dialog_constructor;
dialog_class->got_response = empathy_new_call_dialog_got_response;
+ dialog_class->account_filter = empathy_new_call_dialog_account_filter;
}
/**