changeset ac571cc010ff in /home/hg/repos/gajim-plugins

author: Bahtiar `kalkin-` Gadimov <[email protected]>
branches: 
details:gajim-plugins?cmd=changeset;node=ac571cc010ff
description: Fix sqlite db intialization

diffstat:

 omemo/__init__.py |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (32 lines):

diff -r de81e637127d -r ac571cc010ff omemo/__init__.py
--- a/omemo/__init__.py Wed Jan 13 20:32:50 2016 +0100
+++ b/omemo/__init__.py Wed Jan 13 20:46:44 2016 +0100
@@ -19,6 +19,8 @@
 #
 
 import logging
+import os
+import sqlite3
 
 from common import caps_cache, gajim, ged
 from common.pep import SUPPORTED_PERSONAL_USER_EVENTS
@@ -43,6 +45,8 @@
     log.error(AXOLOTL_MISSING)
     HAS_AXOLOTL = False
 
+DB_DIR = gajim.gajimpaths.data_root
+
 
 class OmemoPlugin(GajimPlugin):
 
@@ -75,7 +79,9 @@
             OmemoState if it does not exist yet.
         """
         if account not in self.omemo_states:
-            self.omemo_states[account] = OmemoState(account)
+            db_path = os.path.join(DB_DIR, 'omemo_' + account + '.db')
+            conn = sqlite3.connect(db_path, check_same_thread=False)
+            self.omemo_states[account] = OmemoState(conn)
         return self.omemo_states[account]
 
     @log_calls('OmemoPlugin')
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to