From 837de4063dbe398735a5b1d35bde1821c177b555 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 11 May 2019 09:39:02 -0600 Subject: OMEMO: Move files to fitting subdirectory --- plugins/omemo/src/pre_key_store.vala | 45 ------------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 plugins/omemo/src/pre_key_store.vala (limited to 'plugins/omemo/src/pre_key_store.vala') diff --git a/plugins/omemo/src/pre_key_store.vala b/plugins/omemo/src/pre_key_store.vala deleted file mode 100644 index 716fd32f..00000000 --- a/plugins/omemo/src/pre_key_store.vala +++ /dev/null @@ -1,45 +0,0 @@ -using Signal; -using Qlite; - -namespace Dino.Plugins.Omemo { - -private class BackedPreKeyStore : SimplePreKeyStore { - private Database db; - private int identity_id; - - public BackedPreKeyStore(Database db, int identity_id) { - this.db = db; - this.identity_id = identity_id; - init(); - } - - private void init() { - try { - foreach (Row row in db.pre_key.select().with(db.pre_key.identity_id, "=", identity_id)) { - store_pre_key(row[db.pre_key.pre_key_id], Base64.decode(row[db.pre_key.record_base64])); - } - } catch (Error e) { - warning("Error while initializing pre key store: %s", e.message); - } - - pre_key_stored.connect(on_pre_key_stored); - pre_key_deleted.connect(on_pre_key_deleted); - } - - public void on_pre_key_stored(PreKeyStore.Key key) { - db.pre_key.insert().or("REPLACE") - .value(db.pre_key.identity_id, identity_id) - .value(db.pre_key.pre_key_id, (int) key.key_id) - .value(db.pre_key.record_base64, Base64.encode(key.record)) - .perform(); - } - - public void on_pre_key_deleted(PreKeyStore.Key key) { - db.pre_key.delete() - .with(db.pre_key.identity_id, "=", identity_id) - .with(db.pre_key.pre_key_id, "=", (int) key.key_id) - .perform(); - } -} - -} -- cgit v1.2.3-70-g09d2