Changeset e277e80
- Timestamp:
- 2013-04-20T22:50:31Z (12 years ago)
- Branches:
- master
- Children:
- c608891
- Parents:
- dd95ce4
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
ipc.c
rdd95ce4 re277e80 152 152 old = l->data; 153 153 if( child != old && 154 old->nick && nick_cmp( old->nick, child->nick ) == 0 &&154 old->nick && nick_cmp( NULL, old->nick, child->nick ) == 0 && 155 155 old->password && strcmp( old->password, child->password ) == 0 ) 156 156 break; … … 298 298 return; 299 299 300 if( nick_cmp( cmd[1], irc->user->nick ) != 0 )300 if( nick_cmp( NULL, cmd[1], irc->user->nick ) != 0 ) 301 301 return; /* It's not for us. */ 302 302 -
irc_commands.c
rdd95ce4 re277e80 80 80 irc_send_num( irc, 433, "%s :This nick is already in use", cmd[1] ); 81 81 } 82 else if( !nick_ok( cmd[1] ) )82 else if( !nick_ok( NULL, cmd[1] ) ) 83 83 { 84 84 /* [SH] Invalid characters. */ … … 291 291 else 292 292 { 293 if( nick_cmp( cmd[1], irc->user->nick ) == 0 )293 if( nick_cmp( NULL, cmd[1], irc->user->nick ) == 0 ) 294 294 { 295 295 if( cmd[2] ) … … 392 392 /* At least for now just echo. IIRC some IRC clients use self-notices 393 393 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 ) 395 395 irc_send_msg( irc->user, "NOTICE", irc->user->nick, cmd[2], NULL ); 396 396 else if( ( iu = irc_user_by_name( irc, cmd[1] ) ) ) … … 593 593 594 594 nick = g_strdup( cmd[i] + 1 ); 595 nick_lc( nick );595 nick_lc( irc, nick ); 596 596 597 597 iu = irc_user_by_name( irc, nick ); -
irc_im.c
rdd95ce4 re277e80 697 697 irc_channel_name_strip( stripped ); 698 698 if( set_getbool( &bee->set, "lcnicks" ) ) 699 nick_lc( stripped );699 nick_lc( irc, stripped ); 700 700 701 701 if( stripped[0] == '\0' ) -
irc_user.c
rdd95ce4 re277e80 36 36 37 37 iu->key = g_strdup( nick ); 38 nick_lc( i u->key );38 nick_lc( irc, iu->key ); 39 39 /* Using the hash table for speed and irc->users for easy iteration 40 40 through the list (since the GLib API doesn't have anything sane … … 107 107 108 108 strcpy( key, nick ); 109 if( nick_lc( key ) )109 if( nick_lc( irc, key ) ) 110 110 return g_hash_table_lookup( irc->nick_user_hash, key ); 111 111 else … … 121 121 122 122 strcpy( key, new ); 123 if( iu == NULL || !nick_lc( key ) ||123 if( iu == NULL || !nick_lc( irc, key ) || 124 124 ( ( new_iu = irc_user_by_name( irc, new ) ) && new_iu != iu ) ) 125 125 return 0; -
nick.c
rdd95ce4 re277e80 51 51 { 52 52 char *store_handle, *store_nick = g_malloc( MAX_NICK_LENGTH + 1 ); 53 irc_t *irc = (irc_t *) acc->bee->ui_data; 53 54 54 55 store_handle = clean_handle( handle ); 55 56 store_nick[MAX_NICK_LENGTH] = '\0'; 56 57 strncpy( store_nick, nick, MAX_NICK_LENGTH ); 57 nick_strip( store_nick );58 nick_strip( irc, store_nick ); 58 59 59 60 g_hash_table_replace( acc->nicks, store_handle, store_nick ); … … 69 70 static char nick[MAX_NICK_LENGTH+1]; 70 71 char *store_handle, *found_nick; 72 irc_t *irc = (irc_t *) bu->bee->ui_data; 71 73 72 74 memset( nick, 0, MAX_NICK_LENGTH + 1 ); … … 94 96 *(s++) = 0; 95 97 96 nick_strip( nick );98 nick_strip( irc, nick ); 97 99 if( set_getbool( &bu->bee->set, "lcnicks" ) ) 98 nick_lc( nick );100 nick_lc( irc, nick ); 99 101 } 100 102 g_free( store_handle ); … … 230 232 /* Now, find out if the nick is already in use at the moment, and make 231 233 subtle changes to make it unique. */ 232 while( !nick_ok( nick ) ||234 while( !nick_ok( irc, nick ) || 233 235 ( ( iu = irc_user_by_name( irc, nick ) ) && iu->bu != bu ) ) 234 236 { … … 287 289 288 290 289 void nick_strip( char *nick )291 void nick_strip( irc_t *irc, char *nick ) 290 292 { 291 293 int i, j; … … 313 315 } 314 316 315 int nick_ok( const char *nick )317 int nick_ok( irc_t *irc, const char *nick ) 316 318 { 317 319 const char *s; … … 328 330 } 329 331 330 int nick_lc( char *nick )332 int nick_lc( irc_t *irc, char *nick ) 331 333 { 332 334 static char tab[128] = { 0 }; … … 351 353 } 352 354 353 int nick_uc( char *nick )355 int nick_uc( irc_t *irc, char *nick ) 354 356 { 355 357 static char tab[128] = { 0 }; … … 374 376 } 375 377 376 int nick_cmp( const char *a, const char *b )378 int nick_cmp( irc_t *irc, const char *a, const char *b ) 377 379 { 378 380 char aa[1024] = "", bb[1024] = ""; … … 380 382 strncpy( aa, a, sizeof( aa ) - 1 ); 381 383 strncpy( bb, b, sizeof( bb ) - 1 ); 382 if( nick_lc( aa ) && nick_lc(bb ) )384 if( nick_lc( irc, aa ) && nick_lc( irc, bb ) ) 383 385 { 384 386 return( strcmp( aa, bb ) ); … … 389 391 } 390 392 } 391 392 char *nick_dup( const char *nick )393 {394 return g_strndup( nick, MAX_NICK_LENGTH );395 } -
nick.h
rdd95ce4 re277e80 31 31 int nick_saved( bee_user_t *bu ); 32 32 void nick_del( bee_user_t *bu ); 33 void nick_strip( char *nick );34 33 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 ); 34 void nick_strip( irc_t *irc, char *nick ); 35 int nick_ok( irc_t *irc, const char *nick ); 36 int nick_lc( irc_t *irc, char *nick ); 37 int nick_uc( irc_t *irc, char *nick ); 38 int nick_cmp( irc_t *irc, const char *a, const char *b ); 39 39 char *nick_dup( const char *nick ); -
root_commands.c
rdd95ce4 re277e80 702 702 if( cmd[3] ) 703 703 { 704 if( !nick_ok( cmd[3] ) )704 if( !nick_ok( irc, cmd[3] ) ) 705 705 { 706 706 irc_rootmsg( irc, "The requested nick `%s' is invalid", cmd[3] ); … … 844 844 irc_rootmsg( irc, "Use /nick to change your own nickname" ); 845 845 } 846 else if( !nick_ok( cmd[2] ) )846 else if( !nick_ok( irc, cmd[2] ) ) 847 847 { 848 848 irc_rootmsg( irc, "Nick `%s' is invalid", cmd[2] ); -
storage_xml.c
rdd95ce4 re277e80 181 181 strncpy( xd->given_nick, my_nick, MAX_NICK_LENGTH ); 182 182 xd->given_nick[MAX_NICK_LENGTH] = '\0'; 183 nick_lc( xd->given_nick );183 nick_lc( NULL, xd->given_nick ); 184 184 xd->given_pass = (char*) password; 185 185 … … 368 368 369 369 path2 = g_strdup( irc->user->nick ); 370 nick_lc( path2 );370 nick_lc( NULL, path2 ); 371 371 g_snprintf( path, sizeof( path ) - 20, "%s%s%s", global.conf->configdir, path2, ".xml" ); 372 372 g_free( path2 ); … … 424 424 425 425 lc = g_strdup( nick ); 426 nick_lc( lc );426 nick_lc( NULL, lc ); 427 427 g_snprintf( s, 511, "%s%s%s", global.conf->configdir, lc, ".xml" ); 428 428 g_free( lc );
Note: See TracChangeset
for help on using the changeset viewer.