- bus_name = dbus_g_proxy_get_bus_name (DBUS_G_PROXY (priv->tp_conn));
- new_chan = tp_chan_new (tp_get_bus (),
- bus_name,
- object_path,
- channel_type,
- handle_type,
- channel_handle);
- g_return_if_fail (TELEPATHY_IS_CHAN (new_chan));
-
- group = empathy_tp_group_new (priv->account, new_chan);
- g_object_unref (new_chan);
-
- if (handle_type == TP_HANDLE_TYPE_LIST) {
- TpContactListType list_type;
- GList *contacts, *l;
-
- list_type = tp_contact_list_get_type (list, group);
- if (list_type == TP_CONTACT_LIST_TYPE_PUBLISH && !priv->publish) {
- priv->publish = group;
-
- /* Publish is the list of contacts to who we send our
- * presence. Makes no sense to be in remote-pending */
- g_signal_connect (group, "local-pending",
- G_CALLBACK (tp_contact_list_pending_cb),
- list);
-
- contacts = empathy_tp_group_get_local_pendings (group);
- for (l = contacts; l; l = l->next) {
- EmpathyPendingInfo *info = l->data;
-
- tp_contact_list_pending_cb (group,
- info->member,
- info->actor,
- 0,
- info->message,
- list);
- empathy_pending_info_free (info);
- }
- g_list_free (contacts);
- }
- else if (list_type == TP_CONTACT_LIST_TYPE_SUBSCRIBE && !priv->subscribe) {
- priv->subscribe = group;
-
- /* Subscribe is the list of contacts from who we
- * receive presence. Makes no sense to be in
- * local-pending */
- g_signal_connect (group, "remote-pending",
- G_CALLBACK (tp_contact_list_pending_cb),
- list);
-
- contacts = empathy_tp_group_get_remote_pendings (group);
- for (l = contacts; l; l = l->next) {
- tp_contact_list_pending_cb (group,
- l->data,
- NULL, 0,
- NULL, list);
- g_object_unref (l->data);
- }
- g_list_free (contacts);
- } else {
- empathy_debug (DEBUG_DOMAIN,
- "Type of contact list channel unknown "
- "or aleady have that list: %s",
- empathy_tp_group_get_name (group));
- g_object_unref (group);
- return;
- }
- empathy_debug (DEBUG_DOMAIN,
- "New contact list channel of type: %d",
- list_type);
-
- g_signal_connect (group, "member-added",
- G_CALLBACK (tp_contact_list_added_cb),
- list);
- g_signal_connect (group, "member-removed",
- G_CALLBACK (tp_contact_list_removed_cb),
- list);
-
- contacts = empathy_tp_group_get_members (group);
- for (l = contacts; l; l = l->next) {
- tp_contact_list_added_cb (group,
- l->data,
- NULL, 0, NULL,
- list);
- g_object_unref (l->data);
- }
- g_list_free (contacts);
- }
- else if (handle_type == TP_HANDLE_TYPE_GROUP) {
- const gchar *group_name;
- GList *contacts, *l;