static void os_cmd_inject(sourceinfo_t *si, int parc, char *parv[]) { char *inject; static bool injecting = false; inject = parv[0]; if (!config_options.raw) return; if (!inject) { command_fail(si, fault_needmoreparams, STR_INSUFFICIENT_PARAMS, "INJECT"); command_fail(si, fault_needmoreparams, _("Syntax: INJECT <parameters>")); return; } logcommand(si, CMDLOG_ADMIN, "INJECT: \2%s\2", inject); /* looks like someone INJECT'd an INJECT command. * this is probably a bad thing. */ if (injecting) { command_fail(si, fault_noprivs, _("You cannot inject an INJECT command.")); return; } injecting = true; irc_parse(inject); injecting = false; }
static void irc_main(void) { if (uip_aborted() || uip_timedout()) { IRCDEBUG ("connection aborted\n"); irc_conn = NULL; } if (uip_closed()) { IRCDEBUG ("connection closed\n"); irc_conn = NULL; } if (uip_connected()) { IRCDEBUG ("new connection\n"); STATE->stage = IRC_SEND_USERNICK; STATE->sent = IRC_SEND_INIT; #ifdef ECMD_IRC_SUPPORT STATE->reparse = 0; #endif *STATE->outbuf = 0; } if (STATE->stage == IRC_SEND_JOIN && uip_acked ()) STATE->stage ++; else if (STATE->stage == IRC_CONNECTED && uip_acked ()) { *STATE->outbuf = 0; #ifdef ECMD_IRC_SUPPORT if (STATE->reparse) irc_handle_ecmd (); #endif } else if (uip_newdata() && uip_len) { ((char *) uip_appdata)[uip_len] = 0; IRCDEBUG ("received data: %s\n", uip_appdata); if (irc_parse ()) { uip_close (); /* Parse error */ return; } } if (uip_rexmit ()) irc_send_data (STATE->sent); else if ((STATE->stage > STATE->sent || STATE->stage == IRC_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) irc_send_data (STATE->stage); else if (STATE->stage == IRC_CONNECTED && uip_poll() && *STATE->outbuf) irc_send_data (STATE->stage); }