This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
curunir/modules/log.py

34 lines
1.4 KiB
Python
Raw Normal View History

from . import ModuleBase
2010-05-02 21:18:09 +02:00
class Module(ModuleBase):
def __init__(self, manager):
ModuleBase.__init__(self, manager)
2011-09-05 22:40:46 +02:00
self.pgsql = manager.get('pgsql')
2010-05-02 21:18:09 +02:00
2010-05-02 23:40:21 +02:00
def helptexts(self):
return ['Chatlogs werden auch erstellt.']
def groupchat(self, room, nick, text, handler):
2011-09-05 22:40:46 +02:00
cursor = self.pgsql.cursor()
cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'message\', now(), %s, %s, %s)', (room, nick, text))
2010-05-02 23:40:21 +02:00
cursor.close()
2011-09-05 22:40:46 +02:00
self.pgsql.commit()
2010-05-02 23:40:21 +02:00
def join(self, room, nick, show, status, handler):
2011-09-05 22:40:46 +02:00
cursor = self.pgsql.cursor()
cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "show", "text") VALUES (\'join\', now(), %s, %s, %s, %s)', (room, nick, show, status))
2010-05-02 23:40:21 +02:00
cursor.close()
2011-09-05 22:40:46 +02:00
self.pgsql.commit()
2010-05-02 23:40:21 +02:00
def leave(self, room, nick, show, status, handler):
2011-09-05 22:40:46 +02:00
cursor = self.pgsql.cursor()
cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "show", "text") VALUES (\'leave\', now(), %s, %s, %s, %s)', (room, nick, show, status))
2010-05-02 23:40:21 +02:00
cursor.close()
2011-09-05 22:40:46 +02:00
self.pgsql.commit()
2010-05-02 23:40:21 +02:00
def topic(self, room, nick, text, handler):
2011-09-05 22:40:46 +02:00
cursor = self.pgsql.cursor()
cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'topic\', now(), %s, %s, %s)', (room, nick, text))
2010-05-02 21:51:15 +02:00
cursor.close()
2011-09-05 22:40:46 +02:00
self.pgsql.commit()