Prevent nesting of Misc.tell

Signed-off-by: James McCoy <jamessan@users.sourceforge.net>
This commit is contained in:
James McCoy 2011-12-05 23:13:09 -05:00
parent 360a2036ac
commit 5b4c150d03
2 changed files with 5 additions and 0 deletions

View File

@ -381,6 +381,8 @@ class Misc(callbacks.Plugin):
Tells the <nick> whatever <text> is. Use nested commands to your Tells the <nick> whatever <text> is. Use nested commands to your
benefit here. benefit here.
""" """
if irc.nested:
irc.error('This command cannot be nested.', Raise=True)
if target.lower() == 'me': if target.lower() == 'me':
target = msg.nick target = msg.nick
if ircutils.isChannel(target): if ircutils.isChannel(target):

View File

@ -142,6 +142,9 @@ class MiscTestCase(ChannelPluginTestCase):
m = self.getMsg('tell me you love me') m = self.getMsg('tell me you love me')
self.failUnless(m.args[0] == self.nick) self.failUnless(m.args[0] == self.nick)
def testNoNestedTell(self):
self.assertRegexp('echo [tell %s foo]' % self.nick, 'nested')
def testTellDoesNotPropogateAction(self): def testTellDoesNotPropogateAction(self):
m = self.getMsg('tell foo [action bar]') m = self.getMsg('tell foo [action bar]')
self.failIf(ircmsgs.isAction(m)) self.failIf(ircmsgs.isAction(m))