From 0d5b96fd8dafcb9727c4d65b2191f0cf56872463 Mon Sep 17 00:00:00 2001 From: mathieui Date: Sat, 10 Dec 2011 16:36:18 +0100 Subject: Improve /names command --- src/tabs.py | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/tabs.py') diff --git a/src/tabs.py b/src/tabs.py index b1d5bec2..14af2206 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -781,7 +781,12 @@ class MucTab(ChatTab): """ if not self.joined: return - users, visitors, moderators, participants, others = [], [], [], [], [] + color_visitor = get_theme().COLOR_USER_VISITOR[0] + color_other = get_theme().COLOR_USER_NONE[0] + color_moderator = get_theme().COLOR_USER_MODERATOR[0] + color_participant = get_theme().COLOR_USER_PARTICIPANT[0] + color_information = get_theme().COLOR_INFORMATION_TEXT[0] + visitors, moderators, participants, others = [], [], [], [] for user in self.users: if user.role == 'visitor': visitors.append(user.nick) @@ -791,20 +796,18 @@ class MucTab(ChatTab): moderators.append(user.nick) else: others.append(user.nick) - users.append(user.nick) - - message = '' - roles = (('Users', users), ('Visitors', visitors), ('Participants', participants), ('Moderators', moderators), ('Others', others)) - for role in roles: - if role[1]: - role[1].sort() - message += '%s: %i\n ' % (role[0], len(role[1])) - last = role[1].pop() - for item in role[1]: - message += '%s, ' % item - message += '%s\n' % last - - # self.core.add_message_to_text_buffer(room, message) + + message = 'Users: %s \n' % len(self.users) + for moderator in moderators: + message += ' \x19%s}%s\x19o -' % (color_moderator, moderator) + for participant in participants: + message += ' \x19%s}%s\x19o -' % (color_participant, participant) + for visitor in visitors: + message += ' \x19%s}%s\x19o -' % (color_visitor, visitor) + for other in others: + message += ' \x19%s}%s\x19o -' % (color_other, other) + message = message[:-2] + self._text_buffer.add_message(message) self.text_win.refresh() self.input.refresh() -- cgit v1.2.3