Let's ignore things that look like karma adjustments

This commit is contained in:
James Vega 2004-08-27 16:05:33 +00:00
parent 94c43c5040
commit b2b0e26e59

View File

@ -432,10 +432,15 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
return s return s
_forceRe = re.compile(r'^no[,: -]+', re.I) _forceRe = re.compile(r'^no[,: -]+', re.I)
_karmaRe = re.compile(r'^\S+(?:\+\+|--)(?:\s+)?$')
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
try: try:
if ircmsgs.isCtcp(msg): if ircmsgs.isCtcp(msg):
return return
# probably not necessary, but we'll see what the debug logs show
if getattr(irc, 'finished', False):
self.log.debug('Received a finished irc object. Bailing.')
return
maybeAddressed = callbacks.addressed(irc.nick, msg, maybeAddressed = callbacks.addressed(irc.nick, msg,
whenAddressedByNick=True) whenAddressedByNick=True)
if maybeAddressed: if maybeAddressed:
@ -443,6 +448,9 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
payload = maybeAddressed payload = maybeAddressed
else: else:
payload = msg.args[1] payload = msg.args[1]
if self._karmaRe.search(payload):
self.log.debug('Not snarfing a karma adjustment.')
return
payload = self.normalize(payload) payload = self.normalize(payload)
maybeForced = self._forceRe.sub('', payload) maybeForced = self._forceRe.sub('', payload)
if maybeForced != payload: if maybeForced != payload: