Fix for possible bugz0r with reply.withNoticeWhenPrivate.

This commit is contained in:
Jeremy Fincher 2004-08-30 04:35:51 +00:00
parent 86106460d6
commit 3aedb305f9
2 changed files with 16 additions and 2 deletions

View File

@ -163,6 +163,8 @@ def reply(msg, s, prefixName=True, private=None,
target = to
# XXX: User value for reply.withNoticeWhenPrivate.
if conf.supybot.reply.withNoticeWhenPrivate(): # global, no getConfig.
if not ircutils.isChannel(target):
# to=channel, private=True (see RSS for an example)
notice = True
if to is None:
to = msg.nick

View File

@ -443,7 +443,7 @@ class RichReplyMethodsTestCase(PluginTestCase):
class WithPrivateNoticeTestCase(ChannelPluginTestCase):
plugins = ()
plugins = ('Utilities',)
class WithPrivateNotice(callbacks.Privmsg):
def normal(self, irc, msg, args):
irc.reply('should be with private notice')
@ -489,6 +489,18 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
finally:
conf.supybot.reply.withNoticeWhenPrivate.setValue(orig)
def testWithNoticeWhenPrivateNotChannel(self):
original = conf.supybot.reply.withNoticeWhenPrivate()
try:
conf.supybot.reply.withNoticeWhenPrivate.setValue(True)
m = self.assertNotError("eval irc.reply('y',to='x',private=True)")
self.failUnless(m.command == 'NOTICE')
m = self.getMsg(' ')
m = self.assertNotError("eval irc.reply('y',to='#x',private=True)")
self.failIf(m.command == 'NOTICE')
finally:
conf.supybot.reply.withNoticeWhenPrivate.setValue(original)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: