Changeset 4c17d19


Ignore:
Timestamp:
2010-05-10T09:05:26Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
3663bb3
Parents:
a067771
Message:

Fixed irc_channel_name_ok(): One-character channel names are okay, also the
first character after the prefix *can* be a number.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_channel.c

    ra067771 r4c17d19  
    202202gboolean irc_channel_name_ok( const char *name )
    203203{
    204         return strchr( CTYPES, name[0] ) != NULL && nick_ok( name + 1 );
     204        char name_[strlen(name)+1];
     205       
     206        /* Check if the first character is in CTYPES (#&) */
     207        if( strchr( CTYPES, name[0] ) == NULL )
     208                return FALSE;
     209       
     210        /* Check the rest of the name. Just checking name + 1 doesn't work
     211           since it will fail if the first character is a number, or if
     212           it's a one-char channel name - both of which are legal. */
     213        name_[0] = '_';
     214        strcpy( name_ + 1, name + 1 );
     215        return nick_ok( name_ );
    205216}
    206217
Note: See TracChangeset for help on using the changeset viewer.