summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Wielicki <j.wielicki@sotecware.net>2017-11-26 13:21:51 +0100
committerJonas Wielicki <j.wielicki@sotecware.net>2017-11-28 19:03:12 +0100
commit4edf40c3bbef029e9f78e23590f8cf34e6299a72 (patch)
tree18c1dd155338e1b4e338e3c2c024ad38a0e55d29
parent2ac65137aa1fa75ac466cd83020ea54d6247d5eb (diff)
downloadpoezio-4edf40c3bbef029e9f78e23590f8cf34e6299a72.tar.gz
poezio-4edf40c3bbef029e9f78e23590f8cf34e6299a72.tar.bz2
poezio-4edf40c3bbef029e9f78e23590f8cf34e6299a72.tar.xz
poezio-4edf40c3bbef029e9f78e23590f8cf34e6299a72.zip
XEP-0392 MUC: re-color users on nickname change
-rw-r--r--poezio/tabs/muctab.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index 0a5ee793..769d7b8a 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -650,32 +650,36 @@ class MucTab(ChatTab):
def on_user_nick_change(self, presence, user, from_nick, from_room):
new_nick = presence.xml.find('{%s}x/{%s}item' %
(NS_MUC_USER, NS_MUC_USER)).attrib['nick']
+ old_color = user.color
if user.nick == self.own_nick:
self.own_nick = new_nick
# also change our nick in all private discussions of this room
self.core.handler.on_muc_own_nickchange(self)
+ user.change_nick(new_nick)
else:
- color = config.get_by_tabname(new_nick, 'muc_colors')
- if color != '':
- deterministic = config.get_by_tabname(
- 'deterministic_nick_colors', self.name)
+ user.change_nick(new_nick)
+ deterministic = config.get_by_tabname(
+ 'deterministic_nick_colors', self.name)
+ color = config.get_by_tabname(new_nick, 'muc_colors') or None
+ if color or deterministic:
user.change_color(color, deterministic)
- user.change_nick(new_nick)
self.users.remove(user)
bisect.insort_left(self.users, user)
if config.get_by_tabname('display_user_color_in_join_part',
self.general_jid):
color = dump_tuple(user.color)
+ old_color = dump_tuple(old_color)
else:
- color = 3
+ old_color = color = 3
info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
self.add_message(
- '\x19%(color)s}%(old)s\x19%(info_col)s} is'
+ '\x19%(old_color)s}%(old)s\x19%(info_col)s} is'
' now known as \x19%(color)s}%(new)s' % {
'old': from_nick,
'new': new_nick,
'color': color,
+ 'old_color': old_color,
'info_col': info_col
},
typ=2)