summaryrefslogtreecommitdiff
path: root/src/plugins/alias
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2009-09-30 17:58:56 +0200
committerSebastien Helleu <flashcode@flashtux.org>2009-09-30 17:58:56 +0200
commitae1326431415a1908454e89340b08a049072fa69 (patch)
tree3cd7801fece3a755af0d2eaccca64fb3e0187c4f /src/plugins/alias
parent5a0a2cfcb99afa0199bc918d346420feb514d386 (diff)
downloadweechat-ae1326431415a1908454e89340b08a049072fa69.zip
Allow /unalias to remove multiple aliases (patch #6926)
Diffstat (limited to 'src/plugins/alias')
-rw-r--r--src/plugins/alias/alias-info.c2
-rw-r--r--src/plugins/alias/alias.c57
2 files changed, 32 insertions, 27 deletions
diff --git a/src/plugins/alias/alias-info.c b/src/plugins/alias/alias-info.c
index 956322506..eee1ca7ea 100644
--- a/src/plugins/alias/alias-info.c
+++ b/src/plugins/alias/alias-info.c
@@ -93,6 +93,6 @@ void
alias_info_init ()
{
/* alias infolist hooks */
- weechat_hook_infolist ("alias", N_("list of alias"),
+ weechat_hook_infolist ("alias", N_("list of aliases"),
&alias_info_get_infolist_cb, NULL);
}
diff --git a/src/plugins/alias/alias.c b/src/plugins/alias/alias.c
index 9413109fe..cfe71282b 100644
--- a/src/plugins/alias/alias.c
+++ b/src/plugins/alias/alias.c
@@ -810,6 +810,7 @@ int
unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
+ int i;
char *alias_name;
struct t_alias *ptr_alias;
struct t_config_option *ptr_option;
@@ -821,30 +822,34 @@ unalias_command_cb (void *data, struct t_gui_buffer *buffer, int argc,
if (argc > 1)
{
- alias_name = (argv[1][0] == '/') ? argv[1] + 1 : argv[1];
- ptr_alias = alias_search (alias_name);
- if (!ptr_alias)
+ for (i = 1; i < argc; i++)
{
- weechat_printf (NULL,
- _("%sAlias \"%s\" not found"),
- weechat_prefix ("error"),
- alias_name);
- return WEECHAT_RC_ERROR;
+ alias_name = (argv[i][0] == '/') ? argv[i] + 1 : argv[i];
+ ptr_alias = alias_search (alias_name);
+ if (!ptr_alias)
+ {
+ weechat_printf (NULL,
+ _("%sAlias \"%s\" not found"),
+ weechat_prefix ("error"),
+ alias_name);
+ }
+ else
+ {
+ /* remove alias */
+ alias_free (ptr_alias);
+
+ /* remove option */
+ ptr_option = weechat_config_search_option (alias_config_file,
+ alias_config_section_cmd,
+ alias_name);
+ if (ptr_option)
+ weechat_config_option_free (ptr_option);
+
+ weechat_printf (NULL,
+ _("Alias \"%s\" removed"),
+ alias_name);
+ }
}
-
- /* remove alias */
- alias_free (ptr_alias);
-
- /* remove option */
- ptr_option = weechat_config_search_option (alias_config_file,
- alias_config_section_cmd,
- alias_name);
- if (ptr_option)
- weechat_config_option_free (ptr_option);
-
- weechat_printf (NULL,
- _("Alias \"%s\" removed"),
- alias_name);
}
return WEECHAT_RC_OK;
}
@@ -944,13 +949,13 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
"%(alias) %(commands)",
&alias_command_cb, NULL);
- weechat_hook_command ("unalias", N_("remove an alias"),
- N_("alias_name"),
+ weechat_hook_command ("unalias", N_("remove aliases"),
+ N_("alias_name [alias_name...]"),
N_("alias_name: name of alias to remove"),
- "%(alias)",
+ "%(alias)|%*",
&unalias_command_cb, NULL);
- weechat_hook_completion ("alias", N_("list of alias"),
+ weechat_hook_completion ("alias", N_("list of aliases"),
&alias_completion_cb, NULL);
alias_info_init ();