telepathy-logger: Preserve the original order of messages

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


Module: telepathy-logger
Branch: master
Commit: 5eaf8c99748b3d4e61afaba24ff6bf763f81695d
URL:    http://cgit.freedesktop.org/telepathy/telepathy-logger/commit/?id=5eaf8c99748b3d4e61afaba24ff6bf763f81695d

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

Preserve the original order of messages

---

 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 8712cd5..ddb8e8e 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -519,6 +519,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