}
void sendbuf_visible(struct client_data *client) {
int cookie = get_cookie();
- struct trie_find *f1 = NULL, *f2 = NULL;
- if (trie_findfirst(&f1, &client->channels) == 1)
+ struct trie_find *f = NULL;
+ if (trie_findfirst(&f, &client->channels) == 1)
do {
- struct channel *chan = f1->n->value;
- if (trie_findfirst(&f2, &chan->members) == 1)
- do {
- struct client_data *cl = f2->n->value;
- if (cl->cookie != cookie) {
- sendbuf(cl);
- cl->cookie = cookie;
- }
- } while (trie_findnext(&f2) == 1);
- } while (trie_findnext(&f1) == 1);
+ struct channel *chan = f->n->value;
+ sendbuf_list_sans_self(client, &chan->members, cookie);
+ } while (trie_findnext(&f) == 1);
}
const char *format_umodes(struct client_data *cl) {
static char umodes[6] = "";
rpl_away(client, cl), sendbuf(client);
}
}
- // Start GitHub Copilot - this shit actually be copy pasting my code lmao
} else if(strcmp(command, "QUIT") == 0) {
msg_quit(client, "Quit: ", args[0] ? args[0] : "");
sendbuf_visible(client);
clients[i] = 0;
if (cl->peername)
fprintf(stderr, "Client disconnected from Socket: %"PRISocket", IP: %s PORT: %d\n", cl->FD, cl->peername, cl->peerport);
- // Start GitHub Copilot
if(!byChoice && cl->nick && cl->username) {
msg_quit(cl, "", "Has left the building (Forced)");
sendbuf_visible(cl);
// Send error to client informing them that they will be disconnected
msg_error("Closing Link");
sendbuf(cl);
- // End GitHub Copilot
if (cl->FD != INVALID_SOCKET) {
#ifdef HAS_TLS
if (cl->cctx) {