actually implement reply.withNoticeWhenPrivate

This commit is contained in:
James Vega 2004-08-24 19:48:01 +00:00
parent 68feda2dc2
commit 2a040b475f
2 changed files with 18 additions and 3 deletions

View File

@ -151,6 +151,8 @@ def reply(msg, s, prefixName=True, private=None,
else: else:
target = to target = to
# XXX: User value for reply.withNoticeWhenPrivate. # XXX: User value for reply.withNoticeWhenPrivate.
if getConfig(conf.supybot.reply.withNoticeWhenPrivate):
notice = True
if to is None: if to is None:
to = msg.nick to = msg.nick
# Ok, now let's make the payload: # Ok, now let's make the payload:

View File

@ -449,6 +449,9 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
def explicit(self, irc, msg, args): def explicit(self, irc, msg, args):
irc.reply('should not be with private notice', irc.reply('should not be with private notice',
private=False, notice=False) private=False, notice=False)
def implicit(self, irc, msg, args):
irc.reply('should be with notice due to private',
private=True)
def test(self): def test(self):
self.irc.addCallback(self.WithPrivateNotice()) self.irc.addCallback(self.WithPrivateNotice())
# Check normal behavior. # Check normal behavior.
@ -473,8 +476,18 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
finally: finally:
conf.supybot.reply.inPrivate.setValue(originalInPrivate) conf.supybot.reply.inPrivate.setValue(originalInPrivate)
conf.supybot.reply.withNotice.setValue(originalWithNotice) conf.supybot.reply.withNotice.setValue(originalWithNotice)
orig = conf.supybot.reply.withNoticeWhenPrivate()
try:
conf.supybot.reply.withNoticeWhenPrivate.setValue(True)
m = self.assertNotError('implicit')
self.failUnless(m.command == 'NOTICE')
self.failIf(ircutils.isChannel(m.args[0]))
m = self.assertNotError('normal')
self.failIf(m.command == 'NOTICE')
self.failUnless(ircutils.isChannel(m.args[0]))
finally:
conf.supybot.reply.withNoticeWhenPrivate.setValue(orig)
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: # vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78: