- Timestamp:
- 2010-06-07T21:09:33Z (14 years ago)
- Branches:
- master
- Children:
- f1cea66
- Parents:
- 619dd18
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
irc_im.c
r619dd18 r6ef9065 220 220 } 221 221 222 static gboolean bee_irc_user_nick_hint( bee_t *bee, bee_user_t *bu, const char *hint ); 223 222 224 static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu ) 223 225 { … … 253 255 } 254 256 255 imcb_buddy_nick_hint( bu->ic, bu->handle, name );257 bee_irc_user_nick_hint( bee, bu, name ); 256 258 257 259 g_free( name ); 260 } 261 262 return TRUE; 263 } 264 265 static gboolean bee_irc_user_nick_hint( bee_t *bee, bee_user_t *bu, const char *hint ) 266 { 267 irc_user_t *iu = bu->ui_data; 268 char newnick[MAX_NICK_LENGTH+1], *translit; 269 270 if( bu->flags & BEE_USER_ONLINE ) 271 /* Ignore if the user is visible already. */ 272 return TRUE; 273 274 if( nick_saved( bu->ic->acc, bu->handle ) ) 275 /* The user already assigned a nickname to this person. */ 276 return TRUE; 277 278 /* Credits to Josay_ in #bitlbee for this idea. //TRANSLIT should 279 do lossy/approximate conversions, so letters with accents don't 280 just get stripped. Note that it depends on LC_CTYPE being set to 281 something other than C/POSIX. */ 282 translit = g_convert( hint, -1, "ASCII//TRANSLIT//IGNORE", "UTF-8", 283 NULL, NULL, NULL ); 284 285 strncpy( newnick, translit ? : hint, MAX_NICK_LENGTH ); 286 newnick[MAX_NICK_LENGTH] = 0; 287 g_free( translit ); 288 289 /* Some processing to make sure this string is a valid IRC nickname. */ 290 nick_strip( newnick ); 291 if( set_getbool( &bee->set, "lcnicks" ) ) 292 nick_lc( newnick ); 293 294 if( strcmp( iu->nick, newnick ) != 0 ) 295 { 296 /* Only do this if newnick is different from the current one. 297 If rejoining a channel, maybe we got this nick already 298 (and dedupe would only add an underscore. */ 299 nick_dedupe( bu->ic->acc, bu->handle, newnick ); 300 irc_user_set_nick( iu, newnick ); 258 301 } 259 302 … … 722 765 bee_irc_user_free, 723 766 bee_irc_user_fullname, 767 bee_irc_user_nick_hint, 724 768 bee_irc_user_group, 725 769 bee_irc_user_status,
Note: See TracChangeset
for help on using the changeset viewer.