diff options
author | fiaxh <git@lightrise.org> | 2023-01-11 19:54:02 +0100 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2023-01-11 19:54:02 +0100 |
commit | 75500dc767f2cf657c0fbb5d2a4d4557183ed2e9 (patch) | |
tree | 87f67a933f0459f966932531b427944bb9f67a1f /libdino | |
parent | cb3b19b01deb8460627578b885339e7528411f6f (diff) | |
download | dino-75500dc767f2cf657c0fbb5d2a4d4557183ed2e9.tar.gz dino-75500dc767f2cf657c0fbb5d2a4d4557183ed2e9.zip |
Support pinning of conversations (locally)
fixes #290
fixes #1330
Diffstat (limited to 'libdino')
-rw-r--r-- | libdino/src/entity/conversation.vala | 9 | ||||
-rw-r--r-- | libdino/src/service/database.vala | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala index 9376dca9..353daeae 100644 --- a/libdino/src/entity/conversation.vala +++ b/libdino/src/entity/conversation.vala @@ -42,9 +42,10 @@ public class Conversation : Object { public enum Setting { DEFAULT, ON, OFF } public Setting send_typing { get; set; default = Setting.DEFAULT; } - public Setting send_marker { get; set; default = Setting.DEFAULT; } + public int pinned { get; set; default = 0; } + private Database? db; public Conversation(Jid jid, Account account, Type type) { @@ -74,6 +75,7 @@ public class Conversation : Object { notify_setting = (NotifySetting) row[db.conversation.notification]; send_typing = (Setting) row[db.conversation.send_typing]; send_marker = (Setting) row[db.conversation.send_marker]; + pinned = row[db.conversation.pinned]; notify.connect(on_update); } @@ -91,7 +93,8 @@ public class Conversation : Object { .value(db.conversation.active_last_changed, (long) active_last_changed.to_unix()) .value(db.conversation.notification, notify_setting) .value(db.conversation.send_typing, send_typing) - .value(db.conversation.send_marker, send_marker); + .value(db.conversation.send_marker, send_marker) + .value(db.conversation.pinned, pinned); if (read_up_to != null) { insert.value(db.conversation.read_up_to, read_up_to.id); } @@ -197,6 +200,8 @@ public class Conversation : Object { update.set(db.conversation.send_typing, send_typing); break; case "send-marker": update.set(db.conversation.send_marker, send_marker); break; + case "pinned": + update.set(db.conversation.pinned, pinned); break; } update.perform(); } diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala index bfd85f06..96b3b82d 100644 --- a/libdino/src/service/database.vala +++ b/libdino/src/service/database.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino { public class Database : Qlite.Database { - private const int VERSION = 24; + private const int VERSION = 25; public class AccountTable : Table { public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true }; @@ -244,10 +244,11 @@ public class Database : Qlite.Database { public Column<int> notification = new Column.Integer("notification") { min_version=3 }; public Column<int> send_typing = new Column.Integer("send_typing") { min_version=3 }; public Column<int> send_marker = new Column.Integer("send_marker") { min_version=3 }; + public Column<int> pinned = new Column.Integer("pinned") { default="0", min_version=25 }; internal ConversationTable(Database db) { base(db, "conversation"); - init({id, account_id, jid_id, resource, active, active_last_changed, last_active, type_, encryption, read_up_to, read_up_to_item, notification, send_typing, send_marker}); + init({id, account_id, jid_id, resource, active, active_last_changed, last_active, type_, encryption, read_up_to, read_up_to_item, notification, send_typing, send_marker, pinned}); } } |