From 323d31514f7e438df5883ad6cb9e17cce6a296b3 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 2 May 2010 23:40:21 +0200 Subject: Added topic module --- modules/log.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'modules/log.py') diff --git a/modules/log.py b/modules/log.py index f97ad90..04ea721 100644 --- a/modules/log.py +++ b/modules/log.py @@ -5,7 +5,25 @@ class Module(ModuleBase): ModuleBase.__init__(self, manager) self.db = manager.get('mysql').db - def groupchat(self, room, message_from, message_body, reply): + def helptexts(self): + return ['Chatlogs werden auch erstellt.'] + + def groupchat(self, room, nick, text, handler): + cursor = self.db.cursor() + cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `text`) VALUES ("message", NOW(), %s, %s, %s)', (room, nick, text)) + cursor.close() + + def join(self, room, nick, show, status, handler): + cursor = self.db.cursor() + cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `show`, `text`) VALUES ("join", NOW(), %s, %s, %s, %s)', (room, nick, show, status)) + cursor.close() + + def leave(self, room, nick, show, status, handler): + cursor = self.db.cursor() + cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `show`, `text`) VALUES ("leave", NOW(), %s, %s, %s, %s)', (room, nick, show, status)) + cursor.close() + + def topic(self, room, nick, text, handler): cursor = self.db.cursor() - cursor.execute('INSERT INTO log (time, room, nick, text) VALUES (NOW(), %s, %s, %s)', (room, message_from, message_body)) + cursor.execute('INSERT INTO log (`type`, `time`, `room`, `nick`, `text`) VALUES ("topic", NOW(), %s, %s, %s)', (room, nick, text)) cursor.close() -- cgit v1.2.3