aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-chat.c
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-03-06 19:52:32 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-06 19:52:32 +0800
commit604f532b51f8eff981045a4414d17ae9e4bee403 (patch)
tree883c37a2cca056e734c23faa607bb0dbd20fafff /libempathy-gtk/empathy-chat.c
parent37e09159559c1246ac7770b7f96ea9611acf2b5b (diff)
downloadgsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar.gz
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar.bz2
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar.lz
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar.xz
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.tar.zst
gsoc2013-empathy-604f532b51f8eff981045a4414d17ae9e4bee403.zip
EmpathyChat: Remove messages from log messages which are pending.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=2600
Diffstat (limited to 'libempathy-gtk/empathy-chat.c')
-rw-r--r--libempathy-gtk/empathy-chat.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 34550965b..1e06ab2ba 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -1031,9 +1031,10 @@ chat_add_logs (EmpathyChat *chat)
{
EmpathyChatPriv *priv = GET_PRIV (chat);
gboolean is_chatroom;
- GList *messages, *l;
+ GList *messages, *l, *c;
guint num_messages;
guint i;
+ const GList *pending_messages, *m;
if (!priv->id) {
return;
@@ -1048,6 +1049,27 @@ chat_add_logs (EmpathyChat *chat)
priv->account,
priv->id,
is_chatroom);
+
+ pending_messages = empathy_tp_chat_get_pending_messages (priv->tp_chat);
+
+ /* Remove messages that are pending */
+ c = g_list_copy (messages);
+ for (l = messages; l; l = l->next) {
+ for (m = pending_messages; m; m = m->next) {
+ if (empathy_message_equal (l->data, m->data)) {
+ EmpathyMessage *message;
+
+ message = l->data;
+ c = g_list_remove (c, message);
+ g_object_unref (message);
+ break;
+ }
+ }
+ }
+
+ g_list_free (messages);
+ messages = c;
+
num_messages = g_list_length (messages);
/* Only keep the 10 last messages */