From 30252e069d49b83033a7faf006b3b82dd1815ab1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Janouch?= Date: Sat, 11 Jul 2015 03:07:57 +0200 Subject: [PATCH] degesch: add an /unalias command --- degesch.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/degesch.c b/degesch.c index 0b709bb..34a7975 100644 --- a/degesch.c +++ b/degesch.c @@ -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", "[ ]", handle_command_alias, 0 }, + { "unalias", "Unset aliases", + "...", + handle_command_unalias, 0 }, { "msg", "Send message to a nick or channel", " ",