From f3063f56b7e2ccfef255256d5bf527988fcf2957 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Tue, 21 Nov 2017 22:17:04 +0100 Subject: ConversationView: Split merged messages when an in-between one is added --- libdino/src/service/message_storage.vala | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libdino/src') diff --git a/libdino/src/service/message_storage.vala b/libdino/src/service/message_storage.vala index 97873972..f4691971 100644 --- a/libdino/src/service/message_storage.vala +++ b/libdino/src/service/message_storage.vala @@ -64,7 +64,16 @@ public class MessageStorage : StreamInteractionModule, Object { private void init_conversation(Conversation conversation) { if (!messages.has_key(conversation)) { - messages[conversation] = new Gee.TreeSet((a, b) => { return a.local_time.compare(b.local_time); }); + messages[conversation] = new Gee.TreeSet((a, b) => { + int res = a.local_time.compare(b.local_time); + if (res == 0) { + res = a.time.compare(b.time); + } + if (res == 0) { + res = a.id - b.id > 0 ? 1 : -1; + } + return res; + }); Gee.List db_messages = db.get_messages(conversation.counterpart, conversation.account, Util.get_message_type_for_conversation(conversation), 50, null); messages[conversation].add_all(db_messages); } -- cgit v1.2.3-70-g09d2