From dacb0076e08ee09f59f3b260e124d46608d5094b Mon Sep 17 00:00:00 2001 From: Daniel Landau Date: Sun, 29 Jan 2017 19:37:07 +0200 Subject: [PATCH] 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..4cc120a 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, no + * 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); -- 2.11.0