aboutsummaryrefslogtreecommitdiffstats
path: root/protocols/nogaim.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-03-13 01:02:47 +0000
committerWilmer van der Gaast <wilmer@gaast.net>2010-03-13 01:02:47 +0000
commit286b28eabf39d98d642c73c34a16a599e61dfc99 (patch)
treec1d152c5c3e0e8353b7097a5aa521a761c6fe976 /protocols/nogaim.c
parent1be0d260da62542dd27b8a6f5d367a2e79191a8d (diff)
Added nick_source account setting to allow using full name fields for
generating nicknames instead of just the handle.
Diffstat (limited to 'protocols/nogaim.c')
-rw-r--r--protocols/nogaim.c18
1 files changed, 18 insertions, 0 deletions
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 )