]> git.0d.be Git - empathy.git/blobdiff - libempathy/empathy-tp-contact-list.c
Extract protocol from the connection's object-path and correctly set the special...
[empathy.git] / libempathy / empathy-tp-contact-list.c
index 4937f56570b0b9c6b1232378a6dcd33bcdfcee86..636f2ed3f89b3c1bd7095f9799b36e7f9836cf20 100644 (file)
@@ -292,7 +292,7 @@ tp_contact_list_group_request_handles_cb (TpConnection *connection,
                return;
        }
 
-       data->channel_handle = g_array_index (handles, TpHandle, 1);
+       data->channel_handle = g_array_index (handles, TpHandle, 0);
        data->ref_count++;
        tp_cli_connection_call_request_channel (connection, -1,
                                                TP_IFACE_CHANNEL_TYPE_CONTACT_LIST,
@@ -614,9 +614,11 @@ tp_contact_list_new_channel_cb (TpConnection *proxy,
                                gpointer      user_data,
                                GObject      *list)
 {
-       tp_contact_list_group_add_channel (EMPATHY_TP_CONTACT_LIST (list),
-                                          object_path, channel_type,
-                                          handle_type, handle);
+       if (!suppress_handler) {
+               tp_contact_list_group_add_channel (EMPATHY_TP_CONTACT_LIST (list),
+                                                  object_path, channel_type,
+                                                  handle_type, handle);
+       }
 }
 
 static void
@@ -698,9 +700,11 @@ tp_contact_list_constructed (GObject *list)
 {
 
        EmpathyTpContactListPriv *priv = GET_PRIV (list);
-       const gchar              *protocol_name = NULL;
+       gchar                    *protocol_name = NULL;
        const gchar              *names[] = {NULL, NULL};
 
+       priv->factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
+
        names[0] = "publish";
        tp_cli_connection_call_request_handles (priv->connection,
                                                -1,
@@ -730,11 +734,13 @@ tp_contact_list_constructed (GObject *list)
 
        /* Check for protocols that does not support contact groups. We can
         * put all contacts into a special group in that case.
-        * FIXME: Default group should be an information in the profile */
-       //protocol_name = tp_connection_get_protocol (priv->connection);
-       if (!tp_strdiff (protocol_name, "local-xmpp") == 0) {
+        * FIXME: Default group should be an information in the profile
+        * FIXME: replace with tp_connection_parse_object_path once released */
+       protocol_name = empathy_connection_get_protocol (priv->connection, NULL);
+       if (!tp_strdiff (protocol_name, "local-xmpp")) {
                priv->protocol_group = _("People nearby");
        }
+       g_free (protocol_name);
 }
 
 static void
@@ -802,7 +808,6 @@ empathy_tp_contact_list_init (EmpathyTpContactList *list)
                EMPATHY_TYPE_TP_CONTACT_LIST, EmpathyTpContactListPriv);
 
        list->priv = priv;
-       priv->factory = empathy_tp_contact_factory_dup_singleton (priv->connection);
 
        /* Map group's name to group's channel */
        priv->groups = g_hash_table_new_full (g_str_hash, g_str_equal,