]> git.0d.be Git - empathy.git/commitdiff
chat: don't display pending messages before messages from logs
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 8 Dec 2009 14:56:38 +0000 (14:56 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 8 Dec 2009 15:02:34 +0000 (15:02 +0000)
empathy_chat_set_tp_chat has a comment saying that show_pending_messages is a
no-op when calling during object construction. This now is now actually true
as we added a boolean saying if we can display pending messages or not.

This is to avoid displaying pending messages *before* the messages fetched
from logs (#603980).

libempathy-gtk/empathy-chat.c

index e627a5ef8f1caaa22f89f22091c794ee10292caf..dec4757dbb2f0bec5d001dd8849f06a658dd4853 100644 (file)
@@ -95,6 +95,9 @@ typedef struct {
        GtkWidget         *info_bar_vbox;
 
        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;
 } EmpathyChatPriv;
 
 typedef struct {
@@ -2014,6 +2017,9 @@ show_pending_messages (EmpathyChat *chat) {
        if (chat->view == NULL || priv->tp_chat == NULL)
                return;
 
+       if (!priv->can_show_pending)
+               return;
+
        messages = empathy_tp_chat_get_pending_messages (priv->tp_chat);
 
        for (l = messages; l != NULL ; l = g_list_next (l)) {
@@ -2242,6 +2248,7 @@ chat_constructed (GObject *object)
 
        if (priv->handle_type != TP_HANDLE_TYPE_ROOM)
                chat_add_logs (chat);
+       priv->can_show_pending = TRUE;
        show_pending_messages (chat);
 }