commit 0515324f23be0bd64346f672344e9312926bc99d
parent 46f9d750c647fa0467a2d3c65fa2b3b6d23ca2d6
Author: hhvn <dev@hhvn.uk>
Date: Sun, 28 Nov 2021 13:33:40 +0000
ui.c config.c: provide formats for SELF_* messages
Diffstat:
M | config.c | | | 42 | ++++++++++++++++++++++++++++++++++++++++++ |
M | ui.c | | | 12 | +++++++++++- |
2 files changed, 53 insertions(+), 1 deletion(-)
diff --git a/config.c b/config.c
@@ -150,6 +150,48 @@ struct Config config[] = {
.strhandle = config_format,
.description = {
"Format of topic at top of main window", NULL}},
+ {"format.ui.error", 1, Val_string,
+ .str = "%{b}%{c:28}${3} %{b}(at ${1}:${2})",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_ERROR messages", NULL}},
+ {"format.ui.misc", 1, Val_string,
+ .str = "${1}",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_UI messages", NULL}},
+ {"format.ui.connectlost", 1, Val_string,
+ .str = "Connection to ${1} (${2}:${3}) lost: ${4}",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_CONNECTLOST messages", NULL}},
+ {"format.ui.connecting", 1, Val_string,
+ .str = "Connecting to ${1}:${2}",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_CONNECTING messages", NULL}},
+ {"format.ui.connected", 1, Val_string,
+ .str = "Connection to ${1} established",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_CONNECTED messages", NULL}},
+ {"format.ui.lookupfail", 1, Val_string,
+ .str = "Failed to lookup ${2}: ${4}",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_LOOKUPFAIL messages", NULL}},
+ {"format.ui.connectfail", 1, Val_string,
+ .str = "Failed to connect to ${2}:${3}: ${4}",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_CONNECTFAIL messages", NULL}},
+#ifndef TLS
+ {"format.ui.tlsnotcompiled", 1, Val_string,
+ .str = "TLS not compiled into hirc",
+ .strhandle = config_format,
+ .description = {
+ "Format of SELF_TLSNOTCOMPILED messages", NULL}},
+#endif /* TLS */
{"format.privmsg", 1, Val_string,
.str = "${nick} ${2}",
.strhandle = config_format,
diff --git a/ui.c b/ui.c
@@ -46,7 +46,17 @@ struct {
char *cmd;
char *format;
} formatmap[] = {
- {"PRIVMSG", "format.privmsg"},
+ {"SELF_ERROR", "format.ui.error"},
+ {"SELF_UI", "format.ui.misc"},
+ {"SELF_CONNECTLOST", "format.ui.connectlost"},
+ {"SELF_CONNECTING", "format.ui.connecting"},
+ {"SELF_CONNECTED", "format.ui.connected"},
+ {"SELF_LOOKUPFAIL", "format.ui.lookupfail"},
+ {"SELF_CONNECTFAIL", "format.ui.connectfail"},
+#ifndef TLS
+ {"SELF_TLSNOTCOMPILED", "format.ui.tlsnotcompiled"},
+#endif /* TLS */
+ {"PRIVMSG", "format.privmsg"},
{NULL, NULL},
};