aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--degesch.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/degesch.c b/degesch.c
index ed49617..7e50ad9 100644
--- a/degesch.c
+++ b/degesch.c
@@ -8598,6 +8598,34 @@ show_first_time_help (struct app_context *ctx)
log_global_indent (ctx, "#m", g_first_time_help[i]);
}
+const char *g_default_aliases[][2] =
+{
+ { "c", "/buffer clear" }, { "close", "/buffer close" },
+ { "j", "/join $*" }, { "p", "/part $*" },
+ { "k", "/kick $*" }, { "kb", "/kickban $*" },
+ { "m", "/msg $*" }, { "q", "/query $*" },
+ { "n", "/names $*" }, { "t", "/topic $*" },
+ { "w", "/who $*" }, { "wi", "/whois $*" },
+ { "ww", "/whowas $*" },
+};
+
+static void
+load_default_aliases (struct app_context *ctx)
+{
+ struct str_map *aliases =
+ &config_item_get (ctx->config.root, "aliases", NULL)->value.object;
+ for (size_t i = 0; i < N_ELEMENTS (g_default_aliases); i++)
+ {
+ const char **pair = g_default_aliases[i];
+
+ struct str tmp;
+ str_init (&tmp);
+ str_append (&tmp, pair[1]);
+ str_map_set (aliases, pair[0], config_item_string (&tmp));
+ str_free (&tmp);
+ }
+}
+
static void
load_configuration (struct app_context *ctx)
{
@@ -8627,6 +8655,7 @@ load_configuration (struct app_context *ctx)
else
{
show_first_time_help (ctx);
+ load_default_aliases (ctx);
}
}