From bcdc8ecb007e485f9a1069d31475cff7afd583cd Mon Sep 17 00:00:00 2001 From: James McCoy Date: Mon, 5 Dec 2011 23:13:09 -0500 Subject: [PATCH] Prevent nesting of Misc.tell Signed-off-by: James McCoy (cherry picked from commit 5b4c150d037ddfcd7358e00850178a4b60fd44b8) Signed-off-by: Daniel Folkinshteyn --- plugins/Misc/plugin.py | 2 ++ plugins/Misc/test.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/plugins/Misc/plugin.py b/plugins/Misc/plugin.py index 650b28312..de42dbf66 100644 --- a/plugins/Misc/plugin.py +++ b/plugins/Misc/plugin.py @@ -404,6 +404,8 @@ class Misc(callbacks.Plugin): Tells the whatever is. Use nested commands to your benefit here. """ + if irc.nested: + irc.error('This command cannot be nested.', Raise=True) if target.lower() == 'me': target = msg.nick if ircutils.isChannel(target): diff --git a/plugins/Misc/test.py b/plugins/Misc/test.py index 2479cb96f..a90e97a87 100644 --- a/plugins/Misc/test.py +++ b/plugins/Misc/test.py @@ -142,6 +142,9 @@ class MiscTestCase(ChannelPluginTestCase): m = self.getMsg('tell me you love me') self.failUnless(m.args[0] == self.nick) + def testNoNestedTell(self): + self.assertRegexp('echo [tell %s foo]' % self.nick, 'nested') + def testTellDoesNotPropogateAction(self): m = self.getMsg('tell foo [action bar]') self.failIf(ircmsgs.isAction(m))