summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2017-11-28 19:58:44 +0100
committermathieui <mathieui@mathieui.net>2017-11-28 19:58:44 +0100
commitd4bc3b543e8aee9a6f584cc21786e26751ac1e19 (patch)
tree36a105d9fd2b9decda7d4990218d991cdebc58ba
parent57692e5fc4b8eb086f3beb68b520f00323c61ed3 (diff)
parent4edf40c3bbef029e9f78e23590f8cf34e6299a72 (diff)
downloadpoezio-d4bc3b543e8aee9a6f584cc21786e26751ac1e19.tar.gz
poezio-d4bc3b543e8aee9a6f584cc21786e26751ac1e19.tar.bz2
poezio-d4bc3b543e8aee9a6f584cc21786e26751ac1e19.tar.xz
poezio-d4bc3b543e8aee9a6f584cc21786e26751ac1e19.zip
Merge branch 'feature/xep0392-based-on-nickname' of https://github.com/horazont/poezio
-rw-r--r--poezio/tabs/muctab.py18
-rw-r--r--poezio/user.py3
2 files changed, 12 insertions, 9 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)
diff --git a/poezio/user.py b/poezio/user.py
index c69d241c..ae70f6f8 100644
--- a/poezio/user.py
+++ b/poezio/user.py
@@ -56,8 +56,7 @@ class User(object):
if theme.ccg_palette:
# use XEP-0392 CCG
fg_color = colors.ccg_text_to_color(
- theme.ccg_palette, self.jid.bare
- if self.jid and self.jid.bare else self.nick)
+ theme.ccg_palette, self.nick)
self.color = fg_color, -1
else:
mod = len(theme.LIST_COLOR_NICKNAMES)