Expand the status command, make decryption work, put a hack into the core so I can handle messages without bodies.
This commit is contained in:
parent
ebbdbc2cbd
commit
2ff48b7adf
3 changed files with 12 additions and 1 deletions
|
@ -77,6 +77,7 @@ class Plugin(BasePlugin):
|
|||
"""Display contextual information depending on currenttab."""
|
||||
tab = self.api.current_tab()
|
||||
self.info('OMEMO!')
|
||||
self.info("My device id: %d" % self.xmpp['xep_0384'].my_device_id())
|
||||
|
||||
def command_enable(self, _args):
|
||||
pass
|
||||
|
@ -121,4 +122,5 @@ class Plugin(BasePlugin):
|
|||
|
||||
self.info('Foo2')
|
||||
if self.xmpp['xep_0384'].is_encrypted(message):
|
||||
self.xmpp['xep_0384'].decrypt_message(message)
|
||||
_always_none, body = self.xmpp['xep_0384'].decrypt_message(message)
|
||||
message['body'] = body.decode("utf8")
|
||||
|
|
|
@ -240,6 +240,7 @@ class Core:
|
|||
('groupchat_subject', self.handler.on_groupchat_subject),
|
||||
('http_confirm', self.handler.http_confirm),
|
||||
('message', self.handler.on_message),
|
||||
('message_encryption', self.handler.on_encrypted_message),
|
||||
('message_error', self.handler.on_error_message),
|
||||
('message_xform', self.handler.on_data_form),
|
||||
('no_auth', self.handler.on_no_auth),
|
||||
|
|
|
@ -271,6 +271,14 @@ class HandlerCore:
|
|||
return
|
||||
self.on_normal_message(message)
|
||||
|
||||
def on_encrypted_message(self, message):
|
||||
"""
|
||||
When receiving an encrypted message
|
||||
"""
|
||||
if message["body"]:
|
||||
return # Already being handled by on_message.
|
||||
self.on_message(message)
|
||||
|
||||
def on_error_message(self, message):
|
||||
"""
|
||||
When receiving any message with type="error"
|
||||
|
|
Loading…
Reference in a new issue