plugin OTR: work around a bad exception raised in potr

This commit is contained in:
Goffi 2019-10-16 08:39:52 +02:00
commit 73a4f8d8f6

View file

@ -637,7 +637,11 @@ class OTR(object):
next(iter(data["message"].values()))
) # FIXME: Q&D fix for message refactoring, message is now a dict
res = otrctx.receiveMessage(message.encode("utf-8"))
except potr.context.UnencryptedMessage:
except (potr.context.UnencryptedMessage, potr.context.NotOTRMessage):
# potr has a bug with Python 3 and test message against str while bytes are
# expected, resulting in a NoOTRMessage raised instead of UnencryptedMessage;
# so we catch NotOTRMessage as a workaround
# TODO: report this upstream
encrypted = False
if otrctx.state == potr.context.STATE_ENCRYPTED:
log.warning(