From 3b79f7dd44ccfdc269a82443e545be3e975b578c Mon Sep 17 00:00:00 2001 From: Egor Date: Sat, 28 Oct 2023 00:27:49 +0300 Subject: [PATCH] update client->nuh on chghost --- src/irc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/irc.c b/src/irc.c index 258478e..4f8f505 100644 --- a/src/irc.c +++ b/src/irc.c @@ -1331,10 +1331,18 @@ void client_chghost(struct client_data *client, const char *newusername, const c sendbuf(client); rpl_visiblehost(client), sendbuf(client); int changedacc = client->username[0] != '~' || newusername[0] != '~'; + free(client->username); client->username = mystrdup(newusername); free(client->hostname); client->hostname = mystrdup(newhostname); + free(client->nuh); + client->nuh = malloc(strlen(client->nick) + strlen(client->username) + strlen(client->hostname) + 3); + if (!client->nuh) + abort(); + sprintf(client->nuh, "%s!%s@%s", client->nick, client->username, client->hostname); + stringlower(client->nuh); + struct channel *chan; map_foreach(&client->channels, 0, &chan) { msg_join(client, chan); -- 2.56.0