wm: ircd

Download patch

ref: b273c2cb5e7dc25efaa50fbf7253252deb240175
parent: 39a82749383d4fa8a49b0cefd636a0720133bf57
author: mkf <mkf@cloud9p.org>
date: Sun Sep 24 07:46:27 EDT 2023

add 002, 003, 004 and 005

--- a/ircd.c
+++ b/ircd.c
@@ -82,6 +82,7 @@
 List channels;
 QLock clock;
 char *servername;
+char date[32];
 int debug;
 
 int
@@ -319,7 +320,19 @@
 		n = snprint(buf, n, ":%s PONG %s\r\n", servername, servername);
 		break;
 	case Welcome:
-		n = snprint(buf, n, ":%s 001 %s :Welcome %s\r\n", servername, c->nick, c->prefix);
+		n = snprint(buf, n,
+		":%s 001 %s :Welcome %s\r\n"
+		":%s 002 %s :Your host is %s, running version %s\r\n" 
+		":%s 003 %s :This server was created %s\r\n"
+		":%s 004 %s :\r\n"
+		":%s 005 %s NICKLEN=%d CHANLEN=%d CASEMAPPING=ascii :are supported by this server\r\n",
+
+		servername, c->nick, c->prefix, /* 001 */
+		servername, c->nick, servername, "ircd", /* 002 */
+		servername, c->nick, date, /* 003 */
+		servername, c->nick, /* 004, we don't support anything yet */
+		servername, c->nick, Nicklen, Chanlen); /* 005 */
+ 		break;
 		break;
 	case Join:
 		/* r->argv is: joiner, channel */
@@ -1110,6 +1123,10 @@
 
 	if(servername == nil)
 		servername = estrdup("ircd");
+
+	tmfmtinstall();
+	if(!sprint(date, "%τ", tmfmt(gmtime(time(nil)), "MMM _D hh:mm:ss YYYY")))
+		sysfatal("sprint(date, ...): %r");
 
 	afd = announce(argv[0], adir);
 	if(afd < 0)