modify the karma_modify header:

* remove parameters i never intended to be necessary for the function in the first place
* return a string, rather than doing the reply thing
This commit is contained in:
Brian S. Stephan 2010-12-08 22:05:46 -06:00
parent 4013a93dc9
commit 7fa9c1f9a0

View File

@ -113,17 +113,17 @@ class Karma(Module):
key = match.group(1) if match.group(1) else match.group(2) key = match.group(1) if match.group(1) else match.group(2)
value = match.group(3) value = match.group(3)
if (value == '++'): if (value == '++'):
return self.karma_modify(key, 1, connection, nick, userhost, replypath) return self.karma_modify(key, 1, nick, userhost)
elif (value == '--'): elif (value == '--'):
return self.karma_modify(key, -1, connection, nick, userhost, replypath) return self.karma_modify(key, -1, nick, userhost)
elif (value == '+-'): elif (value == '+-'):
self.karma_modify(key, 1, connection, nick, userhost, replypath) self.karma_modify(key, 1, nick, userhost)
return self.karma_modify(key, -1, connection, nick, userhost, replypath) return self.karma_modify(key, -1, nick, userhost)
elif (value == '-+'): elif (value == '-+'):
self.karma_modify(key, -1, connection, nick, userhost, replypath) self.karma_modify(key, -1, nick, userhost)
return self.karma_modify(key, 1, connection, nick, userhost, replypath) return self.karma_modify(key, 1, nick, userhost)
def karma_modify(self, key, value, connection, nick, userhost, replypath): def karma_modify(self, key, value, nick, userhost):
""" """
Go out to the database and update the karma value. Go out to the database and update the karma value.
""" """
@ -138,7 +138,7 @@ class Karma(Module):
conn.commit() conn.commit()
except sqlite3.Error as e: except sqlite3.Error as e:
conn.rollback() conn.rollback()
return self.reply(connection, replypath, "sqlite error: " + str(e)) return "sqlite error: " + str(e)
def handle_report_query(self, connection, nick, userhost, replypath, what): def handle_report_query(self, connection, nick, userhost, replypath, what):
match = self.reportre.search(what) match = self.reportre.search(what)