mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 20:52:42 +01:00
__parented some classes.
This commit is contained in:
parent
65e469ba38
commit
28753856eb
@ -529,6 +529,7 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
commandArgs = ['self', 'irc', 'msg', 'args']
|
commandArgs = ['self', 'irc', 'msg', 'args']
|
||||||
_mores = {} # This must be class-scope, so all subclasses use the same one.
|
_mores = {} # This must be class-scope, so all subclasses use the same one.
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.__parent = super(Privmsg, self)
|
||||||
self.Proxy = IrcObjectProxy
|
self.Proxy = IrcObjectProxy
|
||||||
canonicalname = canonicalName(self.name())
|
canonicalname = canonicalName(self.name())
|
||||||
self._original = getattr(self, canonicalname, None)
|
self._original = getattr(self, canonicalname, None)
|
||||||
@ -588,11 +589,11 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
def __call__(self, irc, msg):
|
def __call__(self, irc, msg):
|
||||||
if msg.command == 'PRIVMSG':
|
if msg.command == 'PRIVMSG':
|
||||||
if self.noIgnore or not ircdb.checkIgnored(msg.prefix,msg.args[0]):
|
if self.noIgnore or not ircdb.checkIgnored(msg.prefix,msg.args[0]):
|
||||||
irclib.IrcCallback.__call__(self, irc, msg)
|
self.__parent.__call__(irc, msg)
|
||||||
else:
|
else:
|
||||||
debug.msg('Ignoring %s.' % msg.prefix)
|
debug.msg('Ignoring %s.' % msg.prefix)
|
||||||
else:
|
else:
|
||||||
irclib.IrcCallback.__call__(self, irc, msg)
|
self.__parent.__call__(irc, msg)
|
||||||
|
|
||||||
def isCommand(self, methodName):
|
def isCommand(self, methodName):
|
||||||
# This function is ugly, but I don't want users to call methods like
|
# This function is ugly, but I don't want users to call methods like
|
||||||
@ -618,7 +619,7 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
debug.msg('%s took %s seconds' % (funcname, elapsed), 'verbose')
|
debug.msg('%s took %s seconds' % (funcname, elapsed), 'verbose')
|
||||||
|
|
||||||
|
|
||||||
class IrcObjectProxyRegexp:
|
class IrcObjectProxyRegexp(object):
|
||||||
def __init__(self, irc, *args):
|
def __init__(self, irc, *args):
|
||||||
self.irc = irc
|
self.irc = irc
|
||||||
|
|
||||||
@ -661,7 +662,8 @@ class PrivmsgRegexp(Privmsg):
|
|||||||
flags = re.I
|
flags = re.I
|
||||||
commandArgs = ['self', 'irc', 'msg', 'match']
|
commandArgs = ['self', 'irc', 'msg', 'match']
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Privmsg.__init__(self)
|
self.__parent = super(PrivmsgRegexp, self)
|
||||||
|
self.__parent.__init__()
|
||||||
self.Proxy = IrcObjectProxyRegexp
|
self.Proxy = IrcObjectProxyRegexp
|
||||||
self.res = []
|
self.res = []
|
||||||
#for name, value in self.__class__.__dict__.iteritems():
|
#for name, value in self.__class__.__dict__.iteritems():
|
||||||
@ -680,7 +682,7 @@ class PrivmsgRegexp(Privmsg):
|
|||||||
|
|
||||||
def callCommand(self, method, irc, msg, *L):
|
def callCommand(self, method, irc, msg, *L):
|
||||||
try:
|
try:
|
||||||
Privmsg.callCommand(self, method, irc, msg, *L)
|
self.__parent.callCommand(method, irc, msg, *L)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
debug.recoverableException()
|
debug.recoverableException()
|
||||||
irc.error(msg, debug.exnToString(e))
|
irc.error(msg, debug.exnToString(e))
|
||||||
@ -707,7 +709,8 @@ class PrivmsgCommandAndRegexp(Privmsg):
|
|||||||
regexps = ()
|
regexps = ()
|
||||||
addressedRegexps = ()
|
addressedRegexps = ()
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Privmsg.__init__(self)
|
self.__parent = super(PrivmsgCommandAndRegexp, self)
|
||||||
|
self.__parent.__init__()
|
||||||
self.res = []
|
self.res = []
|
||||||
self.addressedRes = []
|
self.addressedRes = []
|
||||||
for name in self.regexps:
|
for name in self.regexps:
|
||||||
@ -721,7 +724,7 @@ class PrivmsgCommandAndRegexp(Privmsg):
|
|||||||
|
|
||||||
def callCommand(self, f, irc, msg, *L, **kwargs):
|
def callCommand(self, f, irc, msg, *L, **kwargs):
|
||||||
try:
|
try:
|
||||||
Privmsg.callCommand(self, f, irc, msg, *L)
|
self.__parent.callCommand(f, irc, msg, *L)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
if 'catchErrors' in kwargs and kwargs['catchErrors']:
|
if 'catchErrors' in kwargs and kwargs['catchErrors']:
|
||||||
irc.error(msg, debug.exnToString(e))
|
irc.error(msg, debug.exnToString(e))
|
||||||
|
Loading…
Reference in New Issue
Block a user