Our own is ALWAYS white and other nicks are NEVER white. Also reset MAGENTA...

Our own is ALWAYS white and other nicks are NEVER white. Also reset MAGENTA for information messages
parent 94153c49
......@@ -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'
......
......@@ -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()
......
......@@ -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
......
......@@ -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,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment