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)
This commit is contained in:
parent
706782eeb1
commit
ebf651226e
1 changed files with 17 additions and 0 deletions
|
|
@ -154,11 +154,28 @@ class OTR(object):
|
||||||
|
|
||||||
def __init__(self, host):
|
def __init__(self, host):
|
||||||
log.info(_(u"OTR plugin initialization"))
|
log.info(_(u"OTR plugin initialization"))
|
||||||
|
self._fixPotr() # FIXME: to be removed when potr will be fixed
|
||||||
self.host = host
|
self.host = host
|
||||||
self.context_managers = {}
|
self.context_managers = {}
|
||||||
host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100000)
|
host.trigger.add("MessageReceived", self.MessageReceivedTrigger, priority=100000)
|
||||||
host.trigger.add("sendMessage", self.sendMessageTrigger, 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
|
@defer.inlineCallbacks
|
||||||
def profileConnected(self, profile):
|
def profileConnected(self, profile):
|
||||||
client = self.host.getClient(profile)
|
client = self.host.getClient(profile)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue