summaryrefslogtreecommitdiffstats
path: root/modules/log.py
blob: 74e813ab30c31a65eb767fb49a8bb9d9fe777af0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from . import ModuleBase

class Module(ModuleBase):
    def __init__(self, manager):
        ModuleBase.__init__(self, manager)
        self.pgsql = manager.get('pgsql')
    
    def helptexts(self):
        return ['Chatlogs werden auch erstellt.']
    
    def groupchat(self, room, nick, text, handler):
        cursor = self.pgsql.cursor()
        cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'message\', now(), %s, %s, %s)', (room, nick, text))
        cursor.close()
        self.pgsql.commit()

    def join(self, room, nick, show, status, handler):
        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))
        cursor.close()
        self.pgsql.commit()

    def leave(self, room, nick, show, status, handler):
        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))
        cursor.close()
        self.pgsql.commit()
    
    def topic(self, room, nick, text, handler):
        cursor = self.pgsql.cursor()
        cursor.execute('INSERT INTO log ("type", "time", "room", "nick", "text") VALUES (\'topic\', now(), %s, %s, %s)', (room, nick, text))
        cursor.close()
        self.pgsql.commit()