Update Encyclopedia

Make sure Lart, Mess, Webcal and IRCLogin all work when defaultIgnore is True
This commit is contained in:
Terence Simpson 2008-09-28 02:55:23 +01:00
parent 95544ba73f
commit 4105f4f2db
6 changed files with 104 additions and 1 deletions

View File

@ -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()

View File

@ -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):

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -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