diff options
author | Eijebong <eijebong@bananium.fr> | 2015-02-03 20:07:13 +0100 |
---|---|---|
committer | Eijebong <eijebong@bananium.fr> | 2015-02-03 20:07:13 +0100 |
commit | 5da85b94b30c3d3c30ab0abf0cc8ddf147a4e2da (patch) | |
tree | 6dbdb341a2bc833925358567ff9162283b515e24 /src/tabs | |
parent | 3c46d49704de86635508439f524c684903dc81d3 (diff) | |
download | poezio-5da85b94b30c3d3c30ab0abf0cc8ddf147a4e2da.tar.gz poezio-5da85b94b30c3d3c30ab0abf0cc8ddf147a4e2da.tar.bz2 poezio-5da85b94b30c3d3c30ab0abf0cc8ddf147a4e2da.tar.xz poezio-5da85b94b30c3d3c30ab0abf0cc8ddf147a4e2da.zip |
Add a random arg to /color
Diffstat (limited to 'src/tabs')
-rw-r--r-- | src/tabs/muctab.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py index ed2b4f85..1f202dd0 100644 --- a/src/tabs/muctab.py +++ b/src/tabs/muctab.py @@ -279,6 +279,7 @@ class MucTab(ChatTab): colors = [i for i in xhtml.colors if i] colors.sort() colors.append('unset') + colors.append('random') return the_input.new_completion(colors, 2, '', quotify=False) def completion_ignore(self, the_input): @@ -466,14 +467,15 @@ class MucTab(ChatTab): """ /color <nick> <color> Fix a color for a nick. - Use "unset" instead of a color to remove the attribution + Use "unset" instead of a color to remove the attribution. + User "random" to attribute a random color. """ if args is None: return self.core.command_help('color') nick = args[0] color = args[1].lower() user = self.get_user_by_name(nick) - if not color in xhtml.colors and color != 'unset': + if not color in xhtml.colors and color not in ('unset', 'random'): return self.core.information(_("Unknown color: %s") % color, 'Error') if user and user.nick == self.own_nick: return self.core.information(_("You cannot change the color of your" @@ -482,6 +484,8 @@ class MucTab(ChatTab): if config.remove_and_save(nick, 'muc_colors'): self.core.information(_('Color for nick %s unset') % (nick)) else: + if color == 'random': + color = random.choice(list(xhtml.colors)) if user: user.change_color(color) config.set_and_save(nick, color, 'muc_colors') |