mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-20 09:29:24 +01:00
actually implement reply.withNoticeWhenPrivate
This commit is contained in:
parent
68feda2dc2
commit
2a040b475f
@ -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:
|
||||||
|
@ -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,7 +476,17 @@ 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)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user