This commit is contained in:
Jeremy Fincher 2003-11-10 23:39:44 +00:00
parent 4cc9579582
commit c50e27a278

View File

@ -62,6 +62,7 @@ frownre = re.compile('|'.join(map(re.escape, frowns)))
class ChannelDB(callbacks.Privmsg, class ChannelDB(callbacks.Privmsg,
plugins.Configurable, plugins.Configurable,
plugins.ChannelDBHandler): plugins.ChannelDBHandler):
noIgnore = True
configurables = plugins.ConfigurableDictionary( configurables = plugins.ConfigurableDictionary(
[('self-stats', plugins.ConfigurableTypes.bool, True, [('self-stats', plugins.ConfigurableTypes.bool, True,
"""Determines whether the bot will keep channel statistics on itself, """Determines whether the bot will keep channel statistics on itself,
@ -115,7 +116,8 @@ class ChannelDB(callbacks.Privmsg,
quits INTEGER quits INTEGER
)""") )""")
cursor.execute("""CREATE TABLE nick_seen ( cursor.execute("""CREATE TABLE nick_seen (
name TEXT UNIQUE ON CONFLICT REPLACE, name TEXT,
normalized TEXT UNIQUE ON CONFLICT REPLACE,
last_seen TIMESTAMP, last_seen TIMESTAMP,
last_msg TEXT last_msg TEXT
)""") )""")
@ -202,8 +204,8 @@ class ChannelDB(callbacks.Privmsg,
msgs=msgs+1, msgs=msgs+1,
actions=actions+%s""", actions=actions+%s""",
smileys, frowns, chars, words, int(isAction)) smileys, frowns, chars, words, int(isAction))
cursor.execute("""INSERT INTO nick_seen VALUES (%s, %s, %s)""", cursor.execute("""INSERT INTO nick_seen VALUES (%s, %s, %s, %s)""",
msg.nick, int(time.time()), s) msg.nick,ircutils.toLower(msg.nick),int(time.time()),s)
try: try:
if self.outFiltering: if self.outFiltering:
id = 0 id = 0
@ -359,7 +361,8 @@ class ChannelDB(callbacks.Privmsg,
return return
else: else:
table = 'nick_seen' table = 'nick_seen'
criterion = 'nickeq(name,%s)' criterion = 'normalized=%s'
name = ircutils.toLower(name)
sql = "SELECT last_seen,last_msg FROM %s WHERE %s" % (table,criterion) sql = "SELECT last_seen,last_msg FROM %s WHERE %s" % (table,criterion)
#debug.printf(sql) #debug.printf(sql)
cursor.execute(sql, name) cursor.execute(sql, name)