diff options
Diffstat (limited to 'irc_user.c')
| -rw-r--r-- | irc_user.c | 18 | 
1 files changed, 17 insertions, 1 deletions
| @@ -82,15 +82,31 @@ irc_user_t *irc_user_by_name( irc_t *irc, const char *nick )  		return NULL;  } -int irc_user_rename( irc_t *irc, const char *old, const char *new ) +int irc_user_set_nick( irc_t *irc, const char *old, const char *new )  {  	irc_user_t *iu = irc_user_by_name( irc, old );  	char key[strlen(new)+1]; +	GSList *cl;  	strcpy( key, new );  	if( iu == NULL || !nick_lc( key ) || irc_user_by_name( irc, new ) )  		return 0; +	for( cl = irc->channels; cl; cl = cl->next ) +	{ +		irc_channel_t *ic = cl->data; +		 +		/* Send a NICK update if we're renaming our user, or someone +		   who's in the same channel like our user. */ +		if( iu == irc->user || +		    ( irc_channel_has_user( ic, irc->user ) && +		      irc_channel_has_user( ic, iu ) ) ) +		{ +			irc_send_nick( iu, new ); +			break; +		} +	} +	  	irc->users = g_slist_remove( irc->users, iu );  	g_hash_table_remove( irc->nick_user_hash, iu->key ); | 
