diff options
author | mathieui <mathieui@mathieui.net> | 2013-12-28 16:27:49 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-12-28 16:27:49 +0100 |
commit | 6461a77f295219c6cfb9fa918cedde1480111ebd (patch) | |
tree | e7f4f471384bdf4c470f68d984e8545201c9899a | |
parent | c0e010e2cdb0419f2a44d822d13219469032e38b (diff) | |
download | poezio-6461a77f295219c6cfb9fa918cedde1480111ebd.tar.gz poezio-6461a77f295219c6cfb9fa918cedde1480111ebd.tar.bz2 poezio-6461a77f295219c6cfb9fa918cedde1480111ebd.tar.xz poezio-6461a77f295219c6cfb9fa918cedde1480111ebd.zip |
Workaround for an otr lib bug (plaintext messages without warning)
See https://github.com/afflux/pure-python-otr/issues/47
-rw-r--r-- | plugins/otr.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/plugins/otr.py b/plugins/otr.py index d668c0ae..bdffeac2 100644 --- a/plugins/otr.py +++ b/plugins/otr.py @@ -401,7 +401,17 @@ class Plugin(BasePlugin): # ignore non-otr messages # if we expected an OTR message, we would have # got an UnencryptedMesssage - log.error('coucou %s', ctx.getPolicy('REQUIRE_ENCRYPTION')) + # but do an additional check because of a bug with py3k + if ctx.state != STATE_PLAINTEXT or ctx.getPolicy('REQUIRE_ENCRYPTION'): + + tab.add_message('The following message from %s was not encrypted:\n%s' % (msg['from'], err.args[0].decode('utf-8')), + jid=msg['from'], nick_color=theming.get_theme().COLOR_REMOTE_USER, + typ=0) + del msg['body'] + del msg['html'] + hl(tab) + self.core.refresh_window() + return return except NotEncryptedError as err: tab.add_message('An encrypted message from %s was received but is ' @@ -424,6 +434,8 @@ class Plugin(BasePlugin): self.core.refresh_window() return except: + tab.add_message('An unspecified error occured') + log.error('Unspecified error in the OTR plugin', exc_info=True) return # remove xhtml |