Made IrcObjectProxy.error respect conf.errorReplyPrivate.

This commit is contained in:
Jeremy Fincher 2003-09-22 09:45:23 +00:00
parent babe4cc230
commit a1da1ba14d
2 changed files with 24 additions and 1 deletions

View File

@ -430,7 +430,11 @@ class IrcObjectProxy:
if isinstance(self.irc, self.__class__):
self.irc.error(msg, s)
else:
self.irc.queueMsg(reply(msg, 'Error: ' + s))
s = 'Error: ' + s
if conf.errorReplyPrivate:
self.irc.queueMsg(ircmsgs.privmsg(msg.nick, s))
else:
self.irc.queueMsg(reply(msg, s))
def killProxy(self):
if not isinstance(self.irc, irclib.Irc):

View File

@ -160,5 +160,24 @@ class PrivmsgTestCase(ChannelPluginTestCase):
self.assertResponse("eval irc.reply(msg, 'foo', action=True)",
'\x01ACTION foo\x01')
def testErrorReplyPrivate(self):
try:
originalConfErrorReplyPrivate = conf.errorReplyPrivate
conf.errorReplyPrivate = False
# If this doesn't raise an error, we've got a problem, so the next
# two assertions shouldn't run. So we first check that what we
# expect to error actually does so we don't go on a wild goose
# chase because our command never errored in the first place :)
s = 're s/foo/bar baz' # will error; should be "re s/foo/bar/ baz"
self.assertError(s)
m = self.getMsg(s)
self.failUnless(ircutils.isChannel(m.args[0]))
conf.errorReplyPrivate = True
m = self.getMsg(s)
self.failIf(ircutils.isChannel(m.args[0]))
finally:
conf.errorReplyPrivate = originalConfErrorReplyPrivate
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: