cleaned up Channel_IsValidName (now uses strcspn())
This commit is contained in:
parent
257312b102
commit
d8950c5dd0
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: channel.c,v 1.57 2006/08/12 11:58:21 fw Exp $";
|
static char UNUSED id[] = "$Id: channel.c,v 1.58 2006/10/02 21:55:49 fw Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -462,25 +462,13 @@ Channel_GetChannel( CL2CHAN *Cl2Chan )
|
||||||
|
|
||||||
|
|
||||||
GLOBAL bool
|
GLOBAL bool
|
||||||
Channel_IsValidName( char *Name )
|
Channel_IsValidName( const char *Name )
|
||||||
{
|
{
|
||||||
/* Pruefen, ob Name als Channelname gueltig */
|
|
||||||
|
|
||||||
char *ptr, badchars[10];
|
|
||||||
|
|
||||||
assert( Name != NULL );
|
assert( Name != NULL );
|
||||||
|
|
||||||
if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false;
|
if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false;
|
||||||
|
|
||||||
ptr = Name;
|
return Name[strcspn(Name, " ,:\007")] == 0;
|
||||||
strcpy( badchars, " ,:\007" );
|
|
||||||
while( *ptr )
|
|
||||||
{
|
|
||||||
if( strchr( badchars, *ptr )) return false;
|
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} /* Channel_IsValidName */
|
} /* Channel_IsValidName */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* (at your option) any later version.
|
* (at your option) any later version.
|
||||||
* Please read the file COPYING, README and AUTHORS for more information.
|
* Please read the file COPYING, README and AUTHORS for more information.
|
||||||
*
|
*
|
||||||
* $Id: channel.h,v 1.29 2005/09/02 12:50:25 alex Exp $
|
* $Id: channel.h,v 1.30 2006/10/02 21:55:50 fw Exp $
|
||||||
*
|
*
|
||||||
* Channel management (header)
|
* Channel management (header)
|
||||||
*/
|
*/
|
||||||
|
@ -94,7 +94,7 @@ GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT *Client, CL2CHAN *Cl2Chan
|
||||||
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
|
GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan ));
|
||||||
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
|
GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan ));
|
||||||
|
|
||||||
GLOBAL bool Channel_IsValidName PARAMS(( char *Name ));
|
GLOBAL bool Channel_IsValidName PARAMS(( const char *Name ));
|
||||||
|
|
||||||
GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode ));
|
GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode ));
|
||||||
GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode ));
|
GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode ));
|
||||||
|
|
Loading…
Reference in New Issue