From a92c3b945d26bf8080adcda3286fbd7cb48de125 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Thu, 17 Apr 2008 21:50:00 +0000 Subject: Always set urgency hint on p2p chat windows when receiving a message. svn path=/trunk/; revision=962 --- libempathy/empathy-tp-chat.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libempathy/empathy-tp-chat.c') diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index 07d59cd84..430014759 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -54,7 +54,7 @@ struct _EmpathyTpChatPriv { gboolean had_properties_list; GPtrArray *properties; gboolean ready; - guint nb_members; + guint members_count; }; typedef struct { @@ -124,8 +124,8 @@ tp_chat_member_added_cb (EmpathyTpGroup *group, { EmpathyTpChatPriv *priv = GET_PRIV (chat); - priv->nb_members++; - if (priv->nb_members > 2 && priv->remote_contact) { + priv->members_count++; + 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. */ @@ -133,7 +133,7 @@ tp_chat_member_added_cb (EmpathyTpGroup *group, priv->remote_contact = NULL; g_object_notify (G_OBJECT (chat), "remote-contact"); } - if (priv->nb_members <= 2 && !priv->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 @@ -158,8 +158,8 @@ tp_chat_member_removed_cb (EmpathyTpGroup *group, { EmpathyTpChatPriv *priv = GET_PRIV (chat); - priv->nb_members--; - if (priv->nb_members <= 2 && !priv->remote_contact) { + priv->members_count--; + if (priv->members_count <= 2 && !priv->remote_contact) { GList *members, *l; /* We are not a MUC anymore, get the remote contact back */ @@ -775,6 +775,8 @@ tp_chat_channel_ready_cb (EmpathyTpChat *chat) G_CALLBACK (tp_chat_local_pending_cb), chat); empathy_run_until_ready (priv->group); + } else { + priv->members_count = 2; } if (tp_proxy_has_interface_by_id (priv->channel, @@ -1146,6 +1148,16 @@ empathy_tp_chat_is_ready (EmpathyTpChat *chat) return priv->ready; } +guint +empathy_tp_chat_get_members_count (EmpathyTpChat *chat) +{ + EmpathyTpChatPriv *priv = GET_PRIV (chat); + + g_return_val_if_fail (EMPATHY_IS_TP_CHAT (chat), 0); + + return priv->members_count; +} + McAccount * empathy_tp_chat_get_account (EmpathyTpChat *chat) { -- cgit v1.2.3