Commit Diff


commit - 14cdb7fdd0605a1059fdda4ed749ecf910100fe2
commit + 254bf129dc6d5d69dda5dc0f1a34547e75ee87ee
blob - efa0cf1e500f7d8521b2ff4761e91ac516a13ee4
blob + 1eb9b6aaeae97fada19afaac08e64f125f14dcec
--- src/ngircd/irc-channel.c
+++ src/ngircd/irc-channel.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-channel.c,v 1.35.2.1 2006/10/05 18:30:47 fw Exp $";
+static char UNUSED id[] = "$Id: irc-channel.c,v 1.35.2.2 2006/12/02 13:33:52 fw Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -78,8 +78,17 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 		chan = NULL; flags = NULL;
 
 		/* wird der Channel neu angelegt? */
-		if( Channel_Search( channame )) is_new_chan = false;
-		else is_new_chan = true;
+		if( Channel_Search( channame )) {
+			is_new_chan = false;
+		} else {
+			if (Conf_PredefChannelsOnly) { /* this server does not allow creation of channels */
+				IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame );
+				/* Try next name, if any */
+				channame = strchr(channame, ',');
+				continue;
+			}
+			is_new_chan = true;
+		}
 
 		/* Hat ein Server Channel-User-Modes uebergeben? */
 		if( Client_Type( Client ) == CLIENT_SERVER )
@@ -134,7 +143,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req )
 					IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame );
 
 					/* Try next name, if any */
-					channame = strtok( NULL, "," );
+					channame = strchr(channame, ',');
 					continue;
 				}
 
@@ -491,7 +500,7 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req )
 			{
 				if( *ptr == 'l' )
 				{
-					snprintf( l, sizeof( l ), " %ld", Channel_MaxUsers( chan ));
+					snprintf( l, sizeof( l ), " %lu", Channel_MaxUsers( chan ));
 					strlcat( modes_add, l, sizeof( modes_add ));
 				}
 				if( *ptr == 'k' )