move the karma logging into a separate method, since i'm about to reuse it in a new way

This commit is contained in:
Brian S. Stephan 2010-11-19 09:26:49 -06:00
parent 12d5425644
commit 50e45b2a0d
1 changed files with 7 additions and 2 deletions

View File

@ -88,9 +88,14 @@ class Karma(Module):
key = match.group(1) if match.group(1) else match.group(2)
value = match.group(3)
if (value == '++'):
value = 1;
return self.karma_modify(key, 1, nick, userhost)
else:
value = -1;
return self.karma_modify(key, -1, nick, userhost)
def karma_modify(self, key, value, nick, userhost):
"""
Go out to the database and update the karma value.
"""
conn = self.get_db()
try: