echo_client: Handle decrypt_message's Optional-ness
Also comment about it Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
05b5705f22
commit
e00c646d95
1 changed files with 5 additions and 0 deletions
|
@ -150,6 +150,11 @@ class EchoBot(ClientXMPP):
|
||||||
try:
|
try:
|
||||||
encrypted = msg['omemo_encrypted']
|
encrypted = msg['omemo_encrypted']
|
||||||
body = self['xep_0384'].decrypt_message(encrypted, mfrom, allow_untrusted)
|
body = self['xep_0384'].decrypt_message(encrypted, mfrom, allow_untrusted)
|
||||||
|
# decrypt_message returns Optional[str]. It is possible to get
|
||||||
|
# body-less OMEMO message (see KeyTransportMessages), currently
|
||||||
|
# used for example to send heartbeats to other devices.
|
||||||
|
if body is None:
|
||||||
|
return None
|
||||||
decoded = body.decode('utf8')
|
decoded = body.decode('utf8')
|
||||||
if self.is_command(decoded):
|
if self.is_command(decoded):
|
||||||
await self.handle_command(mto, mtype, decoded)
|
await self.handle_command(mto, mtype, decoded)
|
||||||
|
|
Loading…
Reference in a new issue