mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Fix for possible bugz0r with reply.withNoticeWhenPrivate.
This commit is contained in:
parent
86106460d6
commit
3aedb305f9
@ -163,6 +163,8 @@ def reply(msg, s, prefixName=True, private=None,
|
|||||||
target = to
|
target = to
|
||||||
# XXX: User value for reply.withNoticeWhenPrivate.
|
# XXX: User value for reply.withNoticeWhenPrivate.
|
||||||
if conf.supybot.reply.withNoticeWhenPrivate(): # global, no getConfig.
|
if conf.supybot.reply.withNoticeWhenPrivate(): # global, no getConfig.
|
||||||
|
if not ircutils.isChannel(target):
|
||||||
|
# to=channel, private=True (see RSS for an example)
|
||||||
notice = True
|
notice = True
|
||||||
if to is None:
|
if to is None:
|
||||||
to = msg.nick
|
to = msg.nick
|
||||||
|
@ -443,7 +443,7 @@ class RichReplyMethodsTestCase(PluginTestCase):
|
|||||||
|
|
||||||
|
|
||||||
class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
||||||
plugins = ()
|
plugins = ('Utilities',)
|
||||||
class WithPrivateNotice(callbacks.Privmsg):
|
class WithPrivateNotice(callbacks.Privmsg):
|
||||||
def normal(self, irc, msg, args):
|
def normal(self, irc, msg, args):
|
||||||
irc.reply('should be with private notice')
|
irc.reply('should be with private notice')
|
||||||
@ -489,6 +489,18 @@ class WithPrivateNoticeTestCase(ChannelPluginTestCase):
|
|||||||
finally:
|
finally:
|
||||||
conf.supybot.reply.withNoticeWhenPrivate.setValue(orig)
|
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:
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||||
|
Loading…
Reference in New Issue
Block a user