diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-09-11 04:22:04 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-09-11 04:22:04 +0200 |
commit | b7b1faebdb52e8f041867f19f29a08f64cfaf220 (patch) | |
tree | 180c45399c1907c853bdf25585ec203c04fc8e9e /src/text_buffer.py | |
parent | 78c216cd61ab96f7476ce194323517b73b8ee04c (diff) | |
parent | ce1fb8af014e90cfc7378022c8cbdd134e45ed4a (diff) | |
download | poezio-b7b1faebdb52e8f041867f19f29a08f64cfaf220.tar.gz poezio-b7b1faebdb52e8f041867f19f29a08f64cfaf220.tar.bz2 poezio-b7b1faebdb52e8f041867f19f29a08f64cfaf220.tar.xz poezio-b7b1faebdb52e8f041867f19f29a08f64cfaf220.zip |
merge
Diffstat (limited to 'src/text_buffer.py')
-rw-r--r-- | src/text_buffer.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/text_buffer.py b/src/text_buffer.py index a3b5b1fb..a6465da3 100644 --- a/src/text_buffer.py +++ b/src/text_buffer.py @@ -27,7 +27,7 @@ from datetime import datetime import theme from config import config -Message = collections.namedtuple('Message', 'txt nick_color time nickname user') +Message = collections.namedtuple('Message', 'txt nick_color time str_time nickname user') class TextBuffer(object): """ @@ -45,8 +45,11 @@ class TextBuffer(object): self.windows.append(win) def add_message(self, txt, time=None, nickname=None, nick_color=None, history=None): + time = time or datetime.now() msg = Message(txt='%s\x19o'%(txt,), nick_color=nick_color, - time=time or datetime.now(), nickname=nickname, user=None) + time=time, str_time=time.strftime("%Y-%m-%d %H:%M:%S")\ + if history else time.strftime("%H:%M:%S"),\ + nickname=nickname, user=None) self.messages.append(msg) while len(self.messages) > self.messages_nb_limit: self.messages.pop(0) |