More __parent fixes.

This commit is contained in:
James Vega 2004-09-19 23:51:21 +00:00
parent e2bb35e02a
commit 4f09fad147
10 changed files with 33 additions and 23 deletions

View File

@ -140,12 +140,13 @@ class Dunno(callbacks.Privmsg):
responses."""
callAfter = ['MoobotFactoids']
def __init__(self):
super(Dunno, self).__init__()
self.__parent = super(Dunno, self)
self.__parent.__init__()
self.db = DunnoDB()
def die(self):
self.db.close()
super(Dunno, self).die()
self.__parent.die()
def invalidCommand(self, irc, msg, tokens):
channel = msg.args[0]

View File

@ -88,7 +88,8 @@ conf.registerChannelValue(conf.supybot.plugins.Herald, 'throttleTimeAfterPart',
class Herald(callbacks.Privmsg):
def __init__(self):
super(Herald, self).__init__()
self.__parent = super(Herald, self)
self.__parent.__init__()
self.db = HeraldDB(filename)
world.flushers.append(self.db.flush)
self.lastParts = plugins.ChannelUserDictionary()
@ -98,7 +99,7 @@ class Herald(callbacks.Privmsg):
if self.db.flush in world.flushers:
world.flushers.remove(self.db.flush)
self.db.close()
super(Herald, self).die()
self.__parent.die()
def doJoin(self, irc, msg):
channel = msg.args[0]

View File

@ -371,7 +371,8 @@ class Dunno(Exception):
class Infobot(callbacks.PrivmsgCommandAndRegexp):
regexps = ['doForget', 'doChange', 'doFactoid', 'doUnknown']
def __init__(self):
super(Infobot, self).__init__()
self.__parent = super(Infobot, self)
self.__parent.__init__()
try:
self.db = InfobotDB()
except Exception:
@ -385,7 +386,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
self.addressed = False
def die(self):
super(Infobot, self).die()
self.__parent.die()
self.db.close()
def _error(self, s):
@ -530,7 +531,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
self.log.debug('Bailing since we received an empty msg.')
return
msg = ircmsgs.IrcMsg(args=(msg.args[0], payload), msg=msg)
super(Infobot, self).doPrivmsg(irc, msg)
self.__parent.doPrivmsg(irc, msg)
finally:
self.force = False
self.replied = False
@ -542,7 +543,7 @@ class Infobot(callbacks.PrivmsgCommandAndRegexp):
try:
self.irc = irc
self.msg = msg
super(Infobot, self).callCommand(name, irc, msg, *L, **kwargs)
self.__parent.callCommand(name, irc, msg, *L, **kwargs)
finally:
self.irc = None
self.msg = None

View File

@ -227,11 +227,12 @@ KarmaDB = plugins.DB('Karma',
class Karma(callbacks.Privmsg):
callBefore = ('Factoids', 'MoobotFactoids', 'Infobot')
def __init__(self):
super(Karma, self).__init__()
self.__parent = super(Karma, self)
self.__parent.__init__()
self.db = KarmaDB()
def die(self):
super(Karma, self).die()
self.__parent.die()
self.db.close()
def _normalizeThing(self, thing):

View File

@ -176,12 +176,13 @@ NewsDB = plugins.DB('News',
class News(callbacks.Privmsg):
def __init__(self):
super(News, self).__init__()
self.__parent = super(News, self)
self.__parent.__init__()
self.db = NewsDB()
self.removeOld = False
def die(self):
super(News, self).die()
self.__parent.die()
self.db.close()
def add(self, irc, msg, args, channel):

View File

@ -161,11 +161,12 @@ NoteDB = plugins.DB('Note', {'flat': DbiNoteDB})
class Note(callbacks.Privmsg):
def __init__(self):
super(Note, self).__init__()
self.__parent= super(Note, self)
self.__parent.__init__()
self.db = NoteDB()
def die(self):
super(Note, self).die()
self.__parent.die()
self.db.close()
def doPrivmsg(self, irc, msg):

View File

@ -201,11 +201,12 @@ QuotesDB = plugins.DB('Quotes',
class Quotes(callbacks.Privmsg):
def __init__(self):
super(Quotes, self).__init__()
self.__parent = super(Quotes, self)
self.__parent.__init__()
self.db = QuotesDB()
def die(self):
super(Quotes, self).die()
self.__parent.die()
self.db.close()
def add(self, irc, msg, args):

View File

@ -86,7 +86,8 @@ class Seen(callbacks.Privmsg):
def __init__(self):
self.db = SeenDB(filename)
world.flushers.append(self.db.flush)
super(Seen, self).__init__()
self.__parent = super(Seen, self)
self.__parent.__init__()
def die(self):
if self.db.flush in world.flushers:
@ -94,7 +95,7 @@ class Seen(callbacks.Privmsg):
else:
self.log.debug('Odd, no flush in flushers: %r', world.flushers)
self.db.close()
super(Seen, self).die()
self.__parent.die()
def doPrivmsg(self, irc, msg):
if ircutils.isChannel(msg.args[0]):

View File

@ -131,14 +131,15 @@ class Sourceforge(callbacks.PrivmsgCommandAndRegexp):
_projectURL = 'http://sourceforge.net/projects/'
_trackerURL = 'http://sourceforge.net/support/tracker.php?aid='
def __init__(self):
super(Sourceforge, self).__init__()
self.__parent = super(Sourceforge, self)
self.__parent.__init__()
self.__class__.sf = self.__class__.sourceforge
def isCommand(self, name):
if name in ('bug', 'rfe', 'patch'):
return self.registryValue('enableSpecificTrackerCommands')
else:
return super(Sourceforge, self).isCommand(name)
return self.__parent.isCommand(name)
def _formatResp(self, text, num=''):
"""

View File

@ -178,7 +178,8 @@ filename=os.path.join(conf.supybot.directories.data(), 'WordStats.db')
class WordStats(callbacks.Privmsg):
noIgnore = True
def __init__(self):
super(WordStats, self).__init__()
self.__parent = super(WordStats, self)
self.__parent.__init__()
self.db = WordStatsDB(filename)
self.queried = False
world.flushers.append(self.db.flush)
@ -187,11 +188,11 @@ class WordStats(callbacks.Privmsg):
if self.db.flush in world.flushers:
world.flushers.remove(self.db.flush)
self.db.close()
super(WordStats, self).die()
self.__parent.die()
def callCommand(self, *args, **kwargs):
self.queried = True
return super(WordStats, self).callCommand(*args, **kwargs)
return self.__parent.callCommand(*args, **kwargs)
def doPrivmsg(self, irc, msg):
# This depends on the fact that it's called after the command.