echo_bot: Remove useless returns
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
a495d7d7c8
commit
320105988a
1 changed files with 6 additions and 12 deletions
|
@ -145,14 +145,12 @@ class EchoBot(ClientXMPP):
|
||||||
# decrypt_message returns Optional[str]. It is possible to get
|
# decrypt_message returns Optional[str]. It is possible to get
|
||||||
# body-less OMEMO message (see KeyTransportMessages), currently
|
# body-less OMEMO message (see KeyTransportMessages), currently
|
||||||
# used for example to send heartbeats to other devices.
|
# used for example to send heartbeats to other devices.
|
||||||
if body is None:
|
if body is not 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)
|
elif self.debug_level == LEVEL_DEBUG:
|
||||||
elif self.debug_level == LEVEL_DEBUG:
|
await self.encrypted_reply(mto, mtype, f'Echo: {decoded}')
|
||||||
await self.encrypted_reply(mto, mtype, f'Echo: {decoded}')
|
|
||||||
return None
|
|
||||||
except (MissingOwnKey,):
|
except (MissingOwnKey,):
|
||||||
# The message is missing our own key, it was not encrypted for
|
# The message is missing our own key, it was not encrypted for
|
||||||
# us, and we can't decrypt it.
|
# us, and we can't decrypt it.
|
||||||
|
@ -160,7 +158,6 @@ class EchoBot(ClientXMPP):
|
||||||
mto, mtype,
|
mto, mtype,
|
||||||
'Error: Message not encrypted for me.',
|
'Error: Message not encrypted for me.',
|
||||||
)
|
)
|
||||||
return None
|
|
||||||
except (NoAvailableSession,) as exn:
|
except (NoAvailableSession,) as exn:
|
||||||
# We received a message from that contained a session that we
|
# We received a message from that contained a session that we
|
||||||
# don't know about (deleted session storage, etc.). We can't
|
# don't know about (deleted session storage, etc.). We can't
|
||||||
|
@ -173,7 +170,6 @@ class EchoBot(ClientXMPP):
|
||||||
'Error: Message uses an encrypted '
|
'Error: Message uses an encrypted '
|
||||||
'session I don\'t know about.',
|
'session I don\'t know about.',
|
||||||
)
|
)
|
||||||
return None
|
|
||||||
except (UndecidedException, UntrustedException) as exn:
|
except (UndecidedException, UntrustedException) as exn:
|
||||||
# We received a message from an untrusted device. We can
|
# We received a message from an untrusted device. We can
|
||||||
# choose to decrypt the message nonetheless, with the
|
# choose to decrypt the message nonetheless, with the
|
||||||
|
@ -189,13 +185,11 @@ class EchoBot(ClientXMPP):
|
||||||
)
|
)
|
||||||
# We resend, setting the `allow_untrusted` parameter to True.
|
# We resend, setting the `allow_untrusted` parameter to True.
|
||||||
await self.message_handler(msg, allow_untrusted=True)
|
await self.message_handler(msg, allow_untrusted=True)
|
||||||
return None
|
|
||||||
except (EncryptionPrepareException,):
|
except (EncryptionPrepareException,):
|
||||||
# Slixmpp tried its best, but there were errors it couldn't
|
# Slixmpp tried its best, but there were errors it couldn't
|
||||||
# resolve. At this point you should have seen other exceptions
|
# resolve. At this point you should have seen other exceptions
|
||||||
# and given a chance to resolve them already.
|
# and given a chance to resolve them already.
|
||||||
await self.plain_reply(mto, mtype, 'Error: I was not able to decrypt the message.')
|
await self.plain_reply(mto, mtype, 'Error: I was not able to decrypt the message.')
|
||||||
return None
|
|
||||||
except (Exception,) as exn:
|
except (Exception,) as exn:
|
||||||
await self.plain_reply(mto, mtype, 'Error: Exception occured while attempting decryption.\n%r' % exn)
|
await self.plain_reply(mto, mtype, 'Error: Exception occured while attempting decryption.\n%r' % exn)
|
||||||
raise
|
raise
|
||||||
|
|
Loading…
Reference in a new issue