diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-10 00:54:54 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2015-07-10 00:55:13 +0200 |
commit | c839649551dd47edfebdfbfdf7be0923bf1ea8d1 (patch) | |
tree | af6f124a0c201fab9965e17289da0966206ac87f /degesch.c | |
parent | 4ddded35127135a369d1abcd7aa08ee0d94d4367 (diff) | |
download | xK-c839649551dd47edfebdfbfdf7be0923bf1ea8d1.tar.gz xK-c839649551dd47edfebdfbfdf7be0923bf1ea8d1.tar.xz xK-c839649551dd47edfebdfbfdf7be0923bf1ea8d1.zip |
degesch: add some default aliases
Diffstat (limited to 'degesch.c')
-rw-r--r-- | degesch.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -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); } } |