aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-02-16 07:28:57 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-02-16 20:06:12 +0800
commitc4bd37aa901a9cd8c6cc716508416daa6ae58fbc (patch)
tree4902af34194624d565c12f13a72b4644dee5c87e /libempathy-gtk/empathy-chat.c
parent94539737998972571a33af133ae91b2769f7cd99 (diff)
downloadgsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar.gz
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar.bz2
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar.lz
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar.xz
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.tar.zst
gsoc2013-empathy-c4bd37aa901a9cd8c6cc716508416daa6ae58fbc.zip
Remove duplicate and buggy bookkeeping of pending messages
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c21
1 files changed, 7 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 4594d4d29..0b8460f02 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -96,7 +96,7 @@ typedef struct {
GtkWidget *info_bar_vbox;
GtkWidget *search_bar;
- GSList *pending_messages;
+ guint unread_messages;
/* TRUE if the pending messages can be displayed. This is to avoid to show
* pending messages *before* messages from logs. (#603980) */
gboolean can_show_pending;
@@ -1116,9 +1116,7 @@ chat_message_received (EmpathyChat *chat, EmpathyMessage *message)
TP_CHANNEL_CHAT_STATE_ACTIVE,
chat);
- priv->pending_messages = g_slist_prepend (priv->pending_messages,
- g_object_ref (message));
-
+ priv->unread_messages++;
g_signal_emit (chat, signals[NEW_MESSAGE], 0, message);
}
@@ -2934,9 +2932,9 @@ empathy_chat_get_nb_unread_messages (EmpathyChat *self)
{
EmpathyChatPriv *priv = GET_PRIV (self);
- g_return_val_if_fail (EMPATHY_IS_CHAT (self), FALSE);
+ g_return_val_if_fail (EMPATHY_IS_CHAT (self), 0);
- return g_slist_length (priv->pending_messages);
+ return priv->unread_messages;
}
/* called when the messages have been read by user */
@@ -2948,13 +2946,8 @@ empathy_chat_messages_read (EmpathyChat *self)
g_return_if_fail (EMPATHY_IS_CHAT (self));
if (priv->tp_chat != NULL) {
- empathy_tp_chat_acknowledge_messages (priv->tp_chat,
- priv->pending_messages);
+ empathy_tp_chat_acknowledge_all_messages (priv->tp_chat);
}
- /* ...else, we can't do any acknowledging because the channel (or
- * indeed connection) has gone away. */
-
- g_slist_foreach (priv->pending_messages, (GFunc) g_object_unref, NULL);
- g_slist_free (priv->pending_messages);
- priv->pending_messages = NULL;
+
+ priv->unread_messages = 0;
}