diff --git a/gotr/manifest.ini b/gotr/manifest.ini index 7d0a04f85fdc71fc8db1eb6edd432291813be021..64246c545283f6490866ca9f550cfcf51752c393 100644 --- a/gotr/manifest.ini +++ b/gotr/manifest.ini @@ -1,7 +1,7 @@ [info] name: Off-The-Record Encryption short_name: gotr -version: 1.1 +version: 1.2 description: See http://www.cypherpunks.ca/otr/ authors: Kjell Braden <afflux.gajim@pentabarf.de> homepage: http://gajim-otr.pentabarf.de diff --git a/gotr/otrmodule.py b/gotr/otrmodule.py index a896a043b607eb97270c9917e6a8fd5a2b291a40..9823631eeb75e95a7a38854ae62648c89b1273ac 100644 --- a/gotr/otrmodule.py +++ b/gotr/otrmodule.py @@ -63,14 +63,17 @@ from common.connection_handlers_events import MessageOutgoingEvent from plugins import GajimPlugin from message_control import TYPE_CHAT, MessageControl from plugins.helpers import log_calls, log +from plugins.plugin import GajimPluginException import ui import pickle -import potr -if not hasattr(potr, 'VERSION') or potr.VERSION < MINVERSION: - raise ImportError('old / unsupported python-otr version') +HAS_POTR = True +try: + import potr +except ImportError: + HAS_POTR = False class GajimContext(potr.context.Context): __slots__ = ['smpWindow'] @@ -233,6 +236,13 @@ class OtrPlugin(GajimPlugin): if acc not in self.config or None not in self.config[acc]: self.config[acc] = {None:DEFAULTFLAGS.copy()} + @log_calls('OtrPlugin') + def activate(self): + if not HAS_POTR: + raise GajimPluginException('python-otr is missing!') + if not hasattr(potr, 'VERSION') or potr.VERSION < MINVERSION: + raise GajimPluginException('old / unsupported python-otr version') + def get_otr_status(self, account, contact): ctx = self.us[account].getContext(contact.get_full_jid())