Esempio n. 1
0
File: bot.c Progetto: ct187/irc-bot
static void process_message(struct irc_message *msg)
{
	if (!joined && !strcmp("MODE", msg->command)) {
		send_join();
		return;
	} else if (!sent_nick && !strcmp("NOTICE", msg->command)) {
		send_nick();
		return;
	} else if (!strcmp("PING", msg->command)) {
		send_ping(msg->params);
		return;
	} else if (strcmp("PRIVMSG", msg->command)) {
		return;
	}

	process_priv_message(msg);
}
Esempio n. 2
0
static void do_jupe(User * u)
{
	char buf[NICKMAX + 16];
	char *jserver, *reason;

	jserver = strtok(NULL, " ");
	reason = strtok(NULL, "");

	if (!jserver) {
		syntax_error(s_OperServ, u, "JUPE", OPER_JUPE_SYNTAX);
	} else if (strchr(jserver, '.')) {
		/* Juping a server, squit the target first. */
		send_cmd(NULL,
		    ":OperServ SQUIT %s :Server jupitered by %s (%s)",
		    jserver, u->nick, reason ? reason : u->nick);

		/* I can't get it to work without this sleep here :/ */
		sleep(1);
		wallops(s_OperServ,
		    "\2Juping\2 %s by request of \2%s\2 (%s).", jserver,
		    u->nick, reason ? reason : u->nick);

		if (!reason) {
			snprintf(buf, sizeof(buf), "Jupitered by %s",
			    u->nick);
			reason = buf;
		}

		send_cmd(NULL, "SERVER %s 2 :%s", jserver, reason);
	} else {
		/* Juping a nick. */
		wallops(s_OperServ,
		    "\2Juping\2 %s by request of \2%s\2 (%s).", jserver,
		    u->nick, reason ? reason : u->nick);
		send_cmd(NULL, "KILL %s :Juped by %s: %s", jserver, u->nick,
		    reason ? reason : u->nick);
		snprintf(buf, sizeof(buf), "Juped (%s)",
		    reason ? reason : u->nick);
		send_nick(jserver, ServiceUser, ServiceHost, ServerName,
		    buf);
	}
}