Changeset d323394c
- Timestamp:
- 2007-04-20T04:49:30Z (18 years ago)
- Branches:
- master
- Children:
- 61ae52c
- Parents:
- f0cb961
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
nick.c
rf0cb961 rd323394c 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-200 6Wilmer van der Gaast and others *4 * Copyright 2002-2007 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 53 53 } 54 54 55 char *nick_get( account_t *acc, const char *handle , const char *realname)55 char *nick_get( account_t *acc, const char *handle ) 56 56 { 57 57 static char nick[MAX_NICK_LENGTH+1]; … … 76 76 while( *s ) 77 77 *(s++) = 0; 78 79 /* All-digit handles (mainly ICQ UINs) aren't cool, try to80 use the realname instead. */81 for( s = nick; *s && isdigit( *s ); s ++ );82 if( !*s && realname && *realname )83 g_snprintf( nick, MAX_NICK_LENGTH, "%s", realname );84 78 85 79 nick_strip( nick ); … … 130 124 } 131 125 126 /* Just check if there is a nickname set for this buddy or if we'd have to 127 generate one. */ 128 int nick_saved( account_t *acc, const char *handle ) 129 { 130 char *store_handle, *found; 131 132 store_handle = clean_handle( handle ); 133 found = g_hash_table_lookup( acc->nicks, store_handle ); 134 g_free( store_handle ); 135 136 return found != NULL; 137 } 138 132 139 void nick_del( account_t *acc, const char *handle ) 133 140 { … … 176 183 int nick_lc( char *nick ) 177 184 { 178 static char tab[ 256] = { 0 };185 static char tab[128] = { 0 }; 179 186 int i; 180 187 -
nick.h
rf0cb961 rd323394c 25 25 26 26 void nick_set( account_t *acc, const char *handle, const char *nick ); 27 char *nick_get( account_t *acc, const char *handle, const char *realname ); 27 char *nick_get( account_t *acc, const char *handle ); 28 int nick_saved( account_t *acc, const char *handle ); 28 29 void nick_del( account_t *acc, const char *handle ); 29 30 void nick_strip( char *nick ); -
protocols/nogaim.c
rf0cb961 rd323394c 372 372 373 373 memset( nick, 0, MAX_NICK_LENGTH + 1 ); 374 strcpy( nick, nick_get( ic->acc, handle , NULL) );374 strcpy( nick, nick_get( ic->acc, handle ) ); 375 375 376 376 u = user_add( ic->irc, nick ); … … 426 426 } 427 427 428 429 428 void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname ) 430 429 { 431 430 user_t *u = user_findhandle( ic, handle ); 431 char *s, newnick[MAX_NICK_LENGTH+1]; 432 432 433 433 if( !u || !realname ) return; … … 441 441 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) ) 442 442 imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname ); 443 444 if( !u->online && !nick_saved( ic->acc, handle ) ) 445 { 446 /* Detect numeric handles: */ 447 for( s = u->user; isdigit( *s ); s++ ); 448 449 if( *s == 0 ) 450 { 451 /* If we reached the end of the string, it only contained numbers. 452 Seems to be an ICQ# then, so hopefully realname contains 453 something more useful. */ 454 strcpy( newnick, realname ); 455 456 /* Some processing to make sure this string is a valid IRC nickname. */ 457 nick_strip( newnick ); 458 if( set_getbool( &ic->irc->set, "lcnicks" ) ) 459 nick_lc( newnick ); 460 461 u->nick = g_strdup( newnick ); 462 } 463 } 443 464 } 444 465 }
Note: See TracChangeset
for help on using the changeset viewer.