aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-02-16 20:06:44 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2010-02-16 20:06:44 +0800
commit57f093617f28dea1a4d4ab948561579d3f623427 (patch)
tree28576bd3db56124d0afb618915d745161153fc60
parent4219fa9dd2a048563bd6684a0bfba08dd1629759 (diff)
parentc4bd37aa901a9cd8c6cc716508416daa6ae58fbc (diff)
downloadgsoc2013-empathy-57f093617f28dea1a4d4ab948561579d3f623427.tar.gz
gsoc2013-empathy-57f093617f28dea1a4d4ab948561579d3f623427.tar.zst
gsoc2013-empathy-57f093617f28dea1a4d4ab948561579d3f623427.zip
Merge branch 'ack-all'
-rw-r--r--libempathy-gtk/empathy-chat.c21
-rw-r--r--libempathy/empathy-tp-chat.c7
-rw-r--r--libempathy/empathy-tp-chat.h1
3 files changed, 15 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;
}
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index ea1c5ea62..65b4926c6 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1713,6 +1713,13 @@ empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat,
g_slist_free (msgs);
}
+void
+empathy_tp_chat_acknowledge_all_messages (EmpathyTpChat *chat)
+{
+ empathy_tp_chat_acknowledge_messages (chat,
+ (GSList *) empathy_tp_chat_get_pending_messages (chat));
+}
+
gboolean
empathy_tp_chat_password_needed (EmpathyTpChat *self)
{
diff --git a/libempathy/empathy-tp-chat.h b/libempathy/empathy-tp-chat.h
index f281e1dc1..f0a4caa87 100644
--- a/libempathy/empathy-tp-chat.h
+++ b/libempathy/empathy-tp-chat.h
@@ -85,6 +85,7 @@ void empathy_tp_chat_acknowledge_message (EmpathyTpChat *chat,
EmpathyMessage *message);
void empathy_tp_chat_acknowledge_messages (EmpathyTpChat *chat,
const GSList *messages);
+void empathy_tp_chat_acknowledge_all_messages (EmpathyTpChat *chat);
gboolean empathy_tp_chat_password_needed (EmpathyTpChat *chat);