This commit is contained in:
Jeremy Fincher 2004-09-22 22:22:38 +00:00
parent 89f6d285b0
commit 53baabedad

View File

@ -382,6 +382,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
self.replied = True self.replied = True
self.badForce = False self.badForce = False
self.addressed = False self.addressed = False
self.calledDoPrivmsg = False
def die(self): def die(self):
self.__parent.die() self.__parent.die()
@ -475,11 +476,16 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
_karmaRe = re.compile(r'^(?:\S+|\(.+\))(?:\+\+|--)(?:\s+)?$') _karmaRe = re.compile(r'^(?:\S+|\(.+\))(?:\+\+|--)(?:\s+)?$')
def doPrivmsg(self, irc, msg): def doPrivmsg(self, irc, msg):
if msg.repliedTo: if msg.repliedTo:
self.log.debug('Returning early from doPrivmsg, msg.repliedTo.') self.log.debug('Returning early from doPrivmsg: msg.repliedTo.')
return
if ircmsgs.isCtcp(msg):
self.log.debug('Returning early from doPrivmsg: isCtcp(msg).')
return
if self.calledDoPrivmsg:
self.log.debug('Returning early from doPrivmsg: calledDoPrivmsg.')
self.calledDoPrivmsg = False
return return
try: try:
if ircmsgs.isCtcp(msg) or msg.repliedTo:
return
maybeAddressed = callbacks.addressed(irc.nick, msg, maybeAddressed = callbacks.addressed(irc.nick, msg,
whenAddressedByNick=True) whenAddressedByNick=True)
if maybeAddressed: if maybeAddressed:
@ -509,17 +515,8 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
payload = maybeForced payload = maybeForced
# Let's make sure we dump out of Infobot if the privmsg is an # Let's make sure we dump out of Infobot if the privmsg is an
# actual command otherwise we could get multiple responses. # actual command otherwise we could get multiple responses.
if self.addressed: if self.addressed and '=~' not in payload:
try: payload += '?'
tokens = callbacks.tokenize(payload)
if callbacks.findCallbackForCommand(irc, tokens[0]):
return
elif '=~' not in payload:
payload += '?'
else: # Looks like we have a doChange expression
pass
except SyntaxError:
pass
if payload.endswith(irc.nick): if payload.endswith(irc.nick):
self.addressed = True self.addressed = True
payload = payload[:-len(irc.nick)] payload = payload[:-len(irc.nick)]
@ -536,6 +533,10 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
self.badForce = False self.badForce = False
self.addressed = False self.addressed = False
def tokenizedCommand(self, irc, msg, tokens):
self.doPrivmsg(irc, msg)
self.calledDoPrivmsg = True
def callCommand(self, name, irc, msg, *L, **kwargs): def callCommand(self, name, irc, msg, *L, **kwargs):
#print '***', name, utils.stackTrace() #print '***', name, utils.stackTrace()
try: try: