summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCélestin Matte <celestin.matte@gmail.com>2014-12-23 16:43:40 +0100
committerCélestin Matte <celestin.matte@gmail.com>2014-12-24 00:29:39 +0100
commit1bbdab7f12df2f1cd71db86ba6caf6c888e2a3ad (patch)
treedd589d546558646c7ca1b9028a4dedfcddf48686 /src
parent251a10ab0d78ef9f4f68fc59ab41e064466d9145 (diff)
downloadpoezio-1bbdab7f12df2f1cd71db86ba6caf6c888e2a3ad.tar.gz
poezio-1bbdab7f12df2f1cd71db86ba6caf6c888e2a3ad.tar.bz2
poezio-1bbdab7f12df2f1cd71db86ba6caf6c888e2a3ad.tar.xz
poezio-1bbdab7f12df2f1cd71db86ba6caf6c888e2a3ad.zip
Unset color with /color <nick> unset
Diffstat (limited to 'src')
-rw-r--r--src/tabs/muctab.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index b9dba7ab..89cecca8 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -160,7 +160,8 @@ class MucTab(ChatTab):
completion=self.completion_recolor)
self.register_command('color', self.command_color,
usage=_('<nick> <color>'),
- desc=_('Fix a color for a nick.'),
+ desc=_('Fix a color for a nick. Use "unset" instead of a color'
+ ' to remove the attribution'),
shortdesc=_('Fix a color for a nick.'),
completion=self.completion_color)
self.register_command('cycle', self.command_cycle,
@@ -277,6 +278,7 @@ class MucTab(ChatTab):
elif n == 2:
colors = [i for i in xhtml.colors if i]
colors.sort()
+ colors.append('unset')
return the_input.new_completion(colors, 2, '', quotify=False)
def completion_ignore(self, the_input):
@@ -464,6 +466,7 @@ class MucTab(ChatTab):
"""
/color <nick> <color>
Fix a color for a nick.
+ Use "unset" instead of a color to remove the attribution
"""
if args is None:
return self.core.command_help('color')
@@ -472,17 +475,21 @@ class MucTab(ChatTab):
user = self.get_user_by_name(nick)
if not user:
return self.core.information(_("Unknown user: %s") % nick)
- if not color in xhtml.colors:
+ if not color in xhtml.colors and color != 'unset':
return self.core.information(_("Unknown color: %s") % color, 'Error')
if user.nick == self.own_nick:
return self.core.information(_("You cannot change the color of your"
" own nick.", 'Error'))
- user.change_color(color)
- config.write_in_file('muc_colors', nick, color)
- self.text_win.rebuild_everything(self._text_buffer)
- self.user_win.refresh(self.users)
- self.text_win.refresh()
- self.input.refresh()
+ 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)
+ config.set_and_save(nick, color, 'muc_colors')
+ self.text_win.rebuild_everything(self._text_buffer)
+ self.user_win.refresh(self.users)
+ self.text_win.refresh()
+ self.input.refresh()
@command_args_parser.quoted(1)
def command_version(self, args):