hirc

IRC client
Log | Files | Refs

commit 46934e2612a3c71264943c3ee94c722065a654ef
parent 078631ce68770a1778fd71c27bc3264084633625
Author: hhvn <dev@hhvn.uk>
Date:   Wed, 15 Dec 2021 23:47:01 +0000

s/config.c s/commands.c s/ui.c: help formats

Diffstat:
Msrc/commands.c | 20++++++++++----------
Msrc/config.c | 15+++++++++++++++
Msrc/ui.c | 3+++
3 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/src/commands.c b/src/commands.c @@ -742,16 +742,18 @@ command_help(struct Server *server, char *str) { } if (strcmp(str, "commands") == 0) { - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :Commands:"); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_START :%s", str); for (i=0; commands[i].name && commands[i].func; i++) - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI : /%s", commands[i].name); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP : /%s", commands[i].name); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_END :end of help"); return; } if (strcmp(str, "variables") == 0) { - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :Variables:"); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_START :%s", str); for (i=0; config[i].name; i++) hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI : %s", config[i].name); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_END :end of help"); return; } @@ -762,11 +764,10 @@ command_help(struct Server *server, char *str) { for (i=0; commands[i].name && commands[i].func; i++) { if (strcmp(commands[i].name, str) == 0) { - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :%s", str); - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :==="); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_START :%s", str); for (j=0; commands[i].description[j]; j++) - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :%s", commands[i].description[j]); - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :"); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP :%s", commands[i].description[j]); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_END :end of help"); return; } } @@ -774,11 +775,10 @@ command_help(struct Server *server, char *str) { if (!cmdonly) { for (i=0; config[i].name; i++) { if (strcmp(config[i].name, str) == 0) { - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :%s", str); - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :==="); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_START :%s", str); for (j=0; config[i].description[j]; j++) hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :%s", config[i].description[j]); - hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_UI :"); + hist_format(selected.history, Activity_none, HIST_SHOW|HIST_TMP|HIST_MAIN, "SELF_HELP_END :end of help"); return; } } diff --git a/src/config.c b/src/config.c @@ -289,6 +289,21 @@ struct Config config[] = { .strhandle = config_redraws, .description = { "Format of footer of /alias output", NULL}}, + {"format.ui.help", 1, Val_string, + .str = "${1}", + .strhandle = config_redraws, + .description = { + "Format of /alias output", NULL}}, + {"format.ui.help.start", 1, Val_string, + .str = "${1} help:", + .strhandle = config_redraws, + .description = { + "Format of header of /alias output", NULL}}, + {"format.ui.help.end", 1, Val_string, + .str = "", + .strhandle = config_redraws, + .description = { + "Format of footer of /alias output", NULL}}, {"format.ui.buflist.old", 1, Val_string, .str = "%{c:91}", .strhandle = config_redraws, diff --git a/src/ui.c b/src/ui.c @@ -83,6 +83,9 @@ struct { {"SELF_ALIAS_START", "format.ui.alias.start"}, {"SELF_ALIAS_LIST", "format.ui.alias"}, {"SELF_ALIAS_END", "format.ui.alias.end"}, + {"SELF_HELP_START", "format.ui.help.start"}, + {"SELF_HELP", "format.ui.help"}, + {"SELF_HELP_END", "format.ui.help.end"}, /* Real commands/numerics from server */ {"PRIVMSG", "format.privmsg"}, {"JOIN", "format.join"},