From ff33a84de722c62af1268421133c7376eb35c4f6 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Sun, 13 Jun 2010 02:19:01 +0000 Subject: logs work. fixed #1108 --- src/logging.py | 5 ++++- src/room.py | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/logging.py b/src/logging.py index aa466348..42a82760 100644 --- a/src/logging.py +++ b/src/logging.py @@ -68,7 +68,10 @@ class Logger(object): makedirs(dir) except:pass fd = open(dir+room, 'a') - fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick+': '+msg+'\n') + if nick: + fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+nick.encode('utf-8')+': '+msg.encode('utf-8')+'\n') + else: + fd.write(datetime.now().strftime('%d-%m-%y [%H:%M:%S] ')+'* '+msg.encode('utf-8')+'\n') fd.close() logger = Logger() diff --git a/src/room.py b/src/room.py index 8cd7a0f8..28f8cfad 100644 --- a/src/room.py +++ b/src/room.py @@ -64,6 +64,8 @@ class Room(object): when we receive an history message said by someone who is not in the room anymore """ + if time == None and self.joined: # don't log the history messages + logger.message(self.name, nickname, txt) user = self.get_user_by_name(nickname) if nickname is not None else None if user: user.set_last_talked(datetime.now()) -- cgit v1.2.3