# HG changeset patch # User Goffi # Date 1571207992 -7200 # Node ID 0408df45ebe7c95d3d541fb11ae1191869cfaccc # Parent f91d0e6d9b1399ef5483aa1679024c46480f2e69 plugin OTR: work around a bad exception raised in potr diff -r f91d0e6d9b13 -r 0408df45ebe7 sat/plugins/plugin_sec_otr.py --- 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(