wm: ircd

Download patch

ref: 71880b7aff3ed9fd59381d14b0828acb46838a99
parent: 19211dfc0b93392592a1a9720c37e2af67e2c1d6
author: mkf <mkf@cloud9p.org>
date: Tue Sep 26 05:17:58 EDT 2023

add ERR_NONICKNAMEGIVEN (421)

--- a/ircd.c
+++ b/ircd.c
@@ -34,6 +34,7 @@
 	ERR_NOSUCHCHANNEL = 403,
 	ERR_CANNOTSENDTOCHAN = 404,
 	ERR_UNKNOWNCOMMAND = 421,
+	ERR_NONICKNAMEGIVEN = 431,
 	ERR_ERRONEUSNICKNAME = 432,
 	ERR_NICKNAMEINUSE = 433,
 	ERR_NOTONCHANNEL = 442,
@@ -396,6 +397,9 @@
 		/* r->argv is: command */
 		n = snprint(buf, n, ":%s 421 %s %s :Unknown command\r\n", servername, c->nick, r->argv[0]);
 		break;
+	case ERR_NONICKNAMEGIVEN:
+		n = snprint(buf, n, ":%s 421 %s :No nickname given\r\n", servername, c->nick);
+		break;
 	case ERR_ERRONEUSNICKNAME:
 		/* r->argv[0] is nick */
 		n = snprint(buf, n, ":%s 432 %s %s :Erroneus nickname\r\n", servername, c->nick, r->argv[0]);
@@ -986,8 +990,11 @@
 	}
 	if(strcmp(cmd, "NICK") == 0){
 		tmp = strtok(0, " \r"); /* nick */
-		if(tmp == nil)
-			return 0;
+		if(tmp == nil){
+			r.code = ERR_NONICKNAMEGIVEN;
+			reply(c, &r);
+			return 1;
+		}
 		return nick(c, tmp);
 	}
 	if(strcmp(cmd, "USER") == 0){