diff --git a/plugins/Aka/plugin.py b/plugins/Aka/plugin.py index 1747ef50e..1290f9614 100644 --- a/plugins/Aka/plugin.py +++ b/plugins/Aka/plugin.py @@ -242,6 +242,12 @@ class Aka(callbacks.Plugin): def isCommandMethod(self, name): if sys.version_info[0] < 3 and isinstance(name, str): name = name.decode('utf8') + args = name.split(' ') + if len(args) > 1 and \ + callbacks.canonicalName(args[0]) != self.canonicalName(): + for cb in dynamic.irc.callbacks: # including this plugin + if cb.getCommand(args[0:-1]): + return False channel = dynamic.channel or 'global' return self._db.has_aka(channel, name) or \ self._db.has_aka('global', name) or \ diff --git a/plugins/Aka/test.py b/plugins/Aka/test.py index ff0edea16..afa500e89 100644 --- a/plugins/Aka/test.py +++ b/plugins/Aka/test.py @@ -151,8 +151,19 @@ class AkaChannelTestCase(ChannelPluginTestCase): self.assertNotError('aka add "foo bar" "echo spam"') self.assertResponse('foo bar', 'spam') self.assertNotError('aka add "foo" "echo egg"') - self.assertResponse('foo bar', 'spam') self.assertResponse('foo', 'egg') + # You could expect 'spam' here, but in fact, this is dangerous. + # Just imagine this session: + # aka add "echo foo" quit + # The operation succeeded. + # ... + # echo foo + # * bot has quit + self.assertResponse('foo bar', 'egg') + + def testNoOverride(self): + self.assertNotError('aka add "echo foo" "echo bar"') + self.assertResponse('echo foo', 'foo') def testRecursivity(self): self.assertNotError('aka add fact '