xep_0384: use exception instead of log when missing own key when decrypting

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2018-11-19 22:10:41 +01:00
parent 3227e58d8a
commit 02f140614f

View file

@ -69,6 +69,13 @@ def _load_device_id(cache_dir: str) -> int:
class PluginCouldNotLoad(Exception): pass
# Generic exception
class XEP0384(Exception): pass
class MissingOwnKey(XEP0384): pass
class XEP_0384(BasePlugin):
"""
@ -233,8 +240,7 @@ class XEP_0384(BasePlugin):
key = header.xml.find("{%s}key[@rid='%s']" % (
OMEMO_BASE_NS, self._device_id))
if key is None:
log.debug("Saw encrypted message that wasn't for me, ignoring.")
return None
raise MissingOwnKey("Encrypted message is not for us")
key = Key(key)
isPrekeyMessage = key['prekey'] in TRUE_VALUES