commit 9d002147c9648272326e1beed292e41a694a6311
parent b7af90b01f4c31dcd14b310de383bdf2b9c0328b
Author: hhvn <dev@hhvn.uk>
Date: Wed, 17 Nov 2021 17:57:47 +0000
commands.c: set topic with selected channel
Diffstat:
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/commands.c b/commands.c
@@ -53,7 +53,7 @@ struct Command commands[] = {
"usage: /names <channel>",
"List nicks in channel (pretty useless with nicklist.", NULL}},
{"topic", command_topic, {
- "usage: /topic [-clear] <channel> [topic]",
+ "usage: /topic [-clear] [channel] [topic]",
"Sets, clears, or checks topic in channel.",
"Provide only channel name to check.", NULL}},
{"help", command_help, {
@@ -373,6 +373,10 @@ command_topic(struct Server *server, char *str) {
}
channel = strtok_r(str, " ", &topic);
+ if (!strchr(support_get(server, "CHANTYPES"), *channel)) {
+ topic = channel;
+ channel = NULL;
+ }
if (!channel && selected.channel) {
channel = selected.channel->name;