wm: ircd

Download patch

ref: ccd77afbd1a4095dd74376d3c9c138b1026320b4
parent: 718c81112821e4ba15539771670bdecd9de71bf8
author: mkf <mkf@cloud9p.org>
date: Tue Sep 26 01:31:39 EDT 2023

reply PING with whatever they sent

--- a/ircd.c
+++ b/ircd.c
@@ -318,7 +318,8 @@
 		n = snprint(buf, n, "PING :%s\r\n", servername);
 		break;
 	case Pong:
-		n = snprint(buf, n, ":%s PONG %s\r\n", servername, servername);
+		/* r->argv is: pong */
+		n = snprint(buf, n, ":%s PONG %s\r\n", servername, r->argv[0]);
 		break;
 	case Welcome:
 		n = snprint(buf, n,
@@ -961,6 +962,7 @@
 	cmd = strtok(msg, " :\r");
 
 	if(strcmp(cmd, "PING") == 0){
+		r.argv[0] = strtok(0, " \r"); /* pong */
 		r.code = Pong;
 		reply(c, &r);
 		return 1;