summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 22:33:01 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-06-12 22:33:01 +0000
commit3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16 (patch)
treeed0212dd41c327e317f9600eb0fca4819ad64661 /src
parent981e12a669424d5685e11104ad03b82a2aac05cd (diff)
downloadpoezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.gz
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.bz2
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.tar.xz
poezio-3a0ff72c7a56ba9478ca60cbc2a695a992c9ed16.zip
fix an infinie loop on empty line, and the bug with the history message said by a nickname not present anymore
Diffstat (limited to 'src')
-rw-r--r--src/gui.py4
-rw-r--r--src/message.py2
-rw-r--r--src/window.py26
3 files changed, 15 insertions, 17 deletions
diff --git a/src/gui.py b/src/gui.py
index a5563cc9..6c84ebbf 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -321,9 +321,9 @@ Avail: Sets your availability to available and (optional) sets your status
"""
Display the error on the room window
"""
+ # if not error:
+ # return
room = self.get_room_by_name(room)
- if not error:
- return
code = error.getAttr('code')
typ = error.getAttr('type')
body = error.getTag('text').getData()
diff --git a/src/message.py b/src/message.py
index efa934b4..a95d12b0 100644
--- a/src/message.py
+++ b/src/message.py
@@ -70,8 +70,6 @@ class Line(object):
Line(None, None, None, "http://blablablabla", 0, 23)
"""
def __init__(self, nickname, nickname_color, time, text, text_color, text_offset):
- from common import debug
- # debug("Line: %s, %s, %s '%s', %s, %s\n" % (nickname, nickname_color, str(time), text, text_color, text_offset))
self.nickname = nickname
self.nickname_color = nickname_color
self.time = time
diff --git a/src/window.py b/src/window.py
index 6334fb2c..e981c04e 100644
--- a/src/window.py
+++ b/src/window.py
@@ -184,6 +184,7 @@ class TextWin(Win):
for message in messages:
txt = message.txt
offset = 11 # length of the time
+ debug(str(message.nickname) + ' : '+message.txt + '\n')
if message.nickname and len(message.nickname) >= 30:
nick = message.nickname[:30]+u'…'
else:
@@ -198,17 +199,14 @@ class TextWin(Win):
# debug("=================="+str(limit))
else:
limit = self.width-offset-1
- if first and message.user:
- line = Line(nick, message.user.color,
- message.time,
- txt[:limit], message.color,
- offset)
- else:
- line = Line(None, None,
- message.time,
- txt[:limit], message.color,
- offset)
- lines.append(line)
+ if limit == 0:
+ break
+ color = message.user.color if message.user else None
+ l = Line(nick, color,
+ message.time,
+ txt[:limit], message.color,
+ offset)
+ lines.append(l)
txt = txt[limit:]
first = False
return lines[-len(messages):]# return only the needed number of lines
@@ -271,9 +269,11 @@ class TextWin(Win):
Write the nickname, using the user's color
and return the number of written characters
"""
- self.win.attron(curses.color_pair(color))
+ if color:
+ self.win.attron(curses.color_pair(color))
self.win.addstr(nickname)
- self.win.attroff(curses.color_pair(color))
+ if color:
+ self.win.attroff(curses.color_pair(color))
self.win.addnstr("> ", 2)
def write_time(self, time):