client->realname = strdup(args[3]);
if (!client->realname)
abort();
+ client->hostname = strdup(hostname);
+ if (!client->hostname)
+ abort();
// Send welcome
if (client->nick && client->username)
newUser(client);
*p = '\0';
break;
}
- copy_strf(&databuf, ":%s JOIN :%s\n", client->nick, args[0]);
+ copy_strf(&databuf, ":%s!%s@%s JOIN :%s\n", client->nick, client->username, client->hostname, args[0]);
// End GitHub Copilot
send_log(client->FD, databuf.buf, databuf.len, 0);
sendall_log(client->FD, databuf.buf, databuf.len, 0);
return 0;
if (argc < 2) // FIXME: error message
return 0;
- copy_strf(&databuf, ":%s PRIVMSG %s :%s\n", client->nick, args[0], args[1]);
+ copy_strf(&databuf, ":%s!%s@%s PRIVMSG %s :%s\n", client->nick, client->username, client->hostname, args[0], args[1]);
sendall_log(client->FD, databuf.buf, databuf.len, 0);
// Start GitHub Copilot - this shit actually be copy pasting my code lmao
} else if(strcmp(command, "QUIT") == 0) {
- copy_strf(&databuf, ":%s QUIT :%s\n", client->nick, args[0] ? args[0] : "Client Quit");
+ copy_strf(&databuf, ":%s!%s@%s QUIT :%s\n", client->nick, client->username, client->hostname, args[0] ? args[0] : "Client Quit");
sendall_log(client->FD, databuf.buf, databuf.len, 0);
killConnection(client, true);
return 1;
// Update nickname
if(client->nick) {
- copy_strf(&databuf, ":%s NICK %s\n", client->nick, nickname);
+ copy_strf(&databuf, ":%s!%s@%s NICK %s\n", client->nick, client->username, client->hostname, nickname);
send_log(client->FD, databuf.buf, databuf.len, 0);
sendall_log(client->FD, databuf.buf, databuf.len, 0);
trie_set(&client_map, client->key, NULL, NULL);
}
#endif
// Start GitHub Copilot
- if(!byChoice) {
- copy_strf(&databuf, ":%s QUIT :Has left the building (Forced)\n", cl->nick);
+ if(!byChoice && cl->nick && cl->username) {
+ copy_strf(&databuf, ":%s!%s@%s QUIT :Has left the building (Forced)\n", cl->nick, cl->username, cl->hostname);
sendall_log(cl->FD, databuf.buf, databuf.len, 0);
}
// Send error to client informing them that they will be disconnected
free(cl->key);
free(cl->username);
free(cl->realname);
+ free(cl->hostname);
free(cl);
}