]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/ngircd.c
Introduce option to configure the maximum nick name lenth in ngircd.conf
[ngircd-alex.git] / src / ngircd / ngircd.c
index b3ab7c416dff10917d6ade9395af0541248708dd..d2a6d7ea8faae860f0df893edef82969acf80a3b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2006 Alexander Barton (alex@barton.de).
+ * Copyright (c)2001-2007 Alexander Barton (alex@barton.de).
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -12,7 +12,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: ngircd.c,v 1.113 2006/07/23 12:07:33 alex Exp $";
+static char UNUSED id[] = "$Id: ngircd.c,v 1.117 2007/11/21 12:16:36 alex Exp $";
 
 /**
  * @file
@@ -271,7 +271,6 @@ main( int argc, const char *argv[] )
 
                /* Initialize modules, part II: these functions are eventually
                 * called with already dropped privileges ... */
-               Lists_Init( );
                Channel_Init( );
                Client_Init( );
 #ifdef ZEROCONF
@@ -328,7 +327,6 @@ main( int argc, const char *argv[] )
 #endif
                Client_Exit( );
                Channel_Exit( );
-               Lists_Exit( );
                Log_Exit( );
        }
        Pidfile_Delete( );
@@ -424,6 +422,7 @@ GLOBAL void
 NGIRCd_Rehash( void )
 {
        char old_name[CLIENT_ID_LEN];
+       unsigned old_nicklen;
 
        Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" );
        NGIRCd_SignalRehash = false;
@@ -431,17 +430,22 @@ NGIRCd_Rehash( void )
        /* Close down all listening sockets */
        Conn_ExitListeners( );
 
-       /* Remember old server name */
+       /* Remember old server name and nick name length */
        strlcpy( old_name, Conf_ServerName, sizeof old_name );
+       old_nicklen = Conf_MaxNickLength;
 
        /* Re-read configuration ... */
        Conf_Rehash( );
 
-       /* Recover old server name: it can't be changed during run-time */
-       if( strcmp( old_name, Conf_ServerName ) != 0 )
-       {
-               strlcpy( Conf_ServerName, old_name, sizeof Conf_ServerName );
-               Log( LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name." );
+       /* Recover old server name and nick name length: these values can't
+        * be changed during run-time */
+       if (strcmp(old_name, Conf_ServerName) != 0 ) {
+               strlcpy(Conf_ServerName, old_name, sizeof Conf_ServerName);
+               Log(LOG_ERR, "Can't change \"ServerName\" on runtime! Ignored new name.");
+       }
+       if (old_nicklen != Conf_MaxNickLength) {
+               Conf_MaxNickLength = old_nicklen;
+               Log(LOG_ERR, "Can't change \"MaxNickLength\" on runtime! Ignored new value.");
        }
 
        /* Create new pre-defined channels */
@@ -548,7 +552,7 @@ static void
 Show_Version( void )
 {
        puts( NGIRCd_Version );
-       puts( "Copyright (c)2001-2006 Alexander Barton (<alex@barton.de>) and Contributors." );
+       puts( "Copyright (c)2001-2007 Alexander Barton (<alex@barton.de>) and Contributors." );
        puts( "Homepage: <http://ngircd.barton.de/>\n" );
        puts( "This is free software; see the source for copying conditions. There is NO" );
        puts( "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." );
@@ -799,7 +803,7 @@ NGIRCd_Init( bool NGIRCd_NoDaemon )
                        if( chdir( pwd->pw_dir ) == 0 ) 
                                Log( LOG_DEBUG, "Changed working directory to \"%s\" ...", pwd->pw_dir );
                        else 
-                               Log( LOG_ERR, "Can't change working directory to \"%s\": %s",
+                               Log( LOG_INFO, "Notice: Can't change working directory to \"%s\": %s",
                                                                pwd->pw_dir, strerror( errno ));
                }
        } else {