diff options
author | mathieui <mathieui@mathieui.net> | 2016-07-14 14:33:27 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2016-07-14 14:33:27 +0200 |
commit | 0a3738fd66d79fef992293713c4c5b6717887ade (patch) | |
tree | 612a94ed49116ecdf419f89781094c693e757525 | |
parent | 4b3dde2a2757519965a4c3ad2e818509b7785562 (diff) | |
download | poezio-0a3738fd66d79fef992293713c4c5b6717887ade.tar.gz poezio-0a3738fd66d79fef992293713c4c5b6717887ade.tar.bz2 poezio-0a3738fd66d79fef992293713c4c5b6717887ade.tar.xz poezio-0a3738fd66d79fef992293713c4c5b6717887ade.zip |
Improve the topic display
More colors, show an indicator if we changed it
-rw-r--r-- | poezio/core/handlers.py | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/poezio/core/handlers.py b/poezio/core/handlers.py index e1fc292b..40070281 100644 --- a/poezio/core/handlers.py +++ b/poezio/core/handlers.py @@ -1054,14 +1054,31 @@ class HandlerCore: if subject != tab.topic: # Do not display the message if the subject did not change or if we # receive an empty topic when joining the room. + fmt = { + 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), + 'text_col': dump_tuple(get_theme().COLOR_NORMAL_TEXT), + 'subject': subject, + 'user': '', + } if nick_from: - tab.add_message("\x19%(info_col)s}%(nick)s set the subject to: %(subject)s" % - {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), 'nick':nick_from, 'subject':subject}, + user = tab.get_user_by_name(nick_from) + if nick_from == tab.own_nick: + after = ' (You)' + else: + after = '' + if user: + user_col = dump_tuple(user.color) + user_string = '\x19%s}%s\x19%s}%s' % (user_col, nick_from, fmt['info_col'], after) + else: + user_string = '\x19%s}%s%s' % (fmt['info_col'], nick_from, after) + fmt['user'] = user_string + + if nick_from: + tab.add_message("%(user)s set the subject to: \x19%(text_col)s}%(subject)s" % fmt, time=None, typ=2) else: - tab.add_message("\x19%(info_col)s}The subject is: %(subject)s" % - {'subject':subject, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, + tab.add_message("\x19%(info_col)s}The subject is: \x19%(text_col)s}%(subject)s" % fmt, time=None, typ=2) tab.topic = subject |