From 4105f4f2dbfdf952e490b5e4ad331380b1727bc0 Mon Sep 17 00:00:00 2001 From: Terence Simpson Date: Sun, 28 Sep 2008 02:55:23 +0100 Subject: [PATCH] Update Encyclopedia Make sure Lart, Mess, Webcal and IRCLogin all work when defaultIgnore is True --- Encyclopedia/factoids.cgi | 2 +- Encyclopedia/plugin.py | 1 + IRCLogin/plugin.py | 6 ++++++ Lart/plugin.py | 32 ++++++++++++++++++++++++++++++++ Mess/plugin.py | 31 +++++++++++++++++++++++++++++++ Webcal/plugin.py | 33 +++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 1 deletion(-) diff --git a/Encyclopedia/factoids.cgi b/Encyclopedia/factoids.cgi index 236cb10..000beaa 100755 --- a/Encyclopedia/factoids.cgi +++ b/Encyclopedia/factoids.cgi @@ -40,7 +40,7 @@ total = 0 # Read POST if 'db' in form: database = form['db'].value -if database not in database: +if database not in databases: database = default_database con = sqlite.connect(os.path.join(datadir, database + '.db')) cur = con.cursor() diff --git a/Encyclopedia/plugin.py b/Encyclopedia/plugin.py index f8b5dfe..9ff0e5b 100644 --- a/Encyclopedia/plugin.py +++ b/Encyclopedia/plugin.py @@ -198,6 +198,7 @@ class Encyclopedia(callbacks.Plugin): self.databases[channel] = sqlite.connect(os.path.join(self.registryValue('datadir'), '%s.db' % db)) self.databases[channel].name = db self.databases[channel].time = time.time() + self.log.info(os.path.join(self.registryValue('datadir'), '%s.db' % db)) return self.databases[channel] def addressed(self, recipients, text, irc): diff --git a/IRCLogin/plugin.py b/IRCLogin/plugin.py index b3c540c..c43296b 100644 --- a/IRCLogin/plugin.py +++ b/IRCLogin/plugin.py @@ -163,6 +163,12 @@ launchpad""" return to = msg.args[0] cmd = msg.args[1] + try: + user = ircdb.users.getUser(msg.prefix) + if user.checkHostmask(msg.prefix): + return + except: + pass if to.lower() == irc.nick.lower(): if cmd != "login": return diff --git a/Lart/plugin.py b/Lart/plugin.py index 369d7fe..0ad53e1 100644 --- a/Lart/plugin.py +++ b/Lart/plugin.py @@ -95,6 +95,38 @@ class Lart(plugins.ChannelIdDatabasePlugin): pity = lart slander = lart + def callPrecedence(self, irc): + before = [] + for cb in irc.callbacks: + if cb.name() == 'IRCLogin': + before.append(cb) + return (before, []) + + def inFilter(self, irc, msg): + if not msg.command == 'PRIVMSG': + return msg + if not conf.supybot.defaultIgnore(): + return msg + s = callbacks.addressed(irc.nick, msg) + if not s: + return msg + if checkIgnored(msg.prefix): + return msg + try: + id = ircdb.users.getUserId(msg.prefix) + user = users.getUser(id) + return msg + except: + pass + cmd, args = (s.split(None, 1) + [None])[:2] + if cmd and cmd[0] in str(conf.supybot.reply.whenAddressedBy.chars.get(msg.args[0])): + cmd = cmd[1:] + if cmd in self.listCommands(): + tokens = callbacks.tokenize(s, channel=msg.args[0]) + self.Proxy(irc, msg, tokens) + return msg +# self._callCommand([cmd], irc, msg, []) + Class = Lart # vim:set shiftwidth=4 tabstop=4 expandtab textwidth=79: diff --git a/Mess/plugin.py b/Mess/plugin.py index 0d5bacc..0f2e4e7 100644 --- a/Mess/plugin.py +++ b/Mess/plugin.py @@ -239,4 +239,35 @@ class Mess(callbacks.PluginRegexp): irc.reply("No %s can't have a pony, %s!" % (text, msg.nick)) pony = wrap(pony, [additional('text')]) + def callPrecedence(self, irc): + before = [] + for cb in irc.callbacks: + if cb.name() == 'IRCLogin': + before.append(cb) + return (before, []) + + def inFilter(self, irc, msg): + if not msg.command == 'PRIVMSG': + return msg + if not conf.supybot.defaultIgnore(): + return msg + s = callbacks.addressed(irc.nick, msg) + if not s: + return msg + if checkIgnored(msg.prefix): + return msg + try: + id = ircdb.users.getUserId(msg.prefix) + user = users.getUser(id) + return msg + except: + pass + cmd, args = (s.split(None, 1) + [None])[:2] + if cmd and cmd[0] in str(conf.supybot.reply.whenAddressedBy.chars.get(msg.args[0])): + cmd = cmd[1:] + if cmd in self.listCommands(): + tokens = callbacks.tokenize(s, channel=msg.args[0]) + self.Proxy(irc, msg, tokens) + return msg +# self._callCommand([cmd], irc, msg, []) Class = Mess diff --git a/Webcal/plugin.py b/Webcal/plugin.py index 228d3a0..098c6f2 100644 --- a/Webcal/plugin.py +++ b/Webcal/plugin.py @@ -216,4 +216,37 @@ class Webcal(callbacks.Plugin): url = self.registryValue('url', c) irc.reply("The topic of %s is managed by me and filled with the contents of %s - please don't change manually" % (msg.args[0],url), private=True) + + def callPrecedence(self, irc): + before = [] + for cb in irc.callbacks: + if cb.name() == 'IRCLogin': + before.append(cb) + return (before, []) + + def inFilter(self, irc, msg): + if not msg.command == 'PRIVMSG': + return msg + if not conf.supybot.defaultIgnore(): + return msg + s = callbacks.addressed(irc.nick, msg) + if not s: + return msg + if checkIgnored(msg.prefix): + return msg + try: + id = ircdb.users.getUserId(msg.prefix) + user = users.getUser(id) + return msg + except: + pass + cmd, args = (s.split(None, 1) + [None])[:2] + if cmd and cmd[0] in str(conf.supybot.reply.whenAddressedBy.chars.get(msg.args[0])): + cmd = cmd[1:] + if cmd in self.listCommands(): + tokens = callbacks.tokenize(s, channel=msg.args[0]) + self.Proxy(irc, msg, tokens) + return msg +# self._callCommand([cmd], irc, msg, []) + Class = Webcal