diff options
author | mathieui <mathieui@mathieui.net> | 2012-12-30 17:40:27 +0100 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2012-12-30 17:40:27 +0100 |
commit | 7ec85ae32831dff00259aa72d5163a03053a733a (patch) | |
tree | f429d0f239bb59955d61a4df32d74231d5aa030a /src/core.py | |
parent | 0f9b37b8a8ee9ec469426f425a6415269653ac5a (diff) | |
download | poezio-7ec85ae32831dff00259aa72d5163a03053a733a.tar.gz poezio-7ec85ae32831dff00259aa72d5163a03053a733a.tar.bz2 poezio-7ec85ae32831dff00259aa72d5163a03053a733a.tar.xz poezio-7ec85ae32831dff00259aa72d5163a03053a733a.zip |
Fix #2143 Fix #2056
Show headline messages in the info buffer, and show error messages (or
other errors) with a special style.
Diffstat (limited to 'src/core.py')
-rw-r--r-- | src/core.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core.py b/src/core.py index dd8e26af..5f535f48 100644 --- a/src/core.py +++ b/src/core.py @@ -1063,7 +1063,7 @@ class Core(object): log.debug('Did not show the message:\n\t%s> %s', typ, msg) return False colors = get_theme().INFO_COLORS - color = colors.get(typ, colors.get('default', None)) + color = colors.get(typ.lower(), colors.get('default', None)) nb_lines = self.information_buffer.add_message(msg, nickname=typ, nick_color=color) if isinstance(self.current_tab(), tabs.RosterInfoTab): self.refresh_window() @@ -2381,6 +2381,8 @@ class Core(object): body = xhtml.get_body_from_message_stanza(message) if message['type'] == 'error': return self.information(self.get_error_message(message, deprecated=True), 'Error') + elif message['type'] == 'headline': + return self.information('%s says: %s' % (message['from'], message['body']), 'Headline') if not body: return conversation = self.get_conversation_by_jid(jid, create=True) @@ -2887,7 +2889,7 @@ class Core(object): """ tab = self.get_tab_by_name(room_name) error_message = self.get_error_message(error) - self.add_message_to_text_buffer(tab._text_buffer, error_message) + tab._text_buffer.add_message(error_message, highlight=True, nickname='Error', nick_color=get_theme().COLOR_ERROR_MSG) code = error['error']['code'] if code == '401': msg = _('To provide a password in order to join the room, type "/join / password" (replace "password" by the real password)') |