remove pubmsg/privmsg overloading in Alias now that we have 'meta.skip_recursion_scan'.

also, the last commit's message should have referred to this meta option
instead of what it actually did. oops.
This commit is contained in:
Brian S. Stephan 2010-09-08 19:40:16 -05:00
parent fc8a61a110
commit 14973388e5
1 changed files with 0 additions and 66 deletions

View File

@ -28,72 +28,6 @@ class Alias(Module):
Allows for commands to be aliased as !command, circumventing bot addressing stuff.
"""
def on_pubmsg(self, connection, event):
"""
Handle pubmsg events. Does some variable setup and initial sanity checking before
calling Module.do, which should be implemented by subclasses and what can be
ultimately responsible for the work.
Reimplemented so that the recursion stuff doesn't happen (in case we want to
write an alias that would use recursion).
"""
nick = irclib.nm_to_n(event.source())
userhost = irclib.nm_to_uh(event.source())
replypath = event.target()
what = event.arguments()[0]
admin_unlocked = False
try:
if userhost == self.config.get('dr.botzo', 'admin_userhost'):
admin_unlocked = True
except NoOptionError: pass
# only do commands if the bot has been addressed directly
addressed_pattern = '^' + connection.get_nickname() + '[:,]?\s+'
addressed_re = re.compile(addressed_pattern)
need_prefix = True
try:
need_prefix = self.config.getboolean(self.__class__.__name__, 'meta.pubmsg_needs_bot_prefix')
except NoOptionError: pass
except NoSectionError: pass
if not addressed_re.match(what) and need_prefix:
return
else:
what = addressed_re.sub('', what)
# try reloading
self.reload(connection, event, nick, userhost, replypath, what, admin_unlocked)
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
def on_privmsg(self, connection, event):
"""
Handle privmsg events. Does some variable setup and initial sanity checking before
calling Module.do, which should be implemented by subclasses and what can be
ultimately responsible for the work.
Reimplemented so that the recursion stuff doesn't happen (in case we want to
write an alias that would use recursion).
"""
nick = irclib.nm_to_n(event.source())
userhost = irclib.nm_to_uh(event.source())
replypath = nick
what = event.arguments()[0]
admin_unlocked = False
try:
if userhost == self.config.get('dr.botzo', 'admin_userhost'):
admin_unlocked = True
except NoOptionError: pass
self.do(connection, event, nick, userhost, replypath, what, admin_unlocked)
def do(self, connection, event, nick, userhost, replypath, what, admin_unlocked):
"""
See if there is an alias ("!command") in the text, and if so, translate it into