aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--account.c2
-rw-r--r--doc/user-guide/commands.xml15
-rw-r--r--protocols/nogaim.c18
3 files changed, 35 insertions, 0 deletions
diff --git a/account.c b/account.c
index 99c3ff53..a844d229 100644
--- a/account.c
+++ b/account.c
@@ -54,6 +54,8 @@ account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass )
s = set_add( &a->set, "auto_reconnect", "true", set_eval_bool, a );
+ s = set_add( &a->set, "nick_source", "handle", NULL, a );
+
s = set_add( &a->set, "password", NULL, set_eval_account, a );
s->flags |= ACC_SET_NOSAVE | SET_NULL_OK;
diff --git a/doc/user-guide/commands.xml b/doc/user-guide/commands.xml
index a7d06cf1..931608ee 100644
--- a/doc/user-guide/commands.xml
+++ b/doc/user-guide/commands.xml
@@ -607,6 +607,21 @@
</description>
</bitlbee-setting>
+ <bitlbee-setting name="nick_source" type="string" scope="account">
+ <default>handle</default>
+ <possible-values>handle, full_name, first_name</possible-values>
+
+ <description>
+ <para>
+ 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.
+ </para>
+
+ <para>
+ 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.
+ </para>
+ </description>
+ </bitlbee-setting>
+
<bitlbee-setting name="ops" type="string" scope="global">
<default>both</default>
<possible-values>both, root, user, none</possible-values>
diff --git a/protocols/nogaim.c b/protocols/nogaim.c
index 603905ab..6ee89e29 100644
--- a/protocols/nogaim.c
+++ b/protocols/nogaim.c
@@ -447,6 +447,7 @@ struct buddy *imcb_find_buddy( struct im_connection *ic, char *handle )
void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
{
user_t *u = user_findhandle( ic, handle );
+ char *set;
if( !u || !realname ) return;
@@ -459,6 +460,23 @@ void imcb_rename_buddy( struct im_connection *ic, char *handle, char *realname )
if( ( ic->flags & OPT_LOGGED_IN ) && set_getbool( &ic->irc->set, "display_namechanges" ) )
imcb_log( ic, "User `%s' changed name to `%s'", u->nick, u->realname );
}
+
+ set = set_getstr( &ic->acc->set, "nick_source" );
+ if( strcmp( set, "handle" ) != 0 )
+ {
+ char *name = g_strdup( realname );
+
+ if( strcmp( set, "first_name" ) == 0 )
+ {
+ int i;
+ for( i = 0; name[i] && !isspace( name[i] ); i ++ ) {}
+ name[i] = '\0';
+ }
+
+ imcb_buddy_nick_hint( ic, handle, name );
+
+ g_free( name );
+ }
}
void imcb_remove_buddy( struct im_connection *ic, char *handle, char *group )