Ejemplo n.º 1
0
 def logChat(self, result, status, timeNow, msg, flag):
     status = 0 # we don't really need this
     #msg = msg.decode('utf-8')
     sql = 'INSERT INTO IrcChat VALUES(DEFAULT, %s, %s, %s, %s, %s)'
     binds = (result, status, timeNow, msg, flag)
     database.operate(sql, binds)
     # we need to return the keyId for the next deferred (if any)
     return defer.succeed(result)
Ejemplo n.º 2
0
 def logSay(self, channel, msg):
     """ Log and send out message """
     sql = 'INSERT INTO IrcChat VALUES(?, ?, ?, ?, ?, ?)'
     msgd = msg.decode('utf-8')
     binds = (None, 1, 3, round(time.time(), 2), msgd, 1)
     d = database.operate(sql, binds) # must be in unicode
     self.say(channel, msg) # must not be in unicode
Ejemplo n.º 3
0
 def logSay(self, channel, msg, action):
     """ Log and send out message """
     sql = 'INSERT INTO IrcChat VALUES(?, ?, ?, ?, ?, ?)'
     msgd = msg.decode('utf-8')
     # flag 1 = Yukari sent (0 for receive)
     # flag 3 = Yukari sent + action (2 for action)
     flag = 1 if not action else 3
     binds = (None, 1, 3, getTime(), msgd, flag)
     d = database.operate(sql, binds)  # must be in unicode
     if not action:
         self.say(channel, msg)  # must not be in unicode
     else:
         self.describe(channel, msg)
Ejemplo n.º 4
0
 def logSay(self, channel, msg, action):
     """ Log and send out message """
     sql = 'INSERT INTO IrcChat VALUES(DEFAULT, %s, %s, %s, %s, %s)'
     msgd = msg.decode('utf-8')
     # flag 1 = Yukari sent (0 for receive)
     # flag 3 = Yukari sent + action (2 for action)
     flag = 1 if not action else 3
     binds = (1, 3, getTime(), msgd, flag)
     d = database.operate(sql, binds) # must be in unicode
     if not action:
         self.say(channel, msg) # must not be in unicode
     else:
         self.describe(channel, msg)
Ejemplo n.º 5
0
 def logChat(self, result, status, timeNow, msg, flag):
     status = 0  # we don't really need this
     #msg = msg.decode('utf-8')
     sql = 'INSERT INTO IrcChat VALUES(?, ?, ?, ?, ?, ?)'
     binds = (None, result, status, timeNow, msg, flag)
     return database.operate(sql, binds)
Ejemplo n.º 6
0
 def logIrcUser(self, nickname, username, host):
     """ logs IRC chat to IrcChat table """
     sql = 'INSERT OR IGNORE INTO IrcUser VALUES(?, ?, ?, ?, ?, ?)'
     binds = (None, nickname.lower(), username, host, nickname, 0)
     return database.operate(sql, binds)
Ejemplo n.º 7
0
 def dbIncrementSubAttempt(self, cy, username, rank):
     sql = ('UPDATE Sms SET subAttempts=subAttempts + 1 WHERE userId= '
          '(SELECT userId FROM CyUser WHERE nameLower=? AND registered=?)')
     binds = (username.lower(), 1 if rank else 0)
     return database.operate(sql, binds)
Ejemplo n.º 8
0
 def dbWriteSubAttempt(self, cy, username, rank):
     sql = ('INSERT INTO Sms (userId) VALUES '
            '((SELECT userId FROM CyUser WHERE nameLower=? AND registered=?))')
     binds = (username.lower(), 1 if rank else 0)
     return database.operate(sql, binds)
Ejemplo n.º 9
0
 def logChat(self, result, status, timeNow, msg):
     status = 0 # we don't really need this
     msg = msg.decode('utf-8')
     sql = 'INSERT INTO IrcChat VALUES(?, ?, ?, ?, ?, ?)'
     binds = (None, result, status, timeNow, msg, None)
     return database.operate(sql, binds)
Ejemplo n.º 10
0
 def logIrcUser(self, nickname, username, host):
     """ logs IRC chat to IrcChat table """
     sql = 'INSERT OR IGNORE INTO IrcUser VALUES(?, ?, ?, ?, ?, ?)'
     binds = (None, nickname.lower(), username, host, nickname, 0)
     return database.operate(sql, binds)