aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-07-11 03:07:57 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-07-11 03:29:52 +0200
commit30252e069d49b83033a7faf006b3b82dd1815ab1 (patch)
tree293c1b09e35183dbe587c27d91f591559ce15a21
parent8f1d81eefbfe61330a62642893b7e35ce0c3398a (diff)
downloadxK-30252e069d49b83033a7faf006b3b82dd1815ab1.tar.gz
xK-30252e069d49b83033a7faf006b3b82dd1815ab1.tar.xz
xK-30252e069d49b83033a7faf006b3b82dd1815ab1.zip
degesch: add an /unalias command
-rw-r--r--degesch.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index 0b709bb..34a7975 100644
--- a/degesch.c
+++ b/degesch.c
@@ -6857,6 +6857,27 @@ handle_command_alias (struct handler_args *a)
}
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)
{
if (!*a->arguments)
@@ -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>",