aboutsummaryrefslogtreecommitdiff
path: root/libdino/src/entity
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2024-05-26 17:28:28 +0200
committerfiaxh <git@lightrise.org>2024-05-26 17:28:28 +0200
commitf1be90c02f26c942e67978fd6d10ff2feeec8f9e (patch)
tree2c3ad321b92350ecb69d2ee33e187bc410ab2c9d /libdino/src/entity
parentfe45ab575c687febc1f342b0882a7597bd6ae9dc (diff)
downloaddino-f1be90c02f26c942e67978fd6d10ff2feeec8f9e.tar.gz
dino-f1be90c02f26c942e67978fd6d10ff2feeec8f9e.zip
Add logic for OMEMO by default setting
Diffstat (limited to 'libdino/src/entity')
-rw-r--r--libdino/src/entity/conversation.vala2
-rw-r--r--libdino/src/entity/settings.vala18
2 files changed, 19 insertions, 1 deletions
diff --git a/libdino/src/entity/conversation.vala b/libdino/src/entity/conversation.vala
index 353daeae..4115ae83 100644
--- a/libdino/src/entity/conversation.vala
+++ b/libdino/src/entity/conversation.vala
@@ -33,7 +33,7 @@ public class Conversation : Object {
}
}
}
- public Encryption encryption { get; set; default = Encryption.NONE; }
+ public Encryption encryption { get; set; default = Encryption.UNKNOWN; }
public Message? read_up_to { get; set; }
public int read_up_to_item { get; set; default=-1; }
diff --git a/libdino/src/entity/settings.vala b/libdino/src/entity/settings.vala
index 0b09e9b9..be275efc 100644
--- a/libdino/src/entity/settings.vala
+++ b/libdino/src/entity/settings.vala
@@ -79,6 +79,24 @@ public class Settings : Object {
check_spelling_ = value;
}
}
+
+ public Encryption get_default_encryption(Account account) {
+ string? setting = db.account_settings.get_value(account.id, "default-encryption");
+ if (setting != null) {
+ return (Encryption) int.parse(setting);
+ }
+ return Encryption.NONE;
+ }
+
+ public void set_default_encryption(Account account, Encryption encryption) {
+ db.account_settings.upsert()
+ .value(db.account_settings.key, "default-encryption", true)
+ .value(db.account_settings.account_id, account.id, true)
+ .value(db.account_settings.value, ((int)encryption).to_string())
+ .perform();
+
+
+ }
}
}