[telepathy-logger-0.8] telepathy-logger: Preserve the original order of messages

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Aug 1 18:54:04 UTC 2024


Module: telepathy-logger
Branch: telepathy-logger-0.8
Commit: 4865edde7d3bb74c2870d54ef23bf888c4dcb350
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=4865edde7d3bb74c2870d54ef23bf888c4dcb350

Author: Daniel Landau <daniel at landau.fi>
Date:   Sun Jan 29 19:37:07 2017 +0200

Preserve the original order of messages

(cherry picked from commit 5eaf8c99748b3d4e61afaba24ff6bf763f81695d)

---

 telepathy-logger/text-channel.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c
index 546bce4..cd8355b 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -525,6 +525,15 @@ store_pending_messages (TplTextChannel *self)
     {
       GList *it;
 
+      /* The list in pending_messages was ordered by arrival
+       * (pending_message_id), then it was prepended to to_log one by one, so
+       * we need te reverse it to get back the original order.
+       */
+      to_log = g_list_reverse (to_log);
+      /* Sort by time stamp in case the messages arrive in a messed up order.
+       * g_list_sort is stable, so messages that arrive at the same time stamp
+       * (e.g. from a bouncer) will not lose their original order.
+       */
       to_log = g_list_sort (to_log,
           (GCompareFunc) pending_message_compare_timestamp);
 



More information about the telepathy-commits mailing list