]> PatchyGit - patchyircd.git/commitdiff
update client->nuh on chghost
authorEgor <egor@patchysicp.xyz>
Fri, 27 Oct 2023 21:27:49 +0000 (00:27 +0300)
committerEgor <egor@patchysicp.xyz>
Fri, 27 Oct 2023 21:27:49 +0000 (00:27 +0300)
src/irc.c

index 258478e..4f8f505 100644 (file)
--- 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);