Changeset e277e80


Ignore:
Timestamp:
2013-04-20T22:50:31Z (11 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
c608891
Parents:
dd95ce4
Message:

Add irc_t* argument to all relevant nick_*() functions.

Files:
8 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    rdd95ce4 re277e80  
    152152                old = l->data;
    153153                if( child != old &&
    154                     old->nick && nick_cmp( old->nick, child->nick ) == 0 &&
     154                    old->nick && nick_cmp( NULL, old->nick, child->nick ) == 0 &&
    155155                    old->password && strcmp( old->password, child->password ) == 0 )
    156156                        break;
     
    298298                return;
    299299       
    300         if( nick_cmp( cmd[1], irc->user->nick ) != 0 )
     300        if( nick_cmp( NULL, cmd[1], irc->user->nick ) != 0 )
    301301                return;         /* It's not for us. */
    302302       
  • irc_commands.c

    rdd95ce4 re277e80  
    8080                irc_send_num( irc, 433, "%s :This nick is already in use", cmd[1] );
    8181        }
    82         else if( !nick_ok( cmd[1] ) )
     82        else if( !nick_ok( NULL, cmd[1] ) )
    8383        {
    8484                /* [SH] Invalid characters. */
     
    291291        else
    292292        {
    293                 if( nick_cmp( cmd[1], irc->user->nick ) == 0 )
     293                if( nick_cmp( NULL, cmd[1], irc->user->nick ) == 0 )
    294294                {
    295295                        if( cmd[2] )
     
    392392        /* At least for now just echo. IIRC some IRC clients use self-notices
    393393           for lag checks, so try to support that. */
    394         if( nick_cmp( cmd[1], irc->user->nick ) == 0 )
     394        if( nick_cmp( NULL, cmd[1], irc->user->nick ) == 0 )
    395395                irc_send_msg( irc->user, "NOTICE", irc->user->nick, cmd[2], NULL );
    396396        else if( ( iu = irc_user_by_name( irc, cmd[1] ) ) )
     
    593593               
    594594                nick = g_strdup( cmd[i] + 1 );
    595                 nick_lc( nick );
     595                nick_lc( irc, nick );
    596596               
    597597                iu = irc_user_by_name( irc, nick );
  • irc_im.c

    rdd95ce4 re277e80  
    697697        irc_channel_name_strip( stripped );
    698698        if( set_getbool( &bee->set, "lcnicks" ) )
    699                 nick_lc( stripped );
     699                nick_lc( irc, stripped );
    700700       
    701701        if( stripped[0] == '\0' )
  • irc_user.c

    rdd95ce4 re277e80  
    3636       
    3737        iu->key = g_strdup( nick );
    38         nick_lc( iu->key );
     38        nick_lc( irc, iu->key );
    3939        /* Using the hash table for speed and irc->users for easy iteration
    4040           through the list (since the GLib API doesn't have anything sane
     
    107107       
    108108        strcpy( key, nick );
    109         if( nick_lc( key ) )
     109        if( nick_lc( irc, key ) )
    110110                return g_hash_table_lookup( irc->nick_user_hash, key );
    111111        else
     
    121121       
    122122        strcpy( key, new );
    123         if( iu == NULL || !nick_lc( key ) ||
     123        if( iu == NULL || !nick_lc( irc, key ) ||
    124124            ( ( new_iu = irc_user_by_name( irc, new ) ) && new_iu != iu ) )
    125125                return 0;
  • nick.c

    rdd95ce4 re277e80  
    5151{
    5252        char *store_handle, *store_nick = g_malloc( MAX_NICK_LENGTH + 1 );
     53        irc_t *irc = (irc_t *) acc->bee->ui_data;
    5354       
    5455        store_handle = clean_handle( handle );
    5556        store_nick[MAX_NICK_LENGTH] = '\0';
    5657        strncpy( store_nick, nick, MAX_NICK_LENGTH );
    57         nick_strip( store_nick );
     58        nick_strip( irc, store_nick );
    5859       
    5960        g_hash_table_replace( acc->nicks, store_handle, store_nick );
     
    6970        static char nick[MAX_NICK_LENGTH+1];
    7071        char *store_handle, *found_nick;
     72        irc_t *irc = (irc_t *) bu->bee->ui_data;
    7173       
    7274        memset( nick, 0, MAX_NICK_LENGTH + 1 );
     
    9496                                *(s++) = 0;
    9597               
    96                 nick_strip( nick );
     98                nick_strip( irc, nick );
    9799                if( set_getbool( &bu->bee->set, "lcnicks" ) )
    98                         nick_lc( nick );
     100                        nick_lc( irc, nick );
    99101        }
    100102        g_free( store_handle );
     
    230232        /* Now, find out if the nick is already in use at the moment, and make
    231233           subtle changes to make it unique. */
    232         while( !nick_ok( nick ) ||
     234        while( !nick_ok( irc, nick ) ||
    233235               ( ( iu = irc_user_by_name( irc, nick ) ) && iu->bu != bu ) )
    234236        {
     
    287289
    288290
    289 void nick_strip( char *nick )
     291void nick_strip( irc_t *irc, char *nick )
    290292{
    291293        int i, j;
     
    313315}
    314316
    315 int nick_ok( const char *nick )
     317int nick_ok( irc_t *irc, const char *nick )
    316318{
    317319        const char *s;
     
    328330}
    329331
    330 int nick_lc( char *nick )
     332int nick_lc( irc_t *irc, char *nick )
    331333{
    332334        static char tab[128] = { 0 };
     
    351353}
    352354
    353 int nick_uc( char *nick )
     355int nick_uc( irc_t *irc, char *nick )
    354356{
    355357        static char tab[128] = { 0 };
     
    374376}
    375377
    376 int nick_cmp( const char *a, const char *b )
     378int nick_cmp( irc_t *irc, const char *a, const char *b )
    377379{
    378380        char aa[1024] = "", bb[1024] = "";
     
    380382        strncpy( aa, a, sizeof( aa ) - 1 );
    381383        strncpy( bb, b, sizeof( bb ) - 1 );
    382         if( nick_lc( aa ) && nick_lc( bb ) )
     384        if( nick_lc( irc, aa ) && nick_lc( irc, bb ) )
    383385        {
    384386                return( strcmp( aa, bb ) );
     
    389391        }
    390392}
    391 
    392 char *nick_dup( const char *nick )
    393 {
    394         return g_strndup( nick, MAX_NICK_LENGTH );
    395 }
  • nick.h

    rdd95ce4 re277e80  
    3131int nick_saved( bee_user_t *bu );
    3232void nick_del( bee_user_t *bu );
    33 void nick_strip( char *nick );
    3433
    35 int nick_ok( const char *nick );
    36 int nick_lc( char *nick );
    37 int nick_uc( char *nick );
    38 int nick_cmp( const char *a, const char *b );
     34void nick_strip( irc_t *irc, char *nick );
     35int nick_ok( irc_t *irc, const char *nick );
     36int nick_lc( irc_t *irc, char *nick );
     37int nick_uc( irc_t *irc, char *nick );
     38int nick_cmp( irc_t *irc, const char *a, const char *b );
    3939char *nick_dup( const char *nick );
  • root_commands.c

    rdd95ce4 re277e80  
    702702        if( cmd[3] )
    703703        {
    704                 if( !nick_ok( cmd[3] ) )
     704                if( !nick_ok( irc, cmd[3] ) )
    705705                {
    706706                        irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] );
     
    844844                irc_rootmsg( irc, "Use /nick to change your own nickname" );
    845845        }
    846         else if( !nick_ok( cmd[2] ) )
     846        else if( !nick_ok( irc, cmd[2] ) )
    847847        {
    848848                irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] );
  • storage_xml.c

    rdd95ce4 re277e80  
    181181        strncpy( xd->given_nick, my_nick, MAX_NICK_LENGTH );
    182182        xd->given_nick[MAX_NICK_LENGTH] = '\0';
    183         nick_lc( xd->given_nick );
     183        nick_lc( NULL, xd->given_nick );
    184184        xd->given_pass = (char*) password;
    185185       
     
    368368       
    369369        path2 = g_strdup( irc->user->nick );
    370         nick_lc( path2 );
     370        nick_lc( NULL, path2 );
    371371        g_snprintf( path, sizeof( path ) - 20, "%s%s%s", global.conf->configdir, path2, ".xml" );
    372372        g_free( path2 );
     
    424424
    425425        lc = g_strdup( nick );
    426         nick_lc( lc );
     426        nick_lc( NULL, lc );
    427427        g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" );
    428428        g_free( lc );
Note: See TracChangeset for help on using the changeset viewer.