sic

simple irc client
git clone git://git.suckless.org/sic
Log | Files | Refs | README | LICENSE

commit 5d19f0415e5e9412183d3e3468296e7bf193f071
parent 2c257c70bc2529aafcc1116b4247ba214d70ff00
Author: arg@mmvi <unknown>
Date:   Tue, 19 Sep 2006 16:54:52 +0200

simplified sic
Diffstat:
sic.c | 25++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/sic.c b/sic.c @@ -76,22 +76,10 @@ parsein(char *msg) privmsg(channel, msg); return; } - if((p = strchr(&msg[3], ' '))) - *(p++) = 0; - if(!strncmp(msg + 1, "j ", 2)) { - if(msg[3] == '#') - snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]); - else if(p) { - privmsg(&msg[3], p + 1); - return; - } - } - else if(!strncmp(msg + 1, "l ", 2)) { - if(p) - snprintf(bufout, sizeof(bufout), "PART %s :%s\r\n", &msg[3], p); - else - snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]); - } + if(!strncmp(msg + 1, "j ", 2) && (msg[3] == '#')) + snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]); + else if(!strncmp(msg + 1, "l ", 2)) + snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]); else if(!strncmp(msg + 1, "m ", 2)) { privmsg(&msg[3], p); return; @@ -100,8 +88,11 @@ parsein(char *msg) strncpy(channel, &msg[3], sizeof(channel)); return; } - else if(!strncmp(msg + 1, "t ", 2)) + else if(!strncmp(msg + 1, "t ", 2)) { + if(p = strchr(&msg[3], ' ')) + *(p++) = 0; snprintf(bufout, sizeof(bufout), "TOPIC %s :%s\r\n", &msg[3], p); + } else snprintf(bufout, sizeof(bufout), "%s\r\n", &msg[1]); write(srv, bufout, strlen(bufout));