ref: 39a82749383d4fa8a49b0cefd636a0720133bf57
parent: 5542ecbf72fb01ab33bd7611242582422b6c5ea2
author: mkf <mkf@cloud9p.org>
date: Sun Sep 24 07:29:21 EDT 2023
add 451 and 461
--- a/ircd.c
+++ b/ircd.c
@@ -29,6 +29,8 @@
Notopic,
Rpltopic,
Rpltopicwho,
+ Notregistered,
+ Alreadyregistered,
Unknowncmd,
};
@@ -371,6 +373,12 @@
/* r->argv is: channel */
n = snprint(buf, n, ":%s 331 %s %s :No topic is set\r\n", servername, c->nick, r->argv[0]);
break;
+ case Notregistered:
+ n = snprint(buf, n, ":%s 451 %s :Connection not registered\r\n", servername, c->nick);
+ break;
+ case Alreadyregistered:
+ n = snprint(buf, n, ":%s 461 %s :Connection already registered", servername, c->nick);
+ break;
case Unknowncmd:
/* r->argv is: command */
n = snprint(buf, n, ":%s 421 %s %s :Unknown command\r\n", servername, c->nick, r->argv[0]);
@@ -483,7 +491,11 @@
Reply r;
if(c->user != nil)
- return 0;
+ {
+ r.code = Alreadyregistered;
+ reply(c, &r);
+ return 1;
+ }
qlock(&clock);
c->user = estrdup(user);
@@ -954,8 +966,11 @@
return pass(c, tmp);
}
- if(c->prefix == nil) /* not registered */
+ if(c->prefix == nil){ /* not registered */
+ r.code = Notregistered;
+ reply(c, &r);
return 1;
+ }
if(strcmp(cmd, "PRIVMSG") == 0){
tmp = strtok(0, " :"); /* target */