don't hide otr plugin when potr is not available, just inform user when he wants to enable it.

This commit is contained in:
Yann Leboulanger
2011-12-19 16:21:00 +01:00
parent 21e306b98d
commit add87812d1
2 changed files with 14 additions and 4 deletions

View File

@@ -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

View File

@@ -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())