fixed several annoyances

This commit is contained in:
Anselm R. Garbe 2006-09-05 09:47:15 +02:00
parent fb185a5e18
commit 2c257c70bc

24
sic.c
View File

@ -78,34 +78,32 @@ parsein(char *msg)
} }
if((p = strchr(&msg[3], ' '))) if((p = strchr(&msg[3], ' ')))
*(p++) = 0; *(p++) = 0;
switch (msg[1]) { if(!strncmp(msg + 1, "j ", 2)) {
default:
snprintf(bufout, sizeof(bufout), "%s\r\n", &msg[1]);
break;
case 'j':
if(msg[3] == '#') if(msg[3] == '#')
snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]); snprintf(bufout, sizeof(bufout), "JOIN %s\r\n", &msg[3]);
else if(p) { else if(p) {
privmsg(&msg[3], p + 1); privmsg(&msg[3], p + 1);
return; return;
} }
break; }
case 'l': else if(!strncmp(msg + 1, "l ", 2)) {
if(p) if(p)
snprintf(bufout, sizeof(bufout), "PART %s :%s\r\n", &msg[3], p); snprintf(bufout, sizeof(bufout), "PART %s :%s\r\n", &msg[3], p);
else else
snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]); snprintf(bufout, sizeof(bufout), "PART %s :sic\r\n", &msg[3]);
break; }
case 'm': else if(!strncmp(msg + 1, "m ", 2)) {
privmsg(&msg[3], p); privmsg(&msg[3], p);
return; return;
case 's': }
else if(!strncmp(msg + 1, "s ", 2)) {
strncpy(channel, &msg[3], sizeof(channel)); strncpy(channel, &msg[3], sizeof(channel));
return; return;
case 't':
snprintf(bufout, sizeof(bufout), "TOPIC %s :%s\r\n", &msg[3], p);
break;
} }
else if(!strncmp(msg + 1, "t ", 2))
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)); write(srv, bufout, strlen(bufout));
} }