-static void
-empathy_new_message_account_filter (EmpathyContactSelectorDialog *dialog,
- EmpathyAccountChooserFilterResultCallback callback,
- gpointer callback_data,
- TpAccount *account)
-{
- TpConnection *connection;
- gboolean supported = FALSE;
- TpCapabilities *caps;
-
- /* check if CM supports 1-1 text chat */
- connection = tp_account_get_connection (account);
- if (connection == NULL)
- goto out;
-
- caps = tp_connection_get_capabilities (connection);
- if (caps == NULL)
- goto out;
-
- supported = tp_capabilities_supports_text_chats (caps);
-
-out:
- callback (supported, callback_data);
-}
-
-static void
-empathy_new_message_dialog_update_sms_button_sensitivity (GtkWidget *widget,
- GParamSpec *pspec,
- GtkWidget *button)
-{
- GtkWidget *self = gtk_widget_get_toplevel (widget);
- EmpathyContactSelectorDialog *dialog;
- TpConnection *conn;
- GPtrArray *rccs;
- gboolean sensitive = FALSE;
- guint i;
-
- g_return_if_fail (EMPATHY_IS_NEW_MESSAGE_DIALOG (self));
-
- dialog = EMPATHY_CONTACT_SELECTOR_DIALOG (self);
-
- /* if the Text widget isn't sensitive, don't bother checking the caps */
- if (!gtk_widget_get_sensitive (dialog->button_action))
- goto finally;
-
- empathy_contact_selector_dialog_get_selected (dialog, &conn, NULL);
-
- if (conn == NULL)
- goto finally;
-
- /* iterate the rccs to find if SMS channels are supported, this should
- * be in tp-glib */
- rccs = tp_capabilities_get_channel_classes (
- tp_connection_get_capabilities (conn));
-
- for (i = 0; i < rccs->len; i++)
- {
- GHashTable *fixed;
- GStrv allowed;
- const char *type;
- gboolean sms_channel;
-
- tp_value_array_unpack (g_ptr_array_index (rccs, i), 2,
- &fixed,
- &allowed);
-
- /* SMS channels are type:Text and sms-channel:True */
- type = tp_asv_get_string (fixed, TP_PROP_CHANNEL_CHANNEL_TYPE);
- sms_channel = tp_asv_get_boolean (fixed,
- TP_PROP_CHANNEL_INTERFACE_SMS_SMS_CHANNEL, NULL);
-
- sensitive = sms_channel &&
- !tp_strdiff (type, TP_IFACE_CHANNEL_TYPE_TEXT);
-
- if (sensitive)
- break;
- }
-
-finally:
- gtk_widget_set_sensitive (button, sensitive);
-}
-