diff --git a/src/plugins/plugin_sec_otr.py b/src/plugins/plugin_sec_otr.py index a64592db..92aebda5 100644 --- a/src/plugins/plugin_sec_otr.py +++ b/src/plugins/plugin_sec_otr.py @@ -154,11 +154,28 @@ class OTR(object): def __init__(self, host): log.info(_(u"OTR plugin initialization")) + self._fixPotr() # FIXME: to be removed when potr will be fixed self.host = host self.context_managers = {} host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100000) host.trigger.add("sendMessage", self.sendMessageTrigger, priority=100000) + def _fixPotr(self): + # FIXME: potr fix for bad unicode handling + # this method monkeypatch it, must be removed when potr + # is fixed + + def getDefaultQueryMessage(self, policy): + defaultQuery = '?OTRv{versions}?\nI would like to start ' \ + 'an Off-the-Record private conversation. However, you ' \ + 'do not have a plugin to support that.\nSee '\ + 'https://otr.cypherpunks.ca/ for more information.' + v = '2' if policy('ALLOW_V2') else '' + msg = defaultQuery.format(versions=v) + return msg.encode('ascii') + + potr.context.Account.getDefaultQueryMessage = getDefaultQueryMessage + @defer.inlineCallbacks def profileConnected(self, profile): client = self.host.getClient(profile)