diff options
author | Samuel Hand <samuel.hand@openmailbox.org> | 2018-08-12 11:04:40 +0100 |
---|---|---|
committer | Samuel Hand <samuel.hand@openmailbox.org> | 2018-08-12 11:04:40 +0100 |
commit | e2932af18f31d8457c3d72ba9d3b80d912934c7f (patch) | |
tree | d0ce9dd2bd0e73fb090da8674431938e7c91fb7a /plugins/omemo/src/database.vala | |
parent | b589275ab46d42584bfc99edfa2054e9c8841ccc (diff) | |
download | dino-e2932af18f31d8457c3d72ba9d3b80d912934c7f.tar.gz dino-e2932af18f31d8457c3d72ba9d3b80d912934c7f.zip |
Index consistently with the identity id
Diffstat (limited to 'plugins/omemo/src/database.vala')
-rw-r--r-- | plugins/omemo/src/database.vala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/omemo/src/database.vala b/plugins/omemo/src/database.vala index 8f8cb44a..0b15d198 100644 --- a/plugins/omemo/src/database.vala +++ b/plugins/omemo/src/database.vala @@ -43,7 +43,7 @@ public class Database : Qlite.Database { } public void insert_device_list(int32 identity_id, string address_name, ArrayList<int32> devices) { - update().with(this.address_name, "=", address_name).set(now_active, false).perform(); + update().with(this.identity_id, "=", identity_id).with(this.address_name, "=", address_name).set(now_active, false).perform(); foreach (int32 device_id in devices) { upsert() .value(this.identity_id, identity_id, true) @@ -124,6 +124,13 @@ public class Database : Qlite.Database { base(db, "identity"); init({id, account_id, device_id, identity_key_private_base64, identity_key_public_base64}); } + + public int get_id(int account_id) { + int id = -1; + Row? row = this.row_with(this.account_id, account_id).inner; + if (row != null) id = ((!)row)[this.id]; + return id; + } } public class SignedPreKeyTable : Table { |