mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 02:49:27 +01:00
Fix for possible bugz0r with reply.withNoticeWhenPrivate.
This commit is contained in:
parent
86106460d6
commit
3aedb305f9
@ -163,7 +163,9 @@ def reply(msg, s, prefixName=True, private=None,
|
||||
target = to
|
||||
# XXX: User value for reply.withNoticeWhenPrivate.
|
||||
if conf.supybot.reply.withNoticeWhenPrivate(): # global, no getConfig.
|
||||
notice = True
|
||||
if not ircutils.isChannel(target):
|
||||
# to=channel, private=True (see RSS for an example)
|
||||
notice = True
|
||||
if to is None:
|
||||
to = msg.nick
|
||||
# Ok, now let's make the payload:
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user