diff options
author | Célestin Matte <celestin.matte@gmail.com> | 2014-12-23 23:51:04 +0100 |
---|---|---|
committer | Célestin Matte <celestin.matte@gmail.com> | 2014-12-24 00:30:52 +0100 |
commit | 9da530f8541ed96fe5fa7e3ff01df5290f511633 (patch) | |
tree | c6ec90d02757ac671af3b89383c249a84519164e /src/tabs | |
parent | 0ae1ee2fbf0b3b10fbaaa12e7f340f2aedce3621 (diff) | |
download | poezio-9da530f8541ed96fe5fa7e3ff01df5290f511633.tar.gz poezio-9da530f8541ed96fe5fa7e3ff01df5290f511633.tar.bz2 poezio-9da530f8541ed96fe5fa7e3ff01df5290f511633.tar.xz poezio-9da530f8541ed96fe5fa7e3ff01df5290f511633.zip |
Make it possible to change the nick of a user not in the room, and change color of its aliases
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/muctab.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index 7264569a..d567e364 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -473,19 +473,27 @@ class MucTab(ChatTab): nick = args[0] color = args[1].lower() user = self.get_user_by_name(nick) - if not user: - return self.core.information(_("Unknown user: %s") % nick) if not color in xhtml.colors and color != 'unset': return self.core.information(_("Unknown color: %s") % color, 'Error') - if user.nick == self.own_nick: + if user and user.nick == self.own_nick: return self.core.information(_("You cannot change the color of your" " own nick.", 'Error')) if color == 'unset': if config.remove_and_save(nick, 'muc_colors'): self.core.information(_('Color for nick %s unset') % (nick)) else: - user.change_color(color) + if user: + user.change_color(color) config.set_and_save(nick, color, 'muc_colors') + nick_color_aliases = config.get_by_tabname('nick_color_aliases', self.name) + if nick_color_aliases: + # if any user in the room has a nick which is an alias of the + # nick, update its color + for u in self.users: + nick_alias = re.sub('^_*', '', u.nick) + nick_alias = re.sub('_*$', '', nick_alias) + if nick_alias == nick: + u.change_color(color) self.text_win.rebuild_everything(self._text_buffer) self.user_win.refresh(self.users) self.text_win.refresh() |