changeset 1d4888f206b1 in /home/hg/repos/gajim-plugins
author: Bahtiar `kalkin-` Gadimov <[email protected]>
branches:
details:gajim-plugins?cmd=changeset;node=1d4888f206b1
description: Disable OMEMO if dependencies are missing - #9
diffstat:
omemo/__init__.py | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diffs (38 lines):
diff -r ec4b8b0e70fe -r 1d4888f206b1 omemo/__init__.py
--- a/omemo/__init__.py Mon Jan 04 21:34:05 2016 +0100
+++ b/omemo/__init__.py Sun Jan 10 16:51:11 2016 +0100
@@ -25,7 +25,6 @@
from plugins import GajimPlugin
from plugins.helpers import log_calls
-from .state import OmemoState
from .ui import Ui
from .xmpp import (
NS_NOTIFY, NS_OMEMO, BundleInformationAnnouncement, BundleInformationQuery,
@@ -34,7 +33,15 @@
iq_ids_to_callbacks = {}
+AXOLOTL_MISSING = 'Please install python-axolotl.'
+
log = logging.getLogger('gajim.plugin_system.omemo')
+try:
+ from .state import OmemoState
+ HAS_AXOLOTL = True
+except ImportError:
+ log.error(AXOLOTL_MISSING)
+ HAS_AXOLOTL = False
class OmemoPlugin(GajimPlugin):
@@ -45,6 +52,10 @@
@log_calls('OmemoPlugin')
def init(self):
+ if not HAS_AXOLOTL:
+ self.activatable = False
+ self.available_text = _(AXOLOTL_MISSING)
+ return
self.events_handlers = {
'message-received': (ged.PRECORE, self.message_received),
'pep-received': (ged.PRECORE, self.handle_device_list_update),
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits