+ else
+ reply("CSMSG_PING_RESPONSE");
+ return 1;
+}
+
+static CHANSERV_FUNC(cmd_wut)
+{
+ if(channel)
+ {
+ char response[MAXLEN];
+ const char *fmt = user_find_message(user, "CSMSG_WUT_RESPONSE");
+ sprintf(response, "\ 2%s\ 2: %s", user->nick, fmt);
+ irc_privmsg(cmd->parent->bot, channel->name, response);
+ }
+ else
+ reply("CSMSG_WUT_RESPONSE");
+ return 1;
+}
+
+static CHANSERV_FUNC(cmd_roulette)
+{
+ if(channel)
+ {
+ struct chanData *cData = channel->channel_info;
+
+ if (cData)
+ {
+ if (cData->roulette_chamber)
+ {
+ DelUser(user, chanserv, 1, "BANG - Don't stuff bullets into a loaded gun");
+ return 1;
+ }
+
+ send_target_message(1, channel->name, cmd->parent->bot, "CSMSG_ROULETTE_LOADS");
+ cData->roulette_chamber = 1 + rand() % 6;
+ }
+ }
+
+ return 1;
+}
+static CHANSERV_FUNC(cmd_shoot)
+{
+ if(channel)
+ {
+ struct chanData *cData = channel->channel_info;
+
+ if (cData->roulette_chamber <= 0)
+ {
+ struct service *service;
+ if ((service = service_find(chanserv->nick)))
+ {
+ reply("CSMSG_ROULETTE_NEW", service->trigger);
+ }
+ return 1;
+ }
+
+ cData->roulette_chamber--;
+
+ if (cData->roulette_chamber == 0)
+ {
+ reply("CSMSG_ROULETTE_BANG");
+ reply("CSMSG_ROULETTE_BETTER_LUCK", user->nick);
+ DelUser(user, chanserv, 1, "BANG!!!!");
+ }
+ else
+ reply("CSMSG_ROULETTE_CLICK");
+ }
+
+ return 1;
+}
+
+static void
+chanserv_remove_abuse(void *data)
+{
+ char *remnick = data;
+ struct userNode *user;
+ /* sometimes the clone was killed and maybe even the user took their nick back
+ * (ie, an oper) so dont kill them here after all unless they are local. */
+ if( (user = GetUserH(remnick)) )
+ if(IsLocal(user) )
+ DelUser(user, NULL, 1, "");
+}
+
+int lamepart(struct userNode *nick) {
+ struct modeNode *mn;
+ unsigned int count, n;
+
+ for (n=count=0; n<nick->channels.used; n++)
+ {
+ mn = nick->channels.list[n];
+ irc_svspart(chanserv, nick, mn->channel);
+ }
+
+ return 0;
+}
+
+static CHANSERV_FUNC(cmd_spin)
+{
+ if(!channel)
+ return 1;
+
+ int type = 0, lamep = 1;
+ char *tstr;
+
+ tstr = conf_get_data("server/type", RECDB_QSTRING);
+ if(tstr) {
+ type = atoi(tstr);
+ if (type > 6)
+ lamep = 0;
+ }
+
+
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_WHEEL1", user->nick);
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_WHEEL2");
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_WHEEL3");
+
+ if(chanserv_conf.wheel->used < 1)
+ {
+ /* wheel actions not defined! eek */
+ return 1;
+ }
+
+ const char *wheel = chanserv_conf.wheel->list[ (int) ( (chanserv_conf.wheel->used) * (rand() / (RAND_MAX + 1.0)) ) ];
+ if(!wheel && *wheel)
+ return 1;
+
+ /* connection reset by peer */
+ if (!strcasecmp(wheel, "peer"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_PEER");
+ if (type < 7)
+ irc_kill(chanserv, user, "Connection reset by peer");
+ else
+ irc_svsquit(chanserv, user, "Connection reset by peer");
+ }
+ /* part all channels */
+ else if (!strcasecmp(wheel, "partall"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_PARTALL");
+ if (lamep)
+ lamepart(user);
+ else
+ sputsock("%s SJ %s 0 "FMT_TIME_T, self->numeric, user->numeric, now);
+ }
+ /* random time gline */
+ else if (!strcasecmp(wheel, "gline"))
+ {
+ char target[HOSTLEN + 3];
+ int wtime = 120 + rand() % 600;
+
+ strcpy(target, "*@");
+ strcat(target, user->hostname);
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_GLINE");
+
+ gline_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, 1, 0);
+ }
+ /* random shun */
+ else if (!strcasecmp(wheel, "shun"))
+ {
+ char target[HOSTLEN + 3];
+ int wtime = 120 + rand() % 600;
+
+ strcpy(target, "*@");
+ strcat(target, user->hostname);
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_SHUN");
+
+ shun_add(chanserv->nick, target, wtime, "Reward for spinning the wheel of misfortune!", now, 1);
+ }
+ /* absolutely nothing */
+ else if (!strcasecmp(wheel, "nothing"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_NOTHING");
+ }
+ /* join random chans and part em several times */
+ else if (!strcasecmp(wheel, "randjoin"))
+ {
+ int complete = 0;
+ int rndchans = 0;
+ int chango = 0;
+ int roundz0r = 0;
+
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_RANDJOIN");
+ while(complete != 1)
+ {
+ if (rndchans != 15)
+ {
+ chango = 120 + rand() % 600;
+ sputsock("%s SJ %s #%d "FMT_TIME_T, self->numeric, user->numeric, chango, now);
+ rndchans++;
+ }
+ else
+ {
+ if (roundz0r != 1)
+ {
+ if (lamep)
+ lamepart(user);
+ else
+ sputsock("%s SJ %s 0 "FMT_TIME_T, self->numeric, user->numeric, now);
+ roundz0r = 1;
+ rndchans = 0;
+ }
+ else
+ {
+ if (lamep)
+ lamepart(user);
+ else
+ sputsock("%s SJ %s 0 "FMT_TIME_T, self->numeric, user->numeric, now);
+ complete = 1;
+ }
+ }
+ }
+ }
+ /* abuse line added to /whois */
+ else if (!strcasecmp(wheel, "abusewhois"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_ABUSEWHOIS");
+ irc_swhois(chanserv, user, "is being defecated on by services");
+ }
+ /* kick from each channel your in */
+ else if (!strcasecmp(wheel, "kickall"))
+ {
+ unsigned int count, n;
+ struct modeNode *mn;
+
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_KICKALL");
+
+ for (n=count=0; n<user->channels.used; n++) {
+ mn = user->channels.list[n];
+ irc_kick(chanserv, user, mn->channel, "Reward for spinning the wheel of misfortune!");
+ }
+ }
+ /* random nick change */
+ else if (!strcasecmp(wheel, "nickchange"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_NICKCHANGE");
+
+ char *oldnick = NULL;
+ char *oldident = NULL;
+ char abusednick[NICKLEN] = "";
+ int abusednum = 1 + (int) (10000.0 * (rand() / (RAND_MAX + 1.0)));
+ struct userNode *clone;
+
+ oldnick = strdup(user->nick);
+ oldident = strdup(user->ident);
+
+ //snprintf(abusednick, NICKLEN, "Abused%d", abusednum+(1 + rand() % 120));
+ while (1)
+ {
+ snprintf(abusednick, NICKLEN, "Abused%d", abusednum+(1 + rand() % 120));
+ log_module(MAIN_LOG, LOG_DEBUG, "Abused Nick: %s, Client Nick: %s", abusednick, user->nick);
+ if(!GetUserH(abusednick))
+ break;
+ }
+
+ SVSNickChange(user, abusednick);
+ irc_svsnick(chanserv, user, abusednick);
+ clone = AddLocalUser(oldnick, oldident, "abused.by.wheel.of.misfortune", "I got abused by the wheel of misfortune :D", "+i");
+ timeq_add(now + 300, chanserv_remove_abuse, clone->nick);
+ }
+ /* kill */
+ else if (!strcasecmp(wheel, "kill"))
+ {
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_KILL");
+
+ DelUser(user, chanserv, 1, "Reward for spinning the wheel of misfortune!");
+ //irc_kill(chanserv, user, "Reward for spinning the wheel of misfortune!");
+ }
+ /* service ignore */
+ else if (!strcasecmp(wheel, "svsignore"))
+ {
+ //int gagged;
+ int ignoretime = 0;
+ char target[HOSTLEN + 13];
+
+ if(IsOper(user)) {
+ /* we cant gag opers, so just verbally abuse them */
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_SVSIGNORE_OPER");
+ return 1;
+ }
+ send_target_message(1, channel->name, chanserv, "CSMSG_SPIN_SVSIGNORE");
+
+ strcpy(target, "*!*@");
+ strcat(target, user->hostname);
+ ignoretime = now + (1 + rand() % 120);
+
+ gag_create(target, "wheelofabuse", "Reward for spinning the wheel of misfortune!", ignoretime);
+ }
+ /* kick and ban from each channel your in */
+ else if (!strcasecmp(wheel, "kickbanall"))
+ {
+ unsigned int count, n;
+ struct modeNode *mn;
+ //char ban[HOSTLEN + 1];