diff options
| author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-10 10:05:26 +0100 | 
|---|---|---|
| committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-05-10 10:05:26 +0100 | 
| commit | 4c17d19ddb4a039e3ff9e33e87d5f538a0b0c19b (patch) | |
| tree | b92d22a956d99aeb80aa3a0796f355ae5e8150c1 | |
| parent | a067771fa1799e689653931f6743b3502182b850 (diff) | |
Fixed irc_channel_name_ok(): One-character channel names are okay, also the
first character after the prefix *can* be a number.
| -rw-r--r-- | irc_channel.c | 13 | 
1 files changed, 12 insertions, 1 deletions
| diff --git a/irc_channel.c b/irc_channel.c index f000a997..28cd7d43 100644 --- a/irc_channel.c +++ b/irc_channel.c @@ -201,7 +201,18 @@ void irc_channel_printf( irc_channel_t *ic, char *format, ... )  gboolean irc_channel_name_ok( const char *name )  { -	return strchr( CTYPES, name[0] ) != NULL && nick_ok( name + 1 ); +	char name_[strlen(name)+1]; +	 +	/* Check if the first character is in CTYPES (#&) */ +	if( strchr( CTYPES, name[0] ) == NULL ) +		return FALSE; +	 +	/* Check the rest of the name. Just checking name + 1 doesn't work +	   since it will fail if the first character is a number, or if +	   it's a one-char channel name - both of which are legal. */ +	name_[0] = '_'; +	strcpy( name_ + 1, name + 1 ); +	return nick_ok( name_ );  }  static gint irc_channel_user_cmp( gconstpointer a_, gconstpointer b_ ) | 
