Changeset 286b28e


Ignore:
Timestamp:
2010-03-13T01:02:47Z (15 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
bb34771
Parents:
1be0d26
Message:

Added nick_source account setting to allow using full name fields for
generating nicknames instead of just the handle.

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • account.c

    r1be0d26 r286b28e  
    5454       
    5555        s = set_add( &a->set, "auto_reconnect", "true", set_eval_bool, a );
     56       
     57        s = set_add( &a->set, "nick_source", "handle", NULL, a );
    5658       
    5759        s = set_add( &a->set, "password", NULL, set_eval_account, a );
  • doc/user-guide/commands.xml

    r1be0d26 r286b28e  
    608608        </bitlbee-setting>
    609609
     610        <bitlbee-setting name="nick_source" type="string" scope="account">
     611                <default>handle</default>
     612                <possible-values>handle, full_name, first_name</possible-values>
     613
     614                <description>
     615                        <para>
     616                                By default, BitlBee generates a nickname for every contact by taking its handle and chopping off everything after the @. In some cases, this gives very inconvenient nicknames. The Facebook XMPP server is a good example, as all Facebook XMPP handles are numeric.
     617                        </para>
     618
     619                        <para>
     620                                With this setting set to <emphasis>full_name</emphasis>, the person's full name is used to generate a nickname. Or if you don't like long nicknames, set this setting to <emphasis>first_name</emphasis> instead and only the first word will be used. Note that the full name can be full of non-ASCII characters which will be stripped off.
     621                        </para>
     622                </description>
     623        </bitlbee-setting>
     624
    610625        <bitlbee-setting name="ops" type="string" scope="global">
    611626                <default>both</default>
  • protocols/nogaim.c

    r1be0d26 r286b28e  
    448448{
    449449        user_t *u = user_findhandle( ic, handle );
     450        char *set;
    450451       
    451452        if( !u || !realname ) return;
     
    459460                if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
    460461                        imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
     462        }
     463       
     464        set = set_getstr( &ic->acc->set, "nick_source" );
     465        if( strcmp( set, "handle" ) != 0 )
     466        {
     467                char *name = g_strdup( realname );
     468               
     469                if( strcmp( set, "first_name" ) == 0 )
     470                {
     471                        int i;
     472                        for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {}
     473                        name[i] = '\0';
     474                }
     475               
     476                imcb_buddy_nick_hint( ic, handle, name );
     477               
     478                g_free( name );
    461479        }
    462480}
Note: See TracChangeset for help on using the changeset viewer.