summary refs log tree commit diff
path: root/input.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-07 15:59:27 -0400
committerJune McEnroe <june@causal.agency>2018-08-07 15:59:27 -0400
commit2fe8b4e61448fed717a06300a8a7c74604a81ca0 (patch)
tree5885befa113015012a67306cc914217474caa946 /input.c
parentConvert input to multibyte before handling (diff)
downloadcatgirl-2fe8b4e61448fed717a06300a8a7c74604a81ca0.tar.gz
catgirl-2fe8b4e61448fed717a06300a8a7c74604a81ca0.zip
Match commands case-insensitively
Also include the slash in their names so that they can be added to
tab-complete later.
Diffstat (limited to 'input.c')
-rw-r--r--input.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/input.c b/input.c
index 391c5b5..e8918c9 100644
--- a/input.c
+++ b/input.c
@@ -77,12 +77,12 @@ static const struct {
 	const char *command;
 	Handler handler;
 } COMMANDS[] = {
-	{ "me", inputMe },
-	{ "names", inputWho },
-	{ "nick", inputNick },
-	{ "quit", inputQuit },
-	{ "topic", inputTopic },
-	{ "who", inputWho },
+	{ "/me", inputMe },
+	{ "/names", inputWho },
+	{ "/nick", inputNick },
+	{ "/quit", inputQuit },
+	{ "/topic", inputTopic },
+	{ "/who", inputWho },
 };
 static const size_t COMMANDS_LEN = sizeof(COMMANDS) / sizeof(COMMANDS[0]);
 
@@ -91,10 +91,9 @@ void input(char *input) {
 		privmsg(false, input);
 		return;
 	}
-	input++;
 	char *command = strsep(&input, " ");
 	for (size_t i = 0; i < COMMANDS_LEN; ++i) {
-		if (strcmp(command, COMMANDS[i].command)) continue;
+		if (strcasecmp(command, COMMANDS[i].command)) continue;
 		COMMANDS[i].handler(input);
 		return;
 	}