From 8b7b23cf8f36e51bbe89a1a586bd238357183e83 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 13 Dec 2002 17:32:33 +0000 Subject: [PATCH] - new configuration variables: MaxJoins, MaxPChannels. --- src/ngircd/conf.c | 32 +++++++++++++++++++++++++++++--- src/ngircd/conf.h | 8 +++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c index 5fdac5ff..2ff50361 100644 --- a/src/ngircd/conf.c +++ b/src/ngircd/conf.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conf.c,v 1.42 2002/12/12 11:26:08 alex Exp $"; +static char UNUSED id[] = "$Id: conf.c,v 1.43 2002/12/13 17:32:33 alex Exp $"; #include "imp.h" #include @@ -117,6 +117,10 @@ Conf_Test( VOID ) printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" ); if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections ); else printf( " MaxConnections = -1\n" ); + if( Conf_MaxJoins > 0 ) printf( " MaxJoins = %d\n", Conf_MaxJoins ); + else printf( " MaxJoins = -1\n" ); + if( Conf_MaxPChannels > 0 ) printf( " MaxPChannels = %d\n", Conf_MaxPChannels ); + else printf( " MaxPChannels = -1\n" ); puts( "" ); for( i = 0; i < Conf_Oper_Count; i++ ) @@ -191,7 +195,9 @@ Set_Defaults( VOID ) Conf_OperCanMode = FALSE; - Conf_MaxConnections = 0; + Conf_MaxConnections = -1; + Conf_MaxJoins = 10; + Conf_MaxPChannels = -1; } /* Set_Defaults */ @@ -478,7 +484,27 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) Conf_MaxConnections = atol( Arg ); return; } - + if( strcasecmp( Var, "MaxJoins" ) == 0 ) + { + /* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */ +#ifdef HAVE_ISDIGIT + if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxJoins\" is not a number!", NGIRCd_ConfFile, Line ); + else +#endif + Conf_MaxJoins = atoi( Arg ); + return; + } + if( strcasecmp( Var, "MaxPChannels" ) == 0 ) + { + /* Maximum number of persistent channels in the network. Values <= 0 are equal to "no limit". */ +#ifdef HAVE_ISDIGIT + if( ! isdigit( *Arg )) Config_Error( LOG_WARNING, "%s, line %d: Value of \"MaxPChannels\" is not a number!", NGIRCd_ConfFile, Line ); + else +#endif + Conf_MaxPChannels = atoi( Arg ); + return; + } + Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var ); } /* Handle_GLOBAL */ diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h index 4c730a6c..3c32faad 100644 --- a/src/ngircd/conf.h +++ b/src/ngircd/conf.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conf.h,v 1.22 2002/12/12 11:26:08 alex Exp $ + * $Id: conf.h,v 1.23 2002/12/13 17:32:33 alex Exp $ * * Configuration management (header) */ @@ -99,6 +99,12 @@ GLOBAL BOOLEAN Conf_OperCanMode; /* Maximum number of connections to this server */ GLOBAL LONG Conf_MaxConnections; +/* Maximum number of channels a user can join */ +GLOBAL INT Conf_MaxJoins; + +/* Maximum number of persistent channels in the network */ +GLOBAL INT Conf_MaxPChannels; + GLOBAL VOID Conf_Init PARAMS((VOID )); GLOBAL INT Conf_Test PARAMS((VOID )); -- 2.39.2