]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
- new configuration variables: MaxJoins, MaxPChannels.
[ngircd-alex.git] / src / ngircd / conf.c
index 5fdac5fff225a8165f1f600b87f22e03180c48f0..2ff503612cd31575116941c9267ffc7f742408f1 100644 (file)
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
 
 #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 <assert.h>
 
 #include "imp.h"
 #include <assert.h>
@@ -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" );
        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++ )
        puts( "" );
 
        for( i = 0; i < Conf_Oper_Count; i++ )
@@ -191,7 +195,9 @@ Set_Defaults( VOID )
 
        Conf_OperCanMode = FALSE;
        
 
        Conf_OperCanMode = FALSE;
        
-       Conf_MaxConnections = 0;
+       Conf_MaxConnections = -1;
+       Conf_MaxJoins = 10;
+       Conf_MaxPChannels = -1;
 } /* Set_Defaults */
 
 
 } /* Set_Defaults */
 
 
@@ -478,7 +484,27 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg )
                Conf_MaxConnections = atol( Arg );
                return;
        }
                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 */
 
        Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Unknown variable \"%s\"!", NGIRCd_ConfFile, Line, Var );
 } /* Handle_GLOBAL */