summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui.py2
-rw-r--r--src/room.py47
-rw-r--r--src/window.py5
3 files changed, 20 insertions, 34 deletions
diff --git a/src/gui.py b/src/gui.py
index b8273924..da70c1df 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -527,7 +527,7 @@ class Gui(object):
if not r: # if the room window exists, we don't recreate it.
self.join_room(room, nick)
else:
- r.own_nick = nick
+ # r.own_nick = nick
r.users = []
def command_bookmark(self, args):
diff --git a/src/room.py b/src/room.py
index 48061f47..f210aa4c 100644
--- a/src/room.py
+++ b/src/room.py
@@ -66,18 +66,23 @@ class Room(object):
"""
user = self.get_user_by_name(nickname) if nickname is not None else None
time = time if time is not None else datetime.now()
- from common import debug
- # debug("add_message: %s, %s, %s, %s" % (str(txt), str(time), str(nickname), str(user)))
-
color = None
if nickname is not None:
self.set_color_state(12)
else:
color = 8
if nickname != self.own_nick and self.joined and nickname is not None: # do the highlight
- if self.own_nick in txt:
- self.set_color_state(13)
- color = 3
+ try:
+ if self.own_nick.encode('utf-8') in txt:
+ self.set_color_state(13)
+ color = 3
+ except UnicodeDecodeError:
+ try:
+ if self.own_nick in txt:
+ self.set_color_state(13)
+ color = 3
+ except:
+ pass
else:
highlight_words = config.get('highlight_on', '').split(':')
for word in highlight_words:
@@ -87,32 +92,6 @@ class Room(object):
break
self.messages.append(Message(txt, time, nickname, user, color))
- # def add_message(nick, msg, date=None)
- # TODO: limit the message kept in memory (configurable)
-
- # if not msg:
- # logger.info('msg is None..., %s' % (nick))
- # return
- # self.lines.append((date, nick.encode('utf-8'),
- # msg.encode('utf-8'), color))
- # user = self.get_user_by_name(nick)
- # if user:
- # user.set_last_talked(date)
- # if self.joined: # log only NEW messages, not the history received on join
- # logger.message(self.name, nick.encode('utf-8'), msg.encode('utf-8'))
- # return color
-
- # def add_info(self, info, date=None):
- # """ info, like join/quit/status messages"""
- # if not date:
- # date = datetime.now()
- # try:
- # self.lines.append((date, info.encode('utf-8')))
- # return info.encode('utf-8')
- # except:
- # self.lines.append((date, info))
- # return info
-
def get_user_by_name(self, nick):
for user in self.users:
if user.nick == nick.encode('utf-8'):
@@ -120,5 +99,9 @@ class Room(object):
return None
def set_color_state(self, color):
+ """
+ Set the color that will be used to display the room's
+ number in the RoomInfo window
+ """
if self.color_state < color or color == 11:
self.color_state = color
diff --git a/src/window.py b/src/window.py
index 1b5c57ce..267c0798 100644
--- a/src/window.py
+++ b/src/window.py
@@ -429,7 +429,10 @@ class Input(Win):
self.hit_list.append(self.hit_list.pop(0)) # rotate list
end = len(begin) + len(after)
x -= end
- self.win.move(y, x)
+ try:
+ self.win.move(y, x)
+ except:
+ pass
# remove begin from the line
self.win.clrtoeol()
self.text = self.text[:-end]