Changeset badd148
- Timestamp:
- 2010-07-12T23:22:53Z (14 years ago)
- Branches:
- master
- Children:
- db2cef1
- Parents:
- 09dfb68
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r09dfb68 rbadd148 242 242 } 243 243 244 static gboolean bee_irc_user_nick_ hint( bee_t *bee, bee_user_t *bu, const char *hint);244 static gboolean bee_irc_user_nick_update( irc_user_t *iu ); 245 245 246 246 static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu ) … … 265 265 } 266 266 267 s = set_getstr( &bu->ic->acc->set, "nick_source" ); 268 if( strcmp( s, "handle" ) != 0 ) 269 { 270 char *name = g_strdup( bu->fullname ); 271 272 if( strcmp( s, "first_name" ) == 0 ) 273 { 274 int i; 275 for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {} 276 name[i] = '\0'; 277 } 278 279 bee_irc_user_nick_hint( bee, bu, name ); 280 281 g_free( name ); 282 } 267 bee_irc_user_nick_update( iu ); 283 268 284 269 return TRUE; … … 287 272 static gboolean bee_irc_user_nick_hint( bee_t *bee, bee_user_t *bu, const char *hint ) 288 273 { 289 irc_user_t *iu = bu->ui_data; 290 char newnick[MAX_NICK_LENGTH+1], *translit; 274 bee_irc_user_nick_update( (irc_user_t*) bu->ui_data ); 275 276 return TRUE; 277 } 278 279 static gboolean bee_irc_user_group( bee_t *bee, bee_user_t *bu ) 280 { 281 irc_user_t *iu = (irc_user_t *) bu->ui_data; 282 irc_t *irc = (irc_t *) bee->ui_data; 283 284 bee_irc_channel_update( irc, NULL, iu ); 285 bee_irc_user_nick_update( iu ); 286 287 return TRUE; 288 } 289 290 static gboolean bee_irc_user_nick_update( irc_user_t *iu ) 291 { 292 bee_user_t *bu = iu->bu; 293 char *newnick; 291 294 292 295 if( bu->flags & BEE_USER_ONLINE ) … … 298 301 return TRUE; 299 302 300 /* Credits to Josay_ in #bitlbee for this idea. //TRANSLIT should 301 do lossy/approximate conversions, so letters with accents don't 302 just get stripped. Note that it depends on LC_CTYPE being set to 303 something other than C/POSIX. */ 304 translit = g_convert( hint, -1, "ASCII//TRANSLIT//IGNORE", "UTF-8", 305 NULL, NULL, NULL ); 306 307 strncpy( newnick, translit ? : hint, MAX_NICK_LENGTH ); 308 newnick[MAX_NICK_LENGTH] = 0; 309 g_free( translit ); 310 311 /* Some processing to make sure this string is a valid IRC nickname. */ 312 nick_strip( newnick ); 313 if( set_getbool( &bee->set, "lcnicks" ) ) 314 nick_lc( newnick ); 303 newnick = nick_get( bu ); 315 304 316 305 if( strcmp( iu->nick, newnick ) != 0 ) 317 306 { 318 /* Only do this if newnick is different from the current one.319 If rejoining a channel, maybe we got this nick already320 (and dedupe would only add an underscore. */321 307 nick_dedupe( bu, newnick ); 322 308 irc_user_set_nick( iu, newnick ); 323 309 } 324 325 return TRUE;326 }327 328 static gboolean bee_irc_user_group( bee_t *bee, bee_user_t *bu )329 {330 irc_user_t *iu = (irc_user_t *) bu->ui_data;331 irc_t *irc = (irc_t *) bee->ui_data;332 333 bee_irc_channel_update( irc, NULL, iu );334 310 335 311 return TRUE; -
nick.c
r09dfb68 rbadd148 116 116 while( fmt && *fmt && ret->len < MAX_NICK_LENGTH ) 117 117 { 118 char *part, chop = '\0' ;118 char *part, chop = '\0', *asc = NULL; 119 119 120 120 if( *fmt != '%' ) … … 177 177 } 178 178 179 /* Credits to Josay_ in #bitlbee for this idea. //TRANSLIT 180 should do lossy/approximate conversions, so letters with 181 accents don't just get stripped. Note that it depends on 182 LC_CTYPE being set to something other than C/POSIX. */ 183 if( part ) 184 part = asc = g_convert( part, -1, "ASCII//TRANSLIT//IGNORE", 185 "UTF-8", NULL, NULL, NULL ); 186 179 187 while( part && *part && *part != chop ) 180 188 { … … 185 193 part ++; 186 194 } 195 g_free( asc ); 187 196 } 188 197 … … 195 204 irc_t *irc = (irc_t*) bu->bee->ui_data; 196 205 int inf_protection = 256; 206 irc_user_t *iu; 197 207 198 208 /* Now, find out if the nick is already in use at the moment, and make 199 209 subtle changes to make it unique. */ 200 while( !nick_ok( nick ) || irc_user_by_name( irc, nick ) ) 210 while( !nick_ok( nick ) || 211 ( ( iu = irc_user_by_name( irc, nick ) ) && iu->bu != bu ) ) 201 212 { 202 213 if( strlen( nick ) < ( MAX_NICK_LENGTH - 1 ) ) -
protocols/account.c
r09dfb68 rbadd148 55 55 56 56 s = set_add( &a->set, "nick_format", NULL, NULL, a ); 57 s->flags |= SET_NULL_OK; 57 58 58 59 s = set_add( &a->set, "nick_source", "handle", NULL, a ); -
unix.c
r09dfb68 rbadd148 39 39 #include <sys/wait.h> 40 40 #include <pwd.h> 41 #include <locale.h> 41 42 42 43 global_t global; /* Against global namespace pollution */ … … 51 52 char *old_cwd = NULL; 52 53 struct sigaction sig, old; 54 55 /* Required to make iconv to ASCII//TRANSLIT work. This makes BitlBee 56 system-locale-sensitive. :-( */ 57 setlocale( LC_CTYPE, "" ); 53 58 54 59 if( argc > 1 && strcmp( argv[1], "-x" ) == 0 )
Note: See TracChangeset
for help on using the changeset viewer.