commit 0e9f8555196c767e77768b3f331111ee60706baf
parent 90766832afab6e7d8bca5495e310b3248735d3ce
Author: hhvn <dev@hhvn.uk>
Date: Sun, 26 Dec 2021 13:15:28 +0000
s/commands.c s/config.c: /list
Diffstat:
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/commands.c b/src/commands.c
@@ -44,6 +44,7 @@ static void command_part(struct Server *server, char *str);
static void command_kick(struct Server *server, char *str);
static void command_mode(struct Server *server, char *str);
static void command_nick(struct Server *server, char *str);
+static void command_list(struct Server *server, char *str);
static void command_whois(struct Server *server, char *str);
static void command_whowas(struct Server *server, char *str);
static void command_ping(struct Server *server, char *str);
@@ -113,6 +114,9 @@ struct Command commands[] = {
{"nick", command_nick, 1, {
"usage: /nick <nick>",
"Get a new nick", NULL}},
+ {"list", command_list, 1, {
+ "usage: /list",
+ "Get list of channels.", NULL}},
{"whois", command_whois, 1, {
"usage: /whois [server] [nick]",
"Request information on a nick or oneself", NULL}},
@@ -470,6 +474,16 @@ command_nick(struct Server *server, char *str) {
}
static void
+command_list(struct Server *server, char *str) {
+ if (str) {
+ command_toomany("list");
+ return;
+ }
+
+ ircprintf(server, "LIST\r\n", str);
+}
+
+static void
command_whois(struct Server *server, char *str) {
char *tserver, *nick;
diff --git a/src/config.c b/src/config.c
@@ -720,17 +720,17 @@ struct Config config[] = {
.description = {
"Format of RPL_WHOISCHANNELS (319) numeric", NULL}},
{"format.rpl.liststart", 1, Val_string,
- .str = "${2-}",
+ .str = "%{pad:-15,Channel} %{pad:-5,Nicks} Topic",
.strhandle = config_redraws,
.description = {
"Format of RPL_LISTSTART (321) numeric", NULL}},
{"format.rpl.list", 1, Val_string,
- .str = "${2-}",
+ .str = "%{pad:-15,${2}} %{pad:-5,${3}} ${4}",
.strhandle = config_redraws,
.description = {
"Format of RPL_LIST (322) numeric", NULL}},
{"format.rpl.listend", 1, Val_string,
- .str = "${2-}",
+ .str = "",
.strhandle = config_redraws,
.description = {
"Format of RPL_LISTEND (323) numeric", NULL}},