summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2012-12-30 17:40:27 +0100
committermathieui <mathieui@mathieui.net>2012-12-30 17:40:27 +0100
commit7ec85ae32831dff00259aa72d5163a03053a733a (patch)
treef429d0f239bb59955d61a4df32d74231d5aa030a
parent0f9b37b8a8ee9ec469426f425a6415269653ac5a (diff)
downloadpoezio-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.
-rw-r--r--src/core.py6
-rw-r--r--src/theming.py11
2 files changed, 11 insertions, 6 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)')
diff --git a/src/theming.py b/src/theming.py
index cc7d0f89..c2c8950f 100644
--- a/src/theming.py
+++ b/src/theming.py
@@ -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