From 6641404defe9bf9aafd946c178d99b96f9a6edbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maxime=20=E2=80=9Cpep=E2=80=9D=20Buquet?= Date: Thu, 31 Jan 2019 11:21:54 +0100 Subject: [PATCH] xep_0384: rework passing in storage class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous way wasn't allowing passing classes with different parameters. Signed-off-by: Maxime “pep” Buquet --- plugin.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin.py b/plugin.py index 0bd0597..34b172f 100644 --- a/plugin.py +++ b/plugin.py @@ -130,7 +130,7 @@ class XEP_0384(BasePlugin): dependencies = {'xep_0163'} default_config = { 'data_dir': None, - 'storage_backend': JSONFileStorage, + 'storage_backend': None, 'otpk_policy': DefaultOTPKPolicy, 'omemo_backend': SignalBackend, } @@ -148,7 +148,10 @@ class XEP_0384(BasePlugin): "specified") return None - storage = self.storage_backend(self.data_dir) + storage = self.storage_backend + if self.storage_backend is None: + storage = JSONFileStorage(self.data_dir) + otpkpolicy = self.otpk_policy() bare_jid = self.xmpp.boundjid.bare self._device_id = _load_device_id(self.data_dir)