From 7c785000cc9a32d4ba1b641bbde7e5fcdf7f172e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= Date: Sat, 21 Apr 2018 16:30:48 +0200 Subject: [PATCH] [omemo] Remove old DB migration --- omemo/omemo_connection.py | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/omemo/omemo_connection.py b/omemo/omemo_connection.py index 213c845..dae77b5 100644 --- a/omemo/omemo_connection.py +++ b/omemo/omemo_connection.py @@ -11,6 +11,7 @@ from nbxmpp import JID from gajim.common import app from gajim.common import ged from gajim.common import helpers +from gajim.common import configpaths from gajim.common.connection_handlers_events import ( MessageReceivedEvent, MamMessageReceivedEvent, MessageNotSentEvent, MamGcMessageReceivedEvent) @@ -22,9 +23,6 @@ from omemo.xmpp import ( unpack_device_list_update, unpack_encrypted) from omemo.omemo.state import OmemoState -DB_DIR_OLD = app.gajimpaths.data_root -DB_DIR_NEW = app.gajimpaths['MY_DATA'] - ALLOWED_TAGS = [('request', nbxmpp.NS_RECEIPTS), ('active', nbxmpp.NS_CHATSTATES), ('gone', nbxmpp.NS_CHATSTATES), @@ -80,21 +78,6 @@ class OMEMOConnection: return self.get_con().get_own_jid().getStripped() return self.get_con().get_own_jid() - def migrate_dbpath(self): - old_dbpath = os.path.join(DB_DIR_OLD, 'omemo_' + self.account + '.db') - new_dbpath = os.path.join(DB_DIR_NEW, 'omemo_' + self.own_jid + '.db') - - if os.path.exists(old_dbpath): - log.debug('Migrating DBName and Path ..') - try: - shutil.move(old_dbpath, new_dbpath) - return new_dbpath - except Exception: - log.exception('Migration Error:') - return old_dbpath - - return new_dbpath - def __get_omemo(self): """ Returns the the OmemoState for the specified account. Creates the OmemoState if it does not exist yet. @@ -108,7 +91,8 @@ class OMEMOConnection: ------- OmemoState """ - db_path = self.migrate_dbpath() + data_dir = configpaths.get('MY_DATA') + db_path = os.path.join(data_dir, 'omemo_' + self.own_jid + '.db') conn = sqlite3.connect(db_path, check_same_thread=False) return OmemoState(self.own_jid, conn, self.account, self)