- if (Client_Conn(target) > NONE) {
- /* Local client */
- Log(LOG_INFO,
- "%s \"%s\" changed nick (connection %d): \"%s\" -> \"%s\".",
- Client_TypeText(target), Client_Mask(target),
- Client_Conn(target), Client_ID(target),
- Req->argv[0]);
- Conn_UpdateIdle(Client_Conn(target));
- } else {
- /* Remote client */
- LogDebug("%s \"%s\" changed nick: \"%s\" -> \"%s\".",
- Client_TypeText(target),
- Client_Mask(target), Client_ID(target),
- Req->argv[0]);
- }
-
- /* Inform all users and servers (which have to know)
- * of this nickname change */
- if( Client_Type( Client ) == CLIENT_USER )
- IRC_WriteStrClientPrefix( Client, Client,
- "NICK :%s",
- Req->argv[0] );
- IRC_WriteStrServersPrefix( Client, target,
- "NICK :%s", Req->argv[0] );
- IRC_WriteStrRelatedPrefix( target, target, false,
- "NICK :%s", Req->argv[0] );
-
- /* Register old nickname for WHOWAS queries */
- Client_RegisterWhowas( target );
-
- /* Save new nickname */
- Client_SetID( target, Req->argv[0] );
-
- IRC_SetPenalty( target, 2 );
+ Change_Nick(Client, target, Req->argv[0],
+ Client_Type(Client) == CLIENT_USER ? true : false);
+ IRC_SetPenalty(target, 2);