handle silly +- syntax, which will do both an increment and a decrement

(this won't impact the overall rank, of course, but does create log
entries that may be interesting for later analysis
This commit is contained in:
Brian S. Stephan 2010-11-19 09:33:37 -06:00
parent 50e45b2a0d
commit daa018c64b

View File

@ -34,7 +34,7 @@ class Karma(Module):
Module.__init__(self, config, server, modlist)
pattern = "(?:(\S+)|\((.+)\))"
karmapattern = pattern + '(\+\+|--)' + '(\s+|$)'
karmapattern = pattern + '(\+\+|--|\+-)' + '(\s+|$)'
querypattern = '^rank\s+(.*)'
self.karmare = re.compile(karmapattern)
@ -89,7 +89,10 @@ class Karma(Module):
value = match.group(3)
if (value == '++'):
return self.karma_modify(key, 1, nick, userhost)
else:
elif (value == '--'):
return self.karma_modify(key, -1, nick, userhost)
elif (value == '+-'):
self.karma_modify(key, 1, nick, userhost)
return self.karma_modify(key, -1, nick, userhost)
def karma_modify(self, key, value, nick, userhost):