diff options
author | fiaxh <git@lightrise.org> | 2020-04-29 21:31:23 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2020-06-03 21:50:40 +0200 |
commit | 71be2abb6a007fd9b4ed3164d70f5cb95d49ce69 (patch) | |
tree | f4dcdb63e08ce6dc0e4933e30e18cec27c604719 /libdino/src/entity/conversation.vala | |
parent | b5066e0e2f4b482204f43402c797d8bf9f7ef582 (diff) | |
download | dino-71be2abb6a007fd9b4ed3164d70f5cb95d49ce69.tar.gz dino-71be2abb6a007fd9b4ed3164d70f5cb95d49ce69.zip |
Store last read content item for conversations
fixes #495
Diffstat (limited to 'libdino/src/entity/conversation.vala')
-rw-r--r-- | libdino/src/entity/conversation.vala | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala index 47ebd5d8..800a28a2 100644 --- a/libdino/src/entity/conversation.vala +++ b/libdino/src/entity/conversation.vala @@ -34,6 +34,7 @@ public class Conversation : Object { } public Encryption encryption { get; set; default = Encryption.NONE; } public Message? read_up_to { get; set; } + public int read_up_to_item { get; set; default=-1; } public enum NotifySetting { DEFAULT, ON, OFF, HIGHLIGHT } public NotifySetting notify_setting { get; set; default = NotifySetting.DEFAULT; } @@ -67,6 +68,7 @@ public class Conversation : Object { encryption = (Encryption) row[db.conversation.encryption]; int? read_up_to = row[db.conversation.read_up_to]; if (read_up_to != null) this.read_up_to = db.get_message_by_id(read_up_to); + read_up_to_item = row[db.conversation.read_up_to_item]; notify_setting = (NotifySetting) row[db.conversation.notification]; send_typing = (Setting) row[db.conversation.send_typing]; send_marker = (Setting) row[db.conversation.send_marker]; @@ -88,6 +90,9 @@ public class Conversation : Object { if (read_up_to != null) { insert.value(db.conversation.read_up_to, read_up_to.id); } + if (read_up_to_item != -1) { + insert.value(db.conversation.read_up_to_item, read_up_to_item); + } if (nickname != null) { insert.value(db.conversation.resource, nickname); } @@ -161,6 +166,13 @@ public class Conversation : Object { update.set_null(db.conversation.read_up_to); } break; + case "read-up-to-item": + if (read_up_to_item != -1) { + update.set(db.conversation.read_up_to_item, read_up_to_item); + } else { + update.set_null(db.conversation.read_up_to_item); + } + break; case "nickname": update.set(db.conversation.resource, nickname); break; case "active": |