From c53911ec23848d13cbbaa10286895d874abd0b08 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Sat, 20 May 2006 13:48:08 +0200 Subject: Fixed a string handling mistake and better stripping of servernames used in user_t structures. --- protocols/nogaim.c | 9 ++++++++- user.c | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/protocols/nogaim.c b/protocols/nogaim.c index eee104c4..568afe33 100644 --- a/protocols/nogaim.c +++ b/protocols/nogaim.c @@ -482,7 +482,14 @@ void add_buddy( struct gaim_connection *gc, char *group, char *handle, char *rea } else if( gc->user->proto_opt[0] && *gc->user->proto_opt[0] ) { - u->host = g_strdup( gc->user->proto_opt[0] ); + char *colon; + + if( ( colon = strchr( gc->user->proto_opt[0], ':' ) ) ) + u->host = g_strndup( gc->user->proto_opt[0], + colon - gc->user->proto_opt[0] ); + else + u->host = g_strdup( gc->user->proto_opt[0] ); + u->user = g_strdup( handle ); /* s/ /_/ ... important for AOL screennames */ diff --git a/user.c b/user.c index b795c864..9c987fa5 100644 --- a/user.c +++ b/user.c @@ -167,8 +167,8 @@ void user_rename( irc_t *irc, char *oldnick, char *newnick ) if( u->nick == u->realname ) u->realname = NULL; u->nick = g_strdup( newnick ); if( !u->user ) u->user = u->nick; - if( !u->host ) u->user = u->host; - if( !u->realname ) u->user = u->realname; + if( !u->host ) u->host = u->nick; + if( !u->realname ) u->realname = u->nick; /* Remove the old reference to this user from the hash and create a new one with the new nick. This is indeed a bit messy. */ -- cgit v1.2.3