AmendHub

Download:

jcs

/

wallops

/

amendments

/

43

irc: Check for input commands case-insensitively

I keep typing "/joiN #"

jcs made amendment 43 about 1 year ago
--- irc.c Sun Dec 11 21:35:36 2022 +++ irc.c Sun Dec 11 21:55:39 2022 @@ -846,7 +846,7 @@ irc_process_input(struct irc_connection *conn, struct arg0 = strsep(&str, " "); - if (strcmp(arg0, "join") == 0) { + if (strcasecmp(arg0, "join") == 0) { if (str == NULL) goto not_enough_params; /* @@ -861,7 +861,7 @@ irc_process_input(struct irc_connection *conn, struct irc_printf(conn, "JOIN %s\r\n", str); return; } - if (strcmp(arg0, "me") == 0) { + if (strcasecmp(arg0, "me") == 0) { if (str == NULL) goto not_enough_params; if (channel == NULL) @@ -873,7 +873,7 @@ irc_process_input(struct irc_connection *conn, struct str); return; } - if (strcmp(arg0, "msg") == 0) { + if (strcasecmp(arg0, "msg") == 0) { arg1 = strsep(&str, " "); if (arg1 == NULL || str == NULL) goto not_enough_params; @@ -883,13 +883,13 @@ irc_process_input(struct irc_connection *conn, struct irc_printf(conn, "PRIVMSG %s :%s\r\n", arg1, str); return; } - if (strcmp(arg0, "nick") == 0) { + if (strcasecmp(arg0, "nick") == 0) { if (str == NULL) goto not_enough_params; irc_printf(conn, "NICK %s\r\n", str); return; } - if (strcmp(arg0, "part") == 0) { + if (strcasecmp(arg0, "part") == 0) { if (str == NULL && channel) irc_printf(conn, "PART %s\r\n", channel->name); else if (str) @@ -898,17 +898,17 @@ irc_process_input(struct irc_connection *conn, struct goto not_in_channel; return; } - if (strcmp(arg0, "quit") == 0) { + if (strcasecmp(arg0, "quit") == 0) { irc_printf(conn, "QUIT :%s\r\n", str == NULL ? "Quitting" : str); return; } - if (strcmp(arg0, "quote") == 0) { + if (strcasecmp(arg0, "quote") == 0) { if (str == NULL) goto not_enough_params; irc_printf(conn, "%s\r\n", str); return; } - if (strcmp(arg0, "whois") == 0) { + if (strcasecmp(arg0, "whois") == 0) { if (str == NULL) goto not_enough_params; irc_printf(conn, "WHOIS %s\r\n", str);