don't hide otr plugin when potr is not available, just inform user when he wants to enable it.
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
[info]
|
[info]
|
||||||
name: Off-The-Record Encryption
|
name: Off-The-Record Encryption
|
||||||
short_name: gotr
|
short_name: gotr
|
||||||
version: 1.1
|
version: 1.2
|
||||||
description: See http://www.cypherpunks.ca/otr/
|
description: See http://www.cypherpunks.ca/otr/
|
||||||
authors: Kjell Braden <afflux.gajim@pentabarf.de>
|
authors: Kjell Braden <afflux.gajim@pentabarf.de>
|
||||||
homepage: http://gajim-otr.pentabarf.de
|
homepage: http://gajim-otr.pentabarf.de
|
||||||
|
|||||||
@@ -63,14 +63,17 @@ from common.connection_handlers_events import MessageOutgoingEvent
|
|||||||
from plugins import GajimPlugin
|
from plugins import GajimPlugin
|
||||||
from message_control import TYPE_CHAT, MessageControl
|
from message_control import TYPE_CHAT, MessageControl
|
||||||
from plugins.helpers import log_calls, log
|
from plugins.helpers import log_calls, log
|
||||||
|
from plugins.plugin import GajimPluginException
|
||||||
|
|
||||||
import ui
|
import ui
|
||||||
|
|
||||||
|
|
||||||
import pickle
|
import pickle
|
||||||
import potr
|
HAS_POTR = True
|
||||||
if not hasattr(potr, 'VERSION') or potr.VERSION < MINVERSION:
|
try:
|
||||||
raise ImportError('old / unsupported python-otr version')
|
import potr
|
||||||
|
except ImportError:
|
||||||
|
HAS_POTR = False
|
||||||
|
|
||||||
class GajimContext(potr.context.Context):
|
class GajimContext(potr.context.Context):
|
||||||
__slots__ = ['smpWindow']
|
__slots__ = ['smpWindow']
|
||||||
@@ -233,6 +236,13 @@ class OtrPlugin(GajimPlugin):
|
|||||||
if acc not in self.config or None not in self.config[acc]:
|
if acc not in self.config or None not in self.config[acc]:
|
||||||
self.config[acc] = {None:DEFAULTFLAGS.copy()}
|
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):
|
def get_otr_status(self, account, contact):
|
||||||
ctx = self.us[account].getContext(contact.get_full_jid())
|
ctx = self.us[account].getContext(contact.get_full_jid())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user