Commit 7ec85ae3 authored by mathieui's avatar mathieui

Fix #2143 Fix #2056

Show headline messages in the info buffer, and show error messages (or
other errors) with a special style.
parent 0f9b37b8
......@@ -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)')
......
......@@ -161,6 +161,8 @@ class Theme(object):
# This is your own nickname
COLOR_OWN_NICK = (254, -1)
# This is for in-tab error messages
COLOR_ERROR_MSG = (9, 7, 'b')
# Status color
COLOR_STATUS_XA = (16, 90)
COLOR_STATUS_NONE = (16, 4)
......@@ -199,10 +201,11 @@ class Theme(object):
# Info messages color (the part before the ">")
INFO_COLORS = {
'Info': (5, -1),
'Error': (16, 1),
'Roster': (2, 16),
'default': (0, -1),
'info': (5, -1),
'error': (16, 1),
'roster': (2, 16),
'headline': (11, -1, 'b'),
'default': (7, -1),
}
# This is the default theme object, used if no theme is defined in the conf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment