summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-06-23 23:33:02 +0200
committermathieui <mathieui@mathieui.net>2011-06-23 23:33:02 +0200
commit306abbf97487d50700c1e63ca2ecba021638cf0e (patch)
tree10cb95bf48c5200096b97d3f5539611f36195faa /src
parent4e04c0bb7b4630e80829a621f01c3fd192331564 (diff)
downloadpoezio-306abbf97487d50700c1e63ca2ecba021638cf0e.tar.gz
poezio-306abbf97487d50700c1e63ca2ecba021638cf0e.tar.bz2
poezio-306abbf97487d50700c1e63ca2ecba021638cf0e.tar.xz
poezio-306abbf97487d50700c1e63ca2ecba021638cf0e.zip
Fixes #1736
Diffstat (limited to 'src')
-rw-r--r--src/core.py6
-rw-r--r--src/room.py4
-rw-r--r--src/windows.py12
3 files changed, 14 insertions, 8 deletions
diff --git a/src/core.py b/src/core.py
index df3cf0d8..f3c406ad 100644
--- a/src/core.py
+++ b/src/core.py
@@ -982,12 +982,12 @@ class Core(object):
body = xhtml.get_body_from_message_stanza(message)
if body:
date = date if delayed == True else None
- self.add_message_to_text_buffer(room, body, date, nick_from)
+ self.add_message_to_text_buffer(room, body, date, nick_from, history=True if date else False)
if tab is self.current_tab():
tab.text_win.refresh(tab._room)
self.refresh_tab_win()
- def add_message_to_text_buffer(self, room, txt, time=None, nickname=None):
+ def add_message_to_text_buffer(self, room, txt, time=None, nickname=None, history=None):
"""
Add the message to the room if possible, else, add it to the Info window
(in the Info tab of the info window in the RosterTab)
@@ -995,7 +995,7 @@ class Core(object):
if not room:
self.information('Trying to add a message in no room: %s' % txt, 'Error')
else:
- room.add_message(txt, time, nickname)
+ room.add_message(txt, time, nickname, history=history)
def command_help(self, arg):
"""
diff --git a/src/room.py b/src/room.py
index 45ebddbd..a112fc7b 100644
--- a/src/room.py
+++ b/src/room.py
@@ -95,7 +95,7 @@ class Room(TextBuffer):
"""
self.color_state = color
- def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None):
+ def add_message(self, txt, time=None, nickname=None, forced_user=None, nick_color=None, history=None):
"""
Note that user can be None even if nickname is not None. It happens
when we receive an history message said by someone who is not
@@ -130,7 +130,7 @@ class Room(TextBuffer):
self.messages.append(message)
for window in self.windows: # make the associated windows
# build the lines from the new message
- nb = window.build_new_message(message)
+ nb = window.build_new_message(message, history=history)
if window.pos != 0:
window.scroll_up(nb)
return nb
diff --git a/src/windows.py b/src/windows.py
index eb6dde43..4fa358d4 100644
--- a/src/windows.py
+++ b/src/windows.py
@@ -534,7 +534,7 @@ class TextWin(Win):
if None not in self.built_lines:
self.built_lines.append(None)
- def build_new_message(self, message):
+ def build_new_message(self, message, history=None):
"""
Take one message, build it and add it to the list
Return the number of lines that are built for the given
@@ -566,7 +566,10 @@ class TextWin(Win):
else:
txt = txt.replace('\t', ' ')
# length of the time
- offset = 9
+ if history:
+ offset = 20
+ else:
+ offset = 9
if theme.CHAR_TIME_RIGHT:
offset += 1
if theme.CHAR_TIME_RIGHT:
@@ -592,7 +595,10 @@ class TextWin(Win):
else:
color = None
if first:
- time = message.time.strftime("%H:%M:%S")
+ if history:
+ time = message.time.strftime("%Y-%m-%d %H:%M:%S")
+ else:
+ time = message.time.strftime("%H:%M:%S")
nickname = nick
else:
time = None