mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Changed the name of IrcObjectProxy to something more indicative of what it does.
This commit is contained in:
parent
c66e7b3e6e
commit
e1d3c5e537
@ -519,7 +519,7 @@ class RichReplyMethods(object):
|
|||||||
|
|
||||||
_repr = repr
|
_repr = repr
|
||||||
|
|
||||||
class IrcReplyProxy(RichReplyMethods):
|
class ReplyIrcProxy(RichReplyMethods):
|
||||||
"""This class is a thin wrapper around an irclib.Irc object that gives it
|
"""This class is a thin wrapper around an irclib.Irc object that gives it
|
||||||
the reply() and error() methods (as well as everything in RichReplyMethods,
|
the reply() and error() methods (as well as everything in RichReplyMethods,
|
||||||
based on those two)."""
|
based on those two)."""
|
||||||
@ -569,9 +569,9 @@ class IrcReplyProxy(RichReplyMethods):
|
|||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self.irc, attr)
|
return getattr(self.irc, attr)
|
||||||
|
|
||||||
SimpleProxy = IrcReplyProxy # Backwards-compatibility
|
SimpleProxy = ReplyIrcProxy # Backwards-compatibility
|
||||||
|
|
||||||
class IrcObjectProxy(IrcReplyProxy):
|
class NestedCommandsIrcProxy(ReplyIrcProxy):
|
||||||
"A proxy object to allow proper nested of commands (even threaded ones)."
|
"A proxy object to allow proper nested of commands (even threaded ones)."
|
||||||
_mores = ircutils.IrcDict()
|
_mores = ircutils.IrcDict()
|
||||||
def __init__(self, irc, msg, args, nested=0):
|
def __init__(self, irc, msg, args, nested=0):
|
||||||
@ -580,7 +580,7 @@ class IrcObjectProxy(IrcReplyProxy):
|
|||||||
self.msg = msg
|
self.msg = msg
|
||||||
self.nested = nested
|
self.nested = nested
|
||||||
if not self.nested and isinstance(irc, self.__class__):
|
if not self.nested and isinstance(irc, self.__class__):
|
||||||
# This means we were given an IrcObjectProxy isntead of an
|
# This means we were given an NestedCommandsIrcProxy instead of an
|
||||||
# irclib.Irc, and so we're obviously nested. But nested wasn't
|
# irclib.Irc, and so we're obviously nested. But nested wasn't
|
||||||
# set! So we take our given Irc's nested value.
|
# set! So we take our given Irc's nested value.
|
||||||
self.nested += irc.nested
|
self.nested += irc.nested
|
||||||
@ -633,14 +633,14 @@ class IrcObjectProxy(IrcReplyProxy):
|
|||||||
self.counter += 1
|
self.counter += 1
|
||||||
else:
|
else:
|
||||||
assert isinstance(self.args[self.counter], list)
|
assert isinstance(self.args[self.counter], list)
|
||||||
# It's a list. So we spawn another IrcObjectProxy
|
# It's a list. So we spawn another NestedCommandsIrcProxy
|
||||||
# to evaluate its args. When that class has finished
|
# to evaluate its args. When that class has finished
|
||||||
# evaluating its args, it will call our reply method, which
|
# evaluating its args, it will call our reply method, which
|
||||||
# will subsequently call this function again, and we'll
|
# will subsequently call this function again, and we'll
|
||||||
# pick up where we left off via self.counter.
|
# pick up where we left off via self.counter.
|
||||||
self.__class__(self, self.msg,
|
self.__class__(self, self.msg,
|
||||||
self.args[self.counter], nested=self.nested+1)
|
self.args[self.counter], nested=self.nested+1)
|
||||||
# We have to return here because the new IrcObjectProxy
|
# We have to return here because the new NestedCommandsIrcProxy
|
||||||
# might not have called our reply method instantly, since
|
# might not have called our reply method instantly, since
|
||||||
# its command might be threaded. So (obviously) we can't
|
# its command might be threaded. So (obviously) we can't
|
||||||
# just fall through to self.finalEval.
|
# just fall through to self.finalEval.
|
||||||
@ -721,7 +721,7 @@ class IrcObjectProxy(IrcReplyProxy):
|
|||||||
def finalEval(self):
|
def finalEval(self):
|
||||||
# Now that we've already iterated through our args and made sure
|
# Now that we've already iterated through our args and made sure
|
||||||
# that any list of args was evaluated (by spawning another
|
# that any list of args was evaluated (by spawning another
|
||||||
# IrcObjectProxy to evaluated it into a string), we can finally
|
# NestedCommandsIrcProxy to evaluated it into a string), we can finally
|
||||||
# evaluated our own list of arguments.
|
# evaluated our own list of arguments.
|
||||||
assert not self.finalEvaled, 'finalEval called twice.'
|
assert not self.finalEvaled, 'finalEval called twice.'
|
||||||
self.finalEvaled = True
|
self.finalEvaled = True
|
||||||
@ -809,8 +809,8 @@ class IrcObjectProxy(IrcReplyProxy):
|
|||||||
prefixName=self.prefixName,
|
prefixName=self.prefixName,
|
||||||
noLengthCheck=self.noLengthCheck)
|
noLengthCheck=self.noLengthCheck)
|
||||||
elif self.noLengthCheck:
|
elif self.noLengthCheck:
|
||||||
# noLengthCheck only matters to IrcObjectProxy, so it's not
|
# noLengthCheck only matters to NestedCommandsIrcProxy, so
|
||||||
# used here. Just in case you were wondering.
|
# it's not used here. Just in case you were wondering.
|
||||||
m = reply(msg, s, to=self.to,
|
m = reply(msg, s, to=self.to,
|
||||||
notice=self.notice,
|
notice=self.notice,
|
||||||
action=self.action,
|
action=self.action,
|
||||||
@ -922,6 +922,7 @@ class IrcObjectProxy(IrcReplyProxy):
|
|||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
return getattr(self.irc, attr)
|
return getattr(self.irc, attr)
|
||||||
|
|
||||||
|
IrcObjectProxy = NestedCommandsIrcProxy
|
||||||
|
|
||||||
class CommandThread(world.SupyThread):
|
class CommandThread(world.SupyThread):
|
||||||
"""Just does some extra logging and error-recovery for commands that need
|
"""Just does some extra logging and error-recovery for commands that need
|
||||||
@ -1164,7 +1165,7 @@ class PluginMixin(BasePlugin, irclib.IrcCallback):
|
|||||||
threaded = False
|
threaded = False
|
||||||
noIgnore = False
|
noIgnore = False
|
||||||
classModule = None
|
classModule = None
|
||||||
Proxy = IrcObjectProxy
|
Proxy = NestedCommandsIrcProxy
|
||||||
def __init__(self, irc):
|
def __init__(self, irc):
|
||||||
myName = self.name()
|
myName = self.name()
|
||||||
self.log = log.getPluginLogger(myName)
|
self.log = log.getPluginLogger(myName)
|
||||||
|
Loading…
Reference in New Issue
Block a user