predefined channels MUST start with '#', but this is not very intuitive,
since # is also used as a comment character in ngircd.conf. Thus we prefix the name with '#' if it is missing.
This commit is contained in:
parent
5b35b101f2
commit
a09034563a
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: conf.c,v 1.95 2006/11/10 10:05:08 alex Exp $";
|
static char UNUSED id[] = "$Id: conf.c,v 1.96 2006/11/20 19:32:07 fw Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -922,6 +922,21 @@ Handle_SERVER( int Line, char *Var, char *Arg )
|
||||||
} /* Handle_SERVER */
|
} /* Handle_SERVER */
|
||||||
|
|
||||||
|
|
||||||
|
static bool
|
||||||
|
Handle_Channelname(size_t chancount, const char *name)
|
||||||
|
{
|
||||||
|
size_t size = sizeof( Conf_Channel[chancount].name );
|
||||||
|
char *dest = Conf_Channel[chancount].name;
|
||||||
|
|
||||||
|
if (*name && *name != '#') {
|
||||||
|
*dest = '#';
|
||||||
|
--size;
|
||||||
|
++dest;
|
||||||
|
}
|
||||||
|
return size > strlcpy(dest, name, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Handle_CHANNEL( int Line, char *Var, char *Arg )
|
Handle_CHANNEL( int Line, char *Var, char *Arg )
|
||||||
{
|
{
|
||||||
|
@ -935,9 +950,7 @@ Handle_CHANNEL( int Line, char *Var, char *Arg )
|
||||||
chancount = Conf_Channel_Count - 1;
|
chancount = Conf_Channel_Count - 1;
|
||||||
|
|
||||||
if( strcasecmp( Var, "Name" ) == 0 ) {
|
if( strcasecmp( Var, "Name" ) == 0 ) {
|
||||||
/* Name of the channel */
|
if (!Handle_Channelname(chancount, Arg))
|
||||||
len = strlcpy( Conf_Channel[chancount].name, Arg, sizeof( Conf_Channel[chancount].name ));
|
|
||||||
if (len >= sizeof( Conf_Channel[chancount].name ))
|
|
||||||
Config_Error_TooLong( Line, Var );
|
Config_Error_TooLong( Line, Var );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue