degesch: add an /unalias command
This commit is contained in:
parent
8f1d81eefb
commit
30252e069d
24
degesch.c
24
degesch.c
|
@ -6856,6 +6856,27 @@ handle_command_alias (struct handler_args *a)
|
||||||
return true;
|
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
|
static bool
|
||||||
handle_command_msg (struct handler_args *a)
|
handle_command_msg (struct handler_args *a)
|
||||||
{
|
{
|
||||||
|
@ -7455,6 +7476,9 @@ g_command_handlers[] =
|
||||||
{ "alias", "List or set aliases",
|
{ "alias", "List or set aliases",
|
||||||
"[<name> <definition>]",
|
"[<name> <definition>]",
|
||||||
handle_command_alias, 0 },
|
handle_command_alias, 0 },
|
||||||
|
{ "unalias", "Unset aliases",
|
||||||
|
"<name>...",
|
||||||
|
handle_command_unalias, 0 },
|
||||||
|
|
||||||
{ "msg", "Send message to a nick or channel",
|
{ "msg", "Send message to a nick or channel",
|
||||||
"<target> <message>",
|
"<target> <message>",
|
||||||
|
|
Loading…
Reference in New Issue