]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/conf.c
add const qualifier to pointers where possible
[ngircd-alex.git] / src / ngircd / conf.c
index 4a8b6283a4f8136d27a4e23f0cc1629a7e7e3f85..a3c9afecf097c88de0fc55e9b1ac44aebb9c25b0 100644 (file)
@@ -40,6 +40,7 @@
 #include "ngircd.h"
 #include "conn.h"
 #include "client.h"
+#include "channel.h"
 #include "defines.h"
 #include "log.h"
 #include "match.h"
@@ -386,7 +387,7 @@ Conf_GetServer( CONN_ID Idx )
 
 
 GLOBAL bool
-Conf_EnableServer( char *Name, UINT16 Port )
+Conf_EnableServer( const char *Name, UINT16 Port )
 {
        /* Enable specified server and adjust port */
 
@@ -425,7 +426,7 @@ Conf_EnablePassiveServer(const char *Name)
 
 
 GLOBAL bool
-Conf_DisableServer( char *Name )
+Conf_DisableServer( const char *Name )
 {
        /* Enable specified server and adjust port */
 
@@ -446,7 +447,7 @@ Conf_DisableServer( char *Name )
 
 
 GLOBAL bool
-Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd )
+Conf_AddServer( const char *Name, UINT16 Port, const char *Host, const char *MyPwd, const char *PeerPwd )
 {
        /* Add new server to configuration */
 
@@ -480,7 +481,7 @@ Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd
  * Check if the given nick name is an service
  */
 GLOBAL bool
-Conf_IsService(int ConfServer, char *Nick)
+Conf_IsService(int ConfServer, const char *Nick)
 {
        return MatchCaseInsensitive(Conf_Server[ConfServer].svs_mask, Nick);
 } /* Conf_IsService */
@@ -1169,10 +1170,11 @@ Handle_Channelname(struct Conf_Channel *new_chan, const char *name)
        size_t size = sizeof(new_chan->name);
        char *dest = new_chan->name;
 
-       /* Channels names must begin with "&" or "#", if it is
-        * missing, add a '#'. This is only here for user convenience.
-        */
-       if (*name && *name != '#' && *name != '&') {
+       if (!Channel_IsValidName(name)) {
+               /*
+                * maybe user forgot to add a '#'.
+                * This is only here for user convenience.
+                */
                *dest = '#';
                --size;
                ++dest;