diff options
-rw-r--r-- | telepathy-logger/text-channel.c | 9 |
1 files changed, 9 insertions, 0 deletions
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); |