From e2932af18f31d8457c3d72ba9d3b80d912934c7f Mon Sep 17 00:00:00 2001 From: Samuel Hand Date: Sun, 12 Aug 2018 11:04:40 +0100 Subject: Index consistently with the identity id --- plugins/omemo/src/database.vala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'plugins/omemo/src/database.vala') 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 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 { -- cgit v1.2.3-54-g00ecf