From 62f4f17989622a91aa39834b73d4e527a96ce211 Mon Sep 17 00:00:00 2001 From: Nakidai Date: Wed, 7 Jan 2026 00:43:50 +0300 Subject: Move quit announcement code to quit() Well, it's more appropriate for that function to handle this rather than for ircd(). Now code looks simpler, ircd() is not that complex, and support for optional quit message is present --- loop.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) (limited to 'loop.c') diff --git a/loop.c b/loop.c index 9e91438..aa3f458 100644 --- a/loop.c +++ b/loop.c @@ -39,7 +39,7 @@ int port; void ircd(void) { - size_t i, j, k; + size_t i; struct sockaddr_in addr, clientaddr; int res, sfd, client; nfds_t passed; @@ -123,32 +123,6 @@ loop: if (!(peers[i].flags & DELETE)) continue; - if (peers[i].type) - writef( - peers[i].fd, - ":%s!%s@%s QUIT", - getnick(&peers[i]), - peers[i].user, - peers[i].host - ); - for (j = 0; j < peers[i].channels_c; ++j) - { - channel_exit(peers[i].channels[j], &peers[i]); - if (peers[i].type) for (k = 0; k < peers[i].channels[j]->users_c; ++k) - peers[i].channels[j]->users[k]->flags |= ANNOUNCE; - } - for (j = 0; j < peers_c; ++j) - if (peers[j].flags & ANNOUNCE) - { - writef( - peers[j].fd, - ":%s!%s@%s QUIT", - getnick(&peers[i]), - peers[i].user, - peers[i].host - ); - peers[j].flags &= ~ANNOUNCE; - } writef(peers[i].fd, "ERROR :Closing Link: %s", peers[i].host); close(peers[i].fd); user_remove(i); -- cgit 1.4.1