From b464082f469a0aac03c2798ff27909c9a3dcc149 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Thu, 5 Aug 2010 00:09:59 +0000 Subject: Our own is ALWAYS white and other nicks are NEVER white. Also reset MAGENTA for information messages --- src/gui.py | 14 +++++++------- src/room.py | 5 ++++- src/user.py | 5 +---- src/window.py | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/gui.py b/src/gui.py index 8a9400e2..16d33e04 100644 --- a/src/gui.py +++ b/src/gui.py @@ -179,10 +179,10 @@ class Gui(object): stdscr.keypad(True) curses.init_pair(1, curses.COLOR_WHITE, curses.COLOR_BLUE) - curses.init_pair(4, curses.COLOR_CYAN, -1) - curses.init_pair(2, curses.COLOR_RED, -1) # Admin - curses.init_pair(3, curses.COLOR_BLUE, -1) # Participant - curses.init_pair(5, curses.COLOR_WHITE, -1) # Visitor + curses.init_pair(2, curses.COLOR_WHITE, -1) # Visitor + curses.init_pair(3, curses.COLOR_CYAN, -1) + curses.init_pair(4, curses.COLOR_RED, -1) # Admin + curses.init_pair(5, curses.COLOR_BLUE, -1) # Participant curses.init_pair(6, curses.COLOR_CYAN, -1) curses.init_pair(7, curses.COLOR_GREEN, -1) curses.init_pair(8, curses.COLOR_MAGENTA, -1) @@ -450,7 +450,6 @@ class Gui(object): from_room = stanza.getFrom().getStripped() room = self.get_room_by_name(from_room) if not room: - # common.debug(':(:(:(:(\n') return else: msg = None @@ -461,11 +460,12 @@ class Gui(object): if not room.joined: # user in the room BEFORE us. # ignore redondant presence message, see bug #1509 if from_nick not in [user.nick for user in room.users]: - room.users.append(User(from_nick, affiliation, show, status, - role)) + new_user = User(from_nick, affiliation, show, status, role) + room.users.append(new_user) if from_nick.encode('utf-8') == room.own_nick: room.joined = True self.add_message_to_room(room, _("Your nickname is %s") % (from_nick)) + new_user.color = 2 else: change_nick = stanza.getStatusCode() == '303' kick = stanza.getStatusCode() == '307' diff --git a/src/room.py b/src/room.py index 0863b209..0167541e 100644 --- a/src/room.py +++ b/src/room.py @@ -108,7 +108,10 @@ class Room(object): self.set_color_state(common.ROOM_STATE_MESSAGE) else: self.set_color_state(common.ROOM_STATE_PRIVATE) - color = self.do_highlight(txt, time, nickname) + if not nickname: + color = 8 + else: + color = self.do_highlight(txt, time, nickname) if time: # History messages are colored to be distinguished color = 8 time = time if time is not None else datetime.now() diff --git a/src/user.py b/src/user.py index ae369de0..c0a55d7b 100644 --- a/src/user.py +++ b/src/user.py @@ -29,10 +29,7 @@ class User(object): self.last_talked = None self.update(affiliation, show, status, role) self.change_nick(nick) - self.color = randrange(2, 10) # assign a random color - # if randrange(1) == 0: - # self.color = 16 - # self.color |= curses.A_BOLD + self.color = randrange(3, 10) # assign a random color def update(self, affiliation, show, status, role): self.affiliation = affiliation diff --git a/src/window.py b/src/window.py index 76f2b048..4616aae1 100644 --- a/src/window.py +++ b/src/window.py @@ -55,10 +55,10 @@ class UserList(Win): def __init__(self, height, width, y, x, parent_win, visible): Win.__init__(self, height, width, y, x, parent_win) self.visible = visible - self.color_role = {'moderator': 2, - 'participant':3, - 'visitor':5, - 'none':5 + self.color_role = {'moderator': 4, + 'participant':5, + 'visitor':2, + 'none':3 } self.color_show = {'xa':12, 'None':8, -- cgit v1.2.3