Changeset 1d39159 for protocols


Ignore:
Timestamp:
2010-04-05T00:18:24Z (15 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.

Location:
protocols
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • protocols/bee.h

    rf012a9f r1d39159  
    6868        gboolean (*user_new)( bee_t *bee, struct bee_user *bu );
    6969        gboolean (*user_free)( bee_t *bee, struct bee_user *bu );
     70        gboolean (*user_fullname)( bee_t *bee, bee_user_t *bu );
    7071        gboolean (*user_status)( bee_t *bee, struct bee_user *bu, struct bee_user *old );
    7172        gboolean (*user_msg)( bee_t *bee, bee_user_t *bu, const char *msg, time_t sent_at );
  • protocols/bee_user.c

    rf012a9f r1d39159  
    169169{
    170170        bee_t *bee = ic->bee;
    171         char *wrapped;
    172171        bee_user_t *bu;
    173172       
  • protocols/nogaim.c

    rf012a9f r1d39159  
    365365{
    366366        bee_user_t *bu;
    367         //char nick[MAX_NICK_LENGTH+1], *s;
    368367        bee_t *bee = ic->bee;
    369368       
     
    385384}
    386385
    387 void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *realname )
    388 {
    389 #if 0
    390         user_t *u = user_findhandle( ic, handle );
    391         char *set;
    392        
    393         if( !u || !realname ) return;
    394        
    395         if( g_strcasecmp( u->realname, realname ) != 0 )
    396         {
    397                 if( u->realname != u->nick ) g_free( u->realname );
    398                
    399                 u->realname = g_strdup( realname );
    400                
    401                 if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->bee->set, "display_namechanges" ) )
    402                         imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
    403         }
    404        
    405         set = set_getstr( &ic->acc->set, "nick_source" );
    406         if( strcmp( set, "handle" ) != 0 )
    407         {
    408                 char *name = g_strdup( realname );
    409                
    410                 if( strcmp( set, "first_name" ) == 0 )
    411                 {
    412                         int i;
    413                         for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {}
    414                         name[i] = '\0';
    415                 }
    416                
    417                 imcb_buddy_nick_hint( ic, handle, name );
    418                
    419                 g_free( name );
    420         }
    421 #endif
     386void imcb_rename_buddy( struct im_connection *ic, const char *handle, const char *fullname )
     387{
     388        bee_t *bee = ic->bee;
     389        bee_user_t *bu = bee_user_by_handle( bee, ic, handle );
     390       
     391        if( !bu || !fullname ) return;
     392       
     393        if( strcmp( bu->fullname, fullname ) != 0 )
     394        {
     395                g_free( bu->fullname );
     396                bu->fullname = g_strdup( fullname );
     397               
     398                if( bee->ui->user_fullname )
     399                        bee->ui->user_fullname( bee, bu );
     400        }
    422401}
    423402
Note: See TracChangeset for help on using the changeset viewer.