wm: ircd

Download patch

ref: 8564cc83ea21e7c445abd6cdf99b790001c310f2
parent: 0746920981e7794ebaaa2e402671c32c729e44bd
author: mkf <mkf@cloud9p.org>
date: Mon Sep 25 11:21:35 EDT 2023

add support for joining multiple channels at once

--- a/ircd.c
+++ b/ircd.c
@@ -5,7 +5,7 @@
 
 enum {
 	Maxclients = 48,
-	Maxchannels = 5,
+	Maxchannels = 16,
 	Nicklen = 32,
 	Chanlen = 15,
 	Msglen = 512, /* 510 + "\r\n" */
@@ -993,11 +993,16 @@
 		tmp2++;
 		return privmsg(c, tmp, tmp2);
 	}
+	/* JOIN #c or JOIN #c1,#c2, hence the check for "," */
 	if(strcmp(cmd, "JOIN") == 0){
-		tmp = strtok(0, " \r"); /* channel */
+		tmp = strtok(0, " \r"); /* channels */
 		if(tmp == nil)
 			return 0;
-		return join(c, tmp);
+		tmp2 = strtok(tmp, ","); /* channel */
+		do {
+			join(c, tmp2);
+		} while(tmp2 = strtok(0, ",")); 
+		return 1;
 	}
 	if(strcmp(cmd, "PART") == 0){
 		tmp = strtok(0, " :"); /* channel */