aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
authorfiaxh <git@mx.ax.lt>2017-11-21 22:17:04 +0100
committerfiaxh <git@mx.ax.lt>2017-11-22 00:32:11 +0100
commitf3063f56b7e2ccfef255256d5bf527988fcf2957 (patch)
tree6d7ddb4fd5a8ae65ca431f575fe1b1157559f45e /libdino/src
parentebf8d7ab01bd9df03c3a9fda0f0e2c5da228c8ce (diff)
downloaddino-f3063f56b7e2ccfef255256d5bf527988fcf2957.tar.gz
dino-f3063f56b7e2ccfef255256d5bf527988fcf2957.zip
ConversationView: Split merged messages when an in-between one is added
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/message_storage.vala11
1 files changed, 10 insertions, 1 deletions
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<Message>((a, b) => { return a.local_time.compare(b.local_time); });
+ messages[conversation] = new Gee.TreeSet<Message>((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<Message> db_messages = db.get_messages(conversation.counterpart, conversation.account, Util.get_message_type_for_conversation(conversation), 50, null);
messages[conversation].add_all(db_messages);
}