void parse_server(char *line) { char *from, *comm, *end; int numeric; char **ArgList; char copy[BIG_BUFFER_SIZE + 1]; char *TrueArgs[MAXPARA + 1] = { NULL }; if (!line || !*line) return; TRACE("srv: %s\n", line); end = strlen(line) + line; if (*--end == '\n') *end-- = '\0'; if (*end == '\r') *end-- = '\0'; if (!line || !*line) return; if (*line == ':') { if (!do_hook(RAW_IRC_LIST, "%s", line + 1)) return; } else if (!do_hook(RAW_IRC_LIST, "* %s", line)) return; ArgList = TrueArgs; strncpy(copy, line, BIG_BUFFER_SIZE); FixColorAnsi(line); BreakArgs(line, &from, ArgList, 0); if (!(comm = (*ArgList++)) || !from || !*ArgList) return; /* Empty line from server - ByeBye */ /* * I reformatted these in may '96 by using the output of /stats m * from a few busy servers. They are arranged so that the most * common types are high on the list (to save the average number * of compares.) I will be doing more testing in the future on * a live client to see if this is a reasonable order. */ if ((numeric = atoi(comm))) numbered_command(from, numeric, ArgList); /* There are the core msgs for most non-numeric traffic. */ else if (!strcmp(comm, "PRIVMSG")) p_privmsg(from, ArgList); else if (!strcmp(comm, "JOIN")) p_channel(from, ArgList); else if (!strcmp(comm, "PART")) p_part(from, ArgList); else if (!strcmp(comm, "MODE")) p_mode(from, ArgList); else if (!strcmp(comm, "QUIT")) p_quit(from, ArgList); else if (!strcmp(comm, "NOTICE")) parse_notice(from, ArgList); else if (!strcmp(comm, "NICK")) p_nick(from, ArgList); else if (!strcmp(comm, "TOPIC")) p_topic(from, ArgList); else if (!strcmp(comm, "KICK")) p_kick(from, ArgList); else if (!strcmp(comm, "INVITE")) p_invite(from, ArgList); /* These are used, but not nearly as much as ones above */ else if (!strcmp(comm, "WALLOPS")) p_wallops(from, ArgList); else if (!strcmp(comm, "ERROR")) p_error(from, ArgList); else if (!strcmp(comm, "ERROR:")) p_error(from, ArgList); else if (!strcmp(comm, "SILENCE")) p_silence(from, ArgList); else if (!strcmp(comm, "KILL")) p_kill(from, ArgList); else if (!strcmp(comm, "PONG")) p_pong(from, ArgList); else if (!strcmp(comm, "PING")) p_ping(ArgList); /* Some kind of unrecognized/unsupported command */ else p_odd(from, comm, ArgList); from_server = -1; }
int run(void) { /* Just call our interface. */ p_ping(); return 0; }