plugin text-commands: fixed name conflicts management + plugin parrot: removed now done TODO

This commit is contained in:
Goffi 2014-03-24 13:49:37 +01:00
commit 9ac686c0a9
2 changed files with 2 additions and 5 deletions

View file

@ -131,9 +131,6 @@ class Exp_Parrot(object):
def cmd_parrot(self, mess_data, profile):
"""activate Parrot mode between 2 entities, in both directions."""
#TODO: these commands must not be hardcoded, an interface should be made
# to allow plugins to register simple commands like this.
debug("Catched parrot command")
txt_cmd = self.host.plugins[C.TEXT_CMDS]

View file

@ -66,9 +66,9 @@ class TextCommands(object):
warning(_("Skipping cmd_ method"))
if cmd_name in self._commands:
suff=2
while (cmd_name + suff) in self._commands:
while (cmd_name + str(suff)) in self._commands:
suff+=1
new_name = cmd_name + suff
new_name = cmd_name + str(suff)
warning(_("Conflict for command [%(old_name)s], renaming it to [%(new_name)s]") % {'old_name': cmd_name, 'new_name': new_name})
cmd_name = new_name
self._commands[cmd_name] = cmd