summaryrefslogtreecommitdiff
path: root/plugins/alias.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
committermathieui <mathieui@mathieui.net>2013-03-08 22:53:35 +0100
commit9885203c6799c121f5bc8a733dc1937fe8c1b4d6 (patch)
tree4190635a7c9c78d2dce1a4c8357ccb887f12b8af /plugins/alias.py
parentdbde08a5267cf003d8a4a9c16f5b18275e9a4bd1 (diff)
downloadpoezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.gz
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.bz2
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.tar.xz
poezio-9885203c6799c121f5bc8a733dc1937fe8c1b4d6.zip
Update the plugins to use the PluginAPI
Also: - Add get_conversation_messages() to PluginAPI - Make plugins_autoload colon-separated instead of space-separated (for consistency) - Replace a JID() with a safeJID() in the uptime plugin
Diffstat (limited to 'plugins/alias.py')
-rw-r--r--plugins/alias.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/plugins/alias.py b/plugins/alias.py
index 4d4a3bf4..a3843f35 100644
--- a/plugins/alias.py
+++ b/plugins/alias.py
@@ -10,11 +10,11 @@ from common import shell_split
class Plugin(BasePlugin):
def init(self):
- self.add_command('alias', self.command_alias,
+ self.api.add_command('alias', self.command_alias,
usage='<alias> <command> [args]',
short='Create an alias command',
help='Create an alias for <command> with [args].')
- self.add_command('unalias', self.command_unalias,
+ self.api.add_command('unalias', self.command_unalias,
usage='<alias>',
help='Remove a previously created alias',
short='Remove an alias',
@@ -36,8 +36,9 @@ class Plugin(BasePlugin):
if alias in self.core.commands or alias in self.commands:
self.api.information('Alias: command already exists', 'Error')
return
- self.commands[alias] = lambda arg: self.get_command(command)(tmp_args.format(*shell_split(arg)))
- self.add_command(alias, self.commands[alias], 'This command is an alias for /%s %s' %( command, tmp_args))
+
+ self.commands[alias] = lambda arg: self.get_command(command)(tmp_args + arg)
+ self.api.add_command(alias, self.commands[alias], 'This command is an alias for /%s %s' %( command, tmp_args))
self.api.information('Alias /%s successfuly created' % alias, 'Info')
def command_unalias(self, alias):
@@ -46,7 +47,7 @@ class Plugin(BasePlugin):
"""
if alias in self.commands:
del self.commands[alias]
- self.del_command(alias)
+ self.api.del_command(alias)
self.api.information('Alias /%s successfuly deleted' % alias, 'Info')
def completion_unalias(self, the_input):