ii

My fork of https://tools.suckless.org/ii/
git clone https://git.inz.fi/ii
Log | Files | Refs | README | LICENSE

commit f7348448b4bb93657b5f2b67d735b0f63daee99a
parent ebd28d7733b11dbc957e93b2931988311c51b052
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Mon, 23 Jan 2006 14:11:36 +0200

fixed server out issue

Diffstat:
Mii.c | 25+++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/ii.c b/ii.c @@ -44,7 +44,7 @@ static void usage() { fprintf(stderr, "%s", "ii - irc it - " VERSION "\n" - " (C)opyright MMV Anselm R. Garbe, Nico Golde\n" + " (C)opyright MMVI Anselm R. Garbe, Nico Golde\n" "usage: ii [-i <irc dir>] [-s <host>] [-p <port>]\n" " [-n <nick>] [-k <password>] [-f <fullname>]\n"); exit(EXIT_SUCCESS); @@ -108,10 +108,15 @@ static int open_channel(char *name) static void add_channel(char *name) { Channel *c; - int fd = open_channel(name); + int fd; + + for(c = channels; c; c = c->next) + if(!strcmp(name, c->name)) + return; /* already handled */ + fd = open_channel(name); if(fd == -1) { - perror("ii: cannot create in channels"); + perror("ii: cannot create in channel"); return; } if(!channels) @@ -420,7 +425,6 @@ static void run() fd_set rd; for(;;) { - /* prepare */ FD_ZERO(&rd); maxfd = irc; FD_SET(irc, &rd); @@ -438,14 +442,11 @@ static void run() perror("ii: error on select()"); exit(EXIT_FAILURE); } else if(r > 0) { - for(c = channels; c; c = c->next) { - if(FD_ISSET(c->fd, &rd)) { - if(c->fd == irc) - handle_server_output(); - else - handle_channels_input(c); - } - } + if(FD_ISSET(irc, &rd)) + handle_server_output(); + for(c = channels; c; c = c->next) + if(FD_ISSET(c->fd, &rd)) + handle_channels_input(c); } } }