# HG changeset patch # User Goffi # Date 1408995143 -7200 # Node ID 8def4a3f55c2e99f53668d05941d3774747a6483 # Parent 7e685690248878a74ae4ac75b1de3c19e8141736 plugin OTR: temporary potr monkey patch to work around a unicode bug, to be removed as soon as a potr fixed version is released (potr maintainer should do it soon) diff -r 7e6856902488 -r 8def4a3f55c2 src/plugins/plugin_sec_otr.py --- a/src/plugins/plugin_sec_otr.py Mon Aug 25 21:32:23 2014 +0200 +++ b/src/plugins/plugin_sec_otr.py Mon Aug 25 21:32:23 2014 +0200 @@ -154,11 +154,28 @@ 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)