Mercurial > libervia-backend
diff sat/plugins/plugin_sec_otr.py @ 3058:0408df45ebe7
plugin OTR: work around a bad exception raised in potr
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 16 Oct 2019 08:39:52 +0200 |
parents | fee60f17ebac |
children | 9d0df638c8b4 |
line wrap: on
line diff
--- a/sat/plugins/plugin_sec_otr.py Wed Oct 16 08:39:52 2019 +0200 +++ b/sat/plugins/plugin_sec_otr.py Wed Oct 16 08:39:52 2019 +0200 @@ -637,7 +637,11 @@ 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(