Added something to stop assertion errors in case of ChanServ stuff.

This commit is contained in:
Jeremy Fincher 2003-04-20 01:40:55 +00:00
parent f6392d4806
commit 4b3c9162b9

View File

@ -154,7 +154,10 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
cursor = db.cursor()
cursor.execute("""UPDATE channel_stats SET joins=joins+1""")
try:
if ircutils.isUserHostmask(msg.prefix):
name = ircdb.users.getUserName(msg.prefix)
else:
name = msg.prefix
cursor.execute("""UPDATE user_stats
SET joins=joins+1
WHERE name=%s""", name)
@ -168,7 +171,10 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
cursor = db.cursor()
cursor.execute("""UPDATE channel_stats SET parts=parts+1""")
try:
if ircutils.isUserHostmask(msg.prefix):
name = ircdb.users.getUserName(msg.prefix)
else:
name = msg.prefix
cursor.execute("UPDATE user_stats SET parts=parts+1 WHERE name=%s",
name)
except KeyError:
@ -181,7 +187,10 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
cursor = db.cursor()
cursor.execute("""UPDATE channel_stats SET topics=topics+1""")
try:
if ircutils.isUserHostmask(msg.prefix):
name = ircdb.users.getUserName(msg.prefix)
else:
name = msg.prefix
cursor.execute("""UPDATE user_stats
SET topics=topics+1
WHERE name=%s""", name)
@ -195,7 +204,10 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
cursor = db.cursor()
cursor.execute("""UPDATE channel_stats SET modes=modes+1""")
try:
if ircutils.isUserHostmask(msg.prefix):
name = ircdb.users.getUserName(msg.prefix)
else:
name = msg.prefix
cursor.execute("""UPDATE user_stats
SET modes=modes+1
WHERE name=%s""", name)
@ -209,7 +221,10 @@ class ChannelStats(callbacks.Privmsg, ChannelDBHandler):
cursor = db.cursor()
cursor.execute("""UPDATE channel_stats SET kicks=kicks+1""")
try:
if ircutils.isUserHostmask(msg.prefix):
name = ircdb.users.getUserName(msg.prefix)
else:
name = msg.prefix
cursor.execute("""UPDATE user_stats
SET kicks=kicks+1
WHERE name=%s""", name)