Reverted back to non-exception-raising irc.error.

This commit is contained in:
Jeremy Fincher 2003-04-02 07:27:32 +00:00
parent 952b7b6517
commit 806a45a936

View File

@ -265,13 +265,15 @@ class IrcObjectProxy:
if isinstance(self.irc, self.__class__): if isinstance(self.irc, self.__class__):
self.irc.reply(msg, s) self.irc.reply(msg, s)
else: else:
if ircutils.funkyArgument(s):
s = repr(s)
self.irc.queueMsg(reply(msg, s)) self.irc.queueMsg(reply(msg, s))
else: else:
self.args[self.counter] = s self.args[self.counter] = s
self.evalArgs() self.evalArgs()
def error(self, msg, s): def error(self, msg, s):
raise Error, s self.reply(msg, 'Error: ' + s)
def killProxy(self): def killProxy(self):
if not isinstance(self.irc, irclib.Irc): if not isinstance(self.irc, irclib.Irc):
@ -288,10 +290,6 @@ class IrcObjectProxy:
return getattr(self.irc, attr) return getattr(self.irc, attr)
class IrcObjectProxyThreaded(IrcObjectProxy):
def error(self, msg, s):
self.reply(msg, 'Error: ' + s)
class CommandThread(threading.Thread): class CommandThread(threading.Thread):
def __init__(self, command, irc, msg, args): def __init__(self, command, irc, msg, args):
name = '%s.%s with args %r' % (command.im_class.__name__, name = '%s.%s with args %r' % (command.im_class.__name__,
@ -319,9 +317,6 @@ class Privmsg(irclib.IrcCallback):
commandArgs = ['self', 'irc', 'msg', 'args'] commandArgs = ['self', 'irc', 'msg', 'args']
def __init__(self): def __init__(self):
self.rateLimiter = RateLimiter() self.rateLimiter = RateLimiter()
if self.threaded:
self.Proxy = IrcObjectProxyThreaded
else:
self.Proxy = IrcObjectProxy self.Proxy = IrcObjectProxy
def __call__(self, irc, msg): def __call__(self, irc, msg):
@ -379,7 +374,7 @@ class IrcObjectProxyRegexp:
self.irc = irc self.irc = irc
def error(self, msg, s): def error(self, msg, s):
raise Error, s self.reply(msg, 'Error: ' + s)
def reply(self, msg, s): def reply(self, msg, s):
self.irc.queueMsg(reply(msg, s)) self.irc.queueMsg(reply(msg, s))
@ -388,11 +383,6 @@ class IrcObjectProxyRegexp:
return getattr(self.irc, attr) return getattr(self.irc, attr)
class IrcObjectProxyRegexpThreaded(IrcObjectProxyRegexp):
def error(self, msg, s):
self.irc.queueMsg(reply(msg, 'Error: ' + s))
class PrivmsgRegexp(Privmsg): class PrivmsgRegexp(Privmsg):
"""A class to allow a person to create regular expression callbacks. """A class to allow a person to create regular expression callbacks.
@ -417,9 +407,6 @@ class PrivmsgRegexp(Privmsg):
flags = re.I flags = re.I
def __init__(self): def __init__(self):
Privmsg.__init__(self) Privmsg.__init__(self)
if self.threaded:
self.Proxy = IrcObjectProxyRegexpThreaded
else:
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():