diff options
author | Maxime Buquet <pep@bouah.net> | 2020-05-12 00:21:41 +0200 |
---|---|---|
committer | Maxime Buquet <pep@bouah.net> | 2020-05-12 00:21:41 +0200 |
commit | ac3fb695741a638d25d0731ef7f037852f0a641d (patch) | |
tree | d165aae4ff5e77bba071addc2a4ae583a316bcfd | |
parent | 406a10bf15fe46400b658df6bbe7ce2942e6ee00 (diff) | |
parent | 17585c6b65849ed24db63fdb240eaefe183577ff (diff) | |
download | poezio-ac3fb695741a638d25d0731ef7f037852f0a641d.tar.gz poezio-ac3fb695741a638d25d0731ef7f037852f0a641d.tar.bz2 poezio-ac3fb695741a638d25d0731ef7f037852f0a641d.tar.xz poezio-ac3fb695741a638d25d0731ef7f037852f0a641d.zip |
Merge branch 'muc-barejid-info' into 'master'
poezio.core.handlers: Treat MUC Barejid message as info
See merge request poezio/poezio!96
-rw-r--r-- | poezio/core/handlers.py | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index 3e2a20a0..8ed861af 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -778,8 +778,12 @@ class HandlerCore: replaced = True except CorrectionError: log.debug('Unable to correct a message', exc_info=True) - if not replaced and tab.add_message( - PMessage( + + if not replaced: + # Messages coming from MUC barejid (Server maintenance, IRC mode + # changes from biboumi, etc.) are displayed as info messages. + if message['from'].resource: + ui_msg = PMessage( txt=body, time=date, nickname=nick_from, @@ -788,9 +792,18 @@ class HandlerCore: identifier=message['id'], jid=message['from'], user=user, - ), - typ=1): - self.core.events.trigger('highlight', message, tab) + ) + typ = 1 + else: + ui_msg = InfoMessage( + txt=body, + time=date, + identifier=message['id'], + ) + typ = 2 + + if tab.add_message(ui_msg, typ): + self.core.events.trigger('highlight', message, tab) if message['from'].resource == tab.own_nick: tab.set_last_sent_message(message, correct=replaced) |