aboutsummaryrefslogtreecommitdiff
path: root/plugins/omemo/src/session_store.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-05-11 09:39:02 -0600
committerfiaxh <git@lightrise.org>2019-07-08 18:46:30 +0200
commit837de4063dbe398735a5b1d35bde1821c177b555 (patch)
tree81c46027a32a9ff14f2c4932260ac97d3574b848 /plugins/omemo/src/session_store.vala
parent701175fcd3b39aff46f52627af74b4de29363058 (diff)
downloaddino-837de4063dbe398735a5b1d35bde1821c177b555.tar.gz
dino-837de4063dbe398735a5b1d35bde1821c177b555.zip
OMEMO: Move files to fitting subdirectory
Diffstat (limited to 'plugins/omemo/src/session_store.vala')
-rw-r--r--plugins/omemo/src/session_store.vala49
1 files changed, 0 insertions, 49 deletions
diff --git a/plugins/omemo/src/session_store.vala b/plugins/omemo/src/session_store.vala
deleted file mode 100644
index 654591d1..00000000
--- a/plugins/omemo/src/session_store.vala
+++ /dev/null
@@ -1,49 +0,0 @@
-using Signal;
-using Qlite;
-
-namespace Dino.Plugins.Omemo {
-
-private class BackedSessionStore : SimpleSessionStore {
- private Database db;
- private int identity_id;
-
- public BackedSessionStore(Database db, int identity_id) {
- this.db = db;
- this.identity_id = identity_id;
- init();
- }
-
- private void init() {
- try {
- foreach (Row row in db.session.select().with(db.session.identity_id, "=", identity_id)) {
- Address addr = new Address(row[db.session.address_name], row[db.session.device_id]);
- store_session(addr, Base64.decode(row[db.session.record_base64]));
- addr.device_id = 0;
- }
- } catch (Error e) {
- print("Error while initializing session store: %s", e.message);
- }
-
- session_stored.connect(on_session_stored);
- session_removed.connect(on_session_deleted);
- }
-
- public void on_session_stored(SessionStore.Session session) {
- db.session.insert().or("REPLACE")
- .value(db.session.identity_id, identity_id)
- .value(db.session.address_name, session.name)
- .value(db.session.device_id, session.device_id)
- .value(db.session.record_base64, Base64.encode(session.record))
- .perform();
- }
-
- public void on_session_deleted(SessionStore.Session session) {
- db.session.delete()
- .with(db.session.identity_id, "=", identity_id)
- .with(db.session.address_name, "=", session.name)
- .with(db.session.device_id, "=", session.device_id)
- .perform();
- }
-}
-
-}