degesch: add an /unalias command

This commit is contained in:
Přemysl Eric Janouch 2015-07-11 03:07:57 +02:00
parent 8f1d81eefb
commit 30252e069d
1 changed files with 24 additions and 0 deletions

View File

@ -6856,6 +6856,27 @@ handle_command_alias (struct handler_args *a)
return true;
}
static bool
handle_command_unalias (struct handler_args *a)
{
if (!*a->arguments)
return false;
struct str_map *aliases = get_aliases_config (a->ctx);
while (*a->arguments)
{
char *name = cut_word (&a->arguments);
if (!str_map_find (aliases, name))
log_global_error (a->ctx, "No such alias: #s", name);
else
{
str_map_set (aliases, name, NULL);
log_global_status (a->ctx, "Alias removed: #s", name);
}
}
return true;
}
static bool
handle_command_msg (struct handler_args *a)
{
@ -7455,6 +7476,9 @@ g_command_handlers[] =
{ "alias", "List or set aliases",
"[<name> <definition>]",
handle_command_alias, 0 },
{ "unalias", "Unset aliases",
"<name>...",
handle_command_unalias, 0 },
{ "msg", "Send message to a nick or channel",
"<target> <message>",