Changeset 1d39159 for irc_im.c


Ignore:
Timestamp:
2010-04-05T00:18:24Z (14 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
0b5cc72
Parents:
f012a9f
Message:

Get full names properly. Handling of nick_source setting and
imcb_nick_hint() is probably still broken.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    rf012a9f r1d39159  
    120120}
    121121
     122static gboolean bee_irc_user_fullname( bee_t *bee, bee_user_t *bu )
     123{
     124        irc_user_t *iu = (irc_user_t *) bu->ui_data;
     125        irc_t *irc = (irc_t *) bee->ui_data;
     126        char *s;
     127       
     128        if( iu->fullname != iu->nick )
     129                g_free( iu->fullname );
     130        iu->fullname = g_strdup( bu->fullname );
     131       
     132        /* Strip newlines (unlikely, but IRC-unfriendly so they must go)
     133           TODO(wilmer): Do the same with away msgs again! */
     134        for( s = iu->fullname; *s; s ++ )
     135                if( isspace( *s ) ) *s = ' ';
     136       
     137        if( ( bu->ic->flags & OPT_LOGGED_IN ) && set_getbool( &bee->set, "display_namechanges" ) )
     138        {
     139                char *msg = g_strdup_printf( "<< \002BitlBee\002 - Changed name to `%s' >>", iu->fullname );
     140                irc_send_msg( iu, "NOTICE", irc->user->nick, msg, NULL );
     141        }
     142       
     143        s = set_getstr( &bu->ic->acc->set, "nick_source" );
     144        if( strcmp( s, "handle" ) != 0 )
     145        {
     146                char *name = g_strdup( bu->fullname );
     147               
     148                if( strcmp( s, "first_name" ) == 0 )
     149                {
     150                        int i;
     151                        for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {}
     152                        name[i] = '\0';
     153                }
     154               
     155                imcb_buddy_nick_hint( bu->ic, bu->handle, name );
     156               
     157                g_free( name );
     158        }
     159       
     160        return TRUE;
     161}
     162
    122163const struct bee_ui_funcs irc_ui_funcs = {
    123164        bee_irc_user_new,
    124165        bee_irc_user_free,
     166        bee_irc_user_fullname,
    125167        bee_irc_user_status,
    126168        bee_irc_user_msg,
Note: See TracChangeset for help on using the changeset viewer.