wm: ircd

Download patch

ref: e296dd80a20b44b2f91b4cbc39fed36b7532c403
parent: a30a8ec1ecc99617582604be95fc7c7eb90ba893
author: mkf <mkf@cloud9p.org>
date: Wed Sep 27 03:51:56 EDT 2023

last JOIN change appears to crash

--- a/ircd.c
+++ b/ircd.c
@@ -2,7 +2,7 @@
 #include <libc.h>
 
 char *password = nil; /* nil to disable server password */
-char *motdtxt = "hello!\nworld!"; /* nil for no motd */
+char *motdtxt = nil; /* nil for no motd */
 enum {
 	Maxclients = 48,
 	Maxchannels = 16,
@@ -1139,10 +1139,11 @@
 		tmp = strtok(0, " \r"); /* channels */
 		if(tmp == nil)
 			return 0;
-		while(tmp2 = strtok(0, ",")){/* if there are multiple channels */
-			join(c, tmp2);
-		}
-		join(c, tmp2); /* if there is only one channel (left) */
+		tmp2 = strtok(tmp, ",");
+		do{ /* if there are multiple channels */
+			if(tmp2 != nil)
+				join(c, tmp2);
+		}while(tmp2 = strtok(0, ","));
 		return 1;
 	}
 	if(strcmp(cmd, "PART") == 0){