-static void
-tp_chat_member_added_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChat *chat)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
- guint handle_type = 0;
-
- if (priv->channel == NULL)
- return;
-
- priv->members_count++;
- g_signal_emit_by_name (chat, "members-changed",
- contact, actor, reason, message,
- TRUE);
-
- g_object_get (priv->channel, "handle-type", &handle_type, NULL);
- if (handle_type == TP_HANDLE_TYPE_ROOM) {
- return;
- }
-
- if (priv->members_count > 2 && priv->remote_contact) {
- /* We now have more than 2 members, this is not a p2p chat
- * anymore. Remove the remote-contact as it makes no sense, the
- * EmpathyContactList interface must be used now. */
- g_object_unref (priv->remote_contact);
- priv->remote_contact = NULL;
- g_object_notify (G_OBJECT (chat), "remote-contact");
- }
- if (priv->members_count <= 2 && !priv->remote_contact &&
- !empathy_contact_is_user (contact)) {
- /* This is a p2p chat, if it's not ourself that means this is
- * the remote contact with who we are chatting. This is to
- * avoid forcing the usage of the EmpathyContactList interface
- * for p2p chats. */
- priv->remote_contact = g_object_ref (contact);
- g_object_notify (G_OBJECT (chat), "remote-contact");
- }
-}
-
-static void
-tp_chat_member_removed_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChat *chat)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
- guint handle_type = 0;
-
- if (priv->channel == NULL)
- return;
-
- priv->members_count--;
- g_signal_emit_by_name (chat, "members-changed",
- contact, actor, reason, message,
- FALSE);
-
- g_object_get (priv->channel, "handle-type", &handle_type, NULL);
- if (handle_type == TP_HANDLE_TYPE_ROOM) {
- return;
- }
-
- if (priv->members_count <= 2 && !priv->remote_contact) {
- GList *members, *l;
-
- /* We are not a MUC anymore, get the remote contact back */
- members = empathy_tp_group_get_members (group);
- for (l = members; l; l = l->next) {
- if (!empathy_contact_is_user (l->data)) {
- priv->remote_contact = g_object_ref (l->data);
- g_object_notify (G_OBJECT (chat), "remote-contact");
- break;
- }
- }
- g_list_foreach (members, (GFunc) g_object_unref, NULL);
- g_list_free (members);
- }
-}
-
-static void
-tp_chat_local_pending_cb (EmpathyTpGroup *group,
- EmpathyContact *contact,
- EmpathyContact *actor,
- guint reason,
- const gchar *message,
- EmpathyTpChat *chat)
-{
- EmpathyTpChatPriv *priv = GET_PRIV (chat);
-
- if (priv->channel == NULL)
- return;
-
- g_signal_emit_by_name (chat, "pendings-changed",
- contact, actor, reason, message,
- TRUE);
-}
-