]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-chat.c
Merge branch 'sasl'
[empathy.git] / libempathy / empathy-tp-chat.c
index 6f4874fc86cb3c293f50d9912660867605461de5..f1351049aedf8809d421fce0834a63eeb8514ba9 100644 (file)
@@ -30,7 +30,6 @@
 #include "empathy-tp-chat.h"
 #include "empathy-tp-contact-factory.h"
 #include "empathy-contact-list.h"
-#include "empathy-dispatcher.h"
 #include "empathy-marshal.h"
 #include "empathy-time.h"
 #include "empathy-utils.h"
@@ -155,13 +154,13 @@ tp_chat_add (EmpathyContactList *list,
                object_path = tp_proxy_get_object_path (priv->channel);
 
                props = tp_asv_new (
-                   TP_IFACE_CHANNEL ".ChannelType", G_TYPE_STRING,
+                   TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
                        TP_IFACE_CHANNEL_TYPE_TEXT,
-                   TP_IFACE_CHANNEL ".TargetHandleType", G_TYPE_UINT,
+                   TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
                        TP_HANDLE_TYPE_NONE,
-                   EMP_IFACE_CHANNEL_INTERFACE_CONFERENCE ".InitialChannels",
+                   TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS,
                        TP_ARRAY_TYPE_OBJECT_PATH_LIST, &channels,
-                   EMP_IFACE_CHANNEL_INTERFACE_CONFERENCE ".InitialInviteeIDs",
+                   TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_INVITEE_IDS,
                        G_TYPE_STRV, invitees,
                    /* FIXME: InvitationMessage ? */
                    NULL);
@@ -907,7 +906,7 @@ tp_chat_update_remote_contact (EmpathyTpChat *chat)
         * have the group interface. If it has the conference interface, then
         * it is indeed a MUC. */
        if (tp_proxy_has_interface_by_id (priv->channel,
-                                         EMP_IFACE_QUARK_CHANNEL_INTERFACE_CONFERENCE)) {
+                                         TP_IFACE_QUARK_CHANNEL_INTERFACE_CONFERENCE)) {
                return;
        }
 
@@ -1119,8 +1118,11 @@ tp_chat_group_members_changed_cb (TpChannel     *self,
        /* Contact renamed */
        if (reason == TP_CHANNEL_GROUP_CHANGE_REASON_RENAMED) {
                /* there can only be a single 'added' and a single 'removed' handle */
-               g_warn_if_fail (removed->len == 1);
-               g_warn_if_fail (added->len == 1);
+               if (removed->len != 1 || added->len != 1) {
+                       g_warning ("RENAMED with %u added, %u removed (expected 1, 1)",
+                               added->len, removed->len);
+                       return;
+               }
 
                old_handle = g_array_index (removed, guint, 0);
 
@@ -1269,6 +1271,9 @@ tp_chat_constructor (GType                  type,
                          G_CALLBACK (tp_chat_invalidated_cb),
                          chat, 0);
 
+       g_assert (tp_proxy_is_prepared (priv->connection,
+               TP_CONNECTION_FEATURE_CAPABILITIES));
+
        if (tp_proxy_has_interface_by_id (priv->channel,
                                          TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP)) {
                const TpIntSet *members;
@@ -1292,8 +1297,9 @@ tp_chat_constructor (GType                  type,
                tp_g_signal_connect_object (priv->channel, "group-members-changed",
                        G_CALLBACK (tp_chat_group_members_changed_cb), chat, 0);
        } else {
-               EmpathyDispatcher *dispatcher = empathy_dispatcher_dup_singleton ();
-               GList *list, *ptr;
+               TpCapabilities *caps;
+               GPtrArray *classes;
+               guint i;
 
                /* Get the self contact from the connection's self handle */
                handle = tp_connection_get_self_handle (priv->connection);
@@ -1307,24 +1313,21 @@ tp_chat_constructor (GType                  type,
                        handle, tp_chat_got_remote_contact_cb,
                        NULL, NULL, chat);
 
-               list = empathy_dispatcher_find_requestable_channel_classes (
-                       dispatcher, priv->connection,
-                       tp_channel_get_channel_type (priv->channel),
-                       TP_UNKNOWN_HANDLE_TYPE, NULL);
+               caps = tp_connection_get_capabilities (priv->connection);
+               g_assert (caps != NULL);
 
-               for (ptr = list; ptr; ptr = ptr->next) {
-                       GValueArray *array = ptr->data;
+               classes = tp_capabilities_get_channel_classes (caps);
+
+               for (i = 0; i < classes->len; i++) {
+                       GValueArray *array = g_ptr_array_index (classes, i);
                        const char **oprops = g_value_get_boxed (
                                g_value_array_get_nth (array, 1));
 
-                       if (tp_strv_contains (oprops, EMP_IFACE_CHANNEL_INTERFACE_CONFERENCE ".InitialChannels")) {
+                       if (tp_strv_contains (oprops, TP_PROP_CHANNEL_INTERFACE_CONFERENCE_INITIAL_CHANNELS)) {
                                priv->can_upgrade_to_muc = TRUE;
                                break;
                        }
                }
-
-               g_list_free (list);
-               g_object_unref (dispatcher);
        }
 
        if (tp_proxy_has_interface_by_id (priv->channel,