X-Git-Url: http://git.pk910.de/?a=blobdiff_plain;f=src%2Fmodules%2FNeonSpam.mod%2Fcmd_neonspam_set.c;h=f97637626198604e551ef1e8fe842419e18ae2bf;hb=bc2ce8e4b8c64a6ea849cb78a8cf0d0e9e4da7a3;hp=efaee45660ee9b241c9dbea40c8aaf8e8b179fe2;hpb=706e48b1e666054030c491d864f740071e390038;p=NeonServV5.git diff --git a/src/modules/NeonSpam.mod/cmd_neonspam_set.c b/src/modules/NeonSpam.mod/cmd_neonspam_set.c index efaee45..f976376 100644 --- a/src/modules/NeonSpam.mod/cmd_neonspam_set.c +++ b/src/modules/NeonSpam.mod/cmd_neonspam_set.c @@ -1,4 +1,4 @@ -/* cmd_neonspam_set.c - NeonServ v5.3 +/* cmd_neonspam_set.c - NeonServ v5.6 * Copyright (C) 2011-2012 Philipp Kreil (pk910) * * This program is free software: you can redistribute it and/or modify @@ -17,21 +17,21 @@ #include "cmd_neonspam.h" -typedef char* neonspam_cmd_set_function(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setflags(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_set_reaction_time(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setpercent(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_set_spamlimit(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); -static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +typedef char* neonspam_cmd_set_function(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setflags(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_set_reaction_time(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setpercent(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_set_spamlimit(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); +static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf); static MYSQL_ROW neonspam_settings_row, neonspam_settings_defaults; -#define SPAMSERV_SETTINGS_QUERY "`channel_spam_reaction`, `channel_spam_reaction_duration`, `channel_flood_reaction`, `channel_flood_reaction_duration`, `channel_join_reaction`, `channel_join_reaction_duration`, `channel_botnet_bantime`, `channel_caps_reaction`, `channel_caps_reaction_duration`, `channel_digit_reaction`, `channel_digit_reaction_duration`" +#define SPAMSERV_SETTINGS_QUERY "`channel_spam_reaction`, `channel_spam_reaction_duration`, `channel_flood_reaction`, `channel_flood_reaction_duration`, `channel_join_reaction`, `channel_join_reaction_duration`, `channel_botnet_bantime`, `channel_caps_reaction`, `channel_caps_reaction_duration`, `channel_digit_reaction`, `channel_digit_reaction_duration`, `channel_badword_reaction`, `channel_badword_reaction_duration`" #define SPAMSERV_SETTINGS_RESET "\ `channel_scanner` = NULL, \ `channel_spam_limit` = NULL, \ @@ -57,7 +57,10 @@ static MYSQL_ROW neonspam_settings_row, neonspam_settings_defaults; `channel_digit_percent` = NULL, \ `channel_digit_reaction` = NULL, \ `channel_digit_reaction_duration` = NULL, \ -`channel_digit_except` = NULL " +`channel_digit_except` = NULL, \ +`channel_badword_reaction` = NULL, \ +`channel_badword_reaction_duration` = NULL, \ +`channel_badword_except` = NULL " #define SET_HELP 0x0001 #define SET_BOOL 0x0002 @@ -127,6 +130,13 @@ static const struct { {SPAMSETTINGS_DIGITSCAN, 2, "DigitScanVoiced", neonspam_cmd_setflags, SPAMSETTINGS_DIGITSCAN_VOICE, NULL, SET_BOOL | SET_SCANVOICE}, {SPAMSETTINGS_DIGITSCAN, 2, "DigitScanExcept", neonspam_cmd_setexcept, SPAMSETTINGS_DIGITEXCINDEX, "channel_digit_except", SET_HELP | SET_SCANEXCEPT}, + {0, 0, "BadwordScan", neonspam_cmd_setflags, SPAMSETTINGS_BADWORDSCAN, NULL, SET_BOOL}, + {SPAMSETTINGS_BADWORDSCAN | SPAMSETTINGS_SETTIMEBAN,2, "BadwordReaction", neonspam_cmd_set_reaction, 11, "channel_badword_reaction", SET_OPT | (3 << SET_OPT_SHIFT)}, + {SPAMSETTINGS_BADWORDSCAN | SPAMSETTINGS_ISTIMEBAN,4, "BadwordBanDuration",neonspam_cmd_set_reaction_time, 12, "channel_badword_reaction_duration", 0}, + {SPAMSETTINGS_BADWORDSCAN, 2, "BadwordScanChanOps",neonspam_cmd_setflags, SPAMSETTINGS_BADWORDSCAN_OPS, NULL, SET_BOOL | SET_SCANOPS}, + {SPAMSETTINGS_BADWORDSCAN, 2, "BadwordScanVoiced", neonspam_cmd_setflags, SPAMSETTINGS_BADWORDSCAN_VOICE, NULL, SET_BOOL | SET_SCANVOICE}, + {SPAMSETTINGS_BADWORDSCAN, 2, "BadwordScanExcept", neonspam_cmd_setexcept, SPAMSETTINGS_BADWORDEXCINDEX, "channel_badword_except", SET_HELP | SET_SCANEXCEPT}, + {0, 0, "GlobalScanChanOps", neonspam_cmd_setscanops, 0, NULL, SET_BOOL}, {0, 0, "GlobalScanVoice", neonspam_cmd_setscanvoice, 0, NULL, SET_BOOL}, {0, 0, "GlobalScanExcept", neonspam_cmd_setscanexcept, 0, NULL, SET_HELP}, @@ -145,7 +155,7 @@ CMD_BIND(neonspam_cmd_set) { if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_DEFAULTS_OWNER", chan->name); + reply(textclient, user, "NS_SET_DEFAULTS_OWNER", chan->name); return; } } @@ -159,10 +169,10 @@ CMD_BIND(neonspam_cmd_set) { sprintf(defaultskey, "%08x", seed); if(argc > 1 && !strcmp(argv[1], defaultskey)) { printf_mysql_query("UPDATE `channels` SET " SPAMSERV_SETTINGS_RESET " WHERE `channel_id` = '%d'", chan->channel_id); - reply(getTextBot(), user, "NS_SET_DEFAULTS_DONE", chan->name); + reply(textclient, user, "NS_SET_DEFAULTS_DONE", chan->name); logEvent(event); } else { - reply(getTextBot(), user, "NS_SET_DEFAULTS_CODE", chan->name, defaultskey); + reply(textclient, user, "NS_SET_DEFAULTS_CODE", chan->name, defaultskey); } } else if(argc && strcmp(argv[0], "help")) { //find the correct command @@ -177,7 +187,7 @@ CMD_BIND(neonspam_cmd_set) { char valueBuf[MAXLEN], nameBuf[MAXLEN]; char *value, *optimized_value, *option_help; neonspam_cmd_set_function *func = neonspam_settings[i].function; - value = func(client, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, args, valueBuf); + value = func(client, textclient, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, args, valueBuf); if(value) { optimized_value = value; if(neonspam_settings[i].flags & SET_BOOL) { @@ -191,13 +201,13 @@ CMD_BIND(neonspam_cmd_set) { option_help = get_language_string(user, nameBuf); } else option_help = NULL; - reply(getTextBot(), user, "\002%s\002 %s%s%s", neonspam_settings[i].setting, optimized_value, (option_help ? " - " : ""), (option_help ? option_help : "")); + reply(textclient, user, "\002%s\002 %s%s%s", neonspam_settings[i].setting, optimized_value, (option_help ? " - " : ""), (option_help ? option_help : "")); if(neonspam_settings[i].flags & SET_OPT) { int maxoption = (neonspam_settings[i].flags & SET_OPT_MAX) >> SET_OPT_SHIFT; for(j = 0; j < maxoption; j++) { sprintf(nameBuf, "SS_SET_OPTION_%s_%d", neonspam_settings[i].setting, j); - - reply(getTextBot(), user, " \002%d\002 - %s", j, option_help); + option_help = get_language_string(user, nameBuf); + reply(textclient, user, " \002%d\002 - %s", j, option_help); } } if((neonspam_settings[i].flags & SET_HELP) && argc && !strcmp(argv[0], "help")) { @@ -205,7 +215,7 @@ CMD_BIND(neonspam_cmd_set) { sprintf(nameBuf, "SS_SET_HELP_%s", neonspam_settings[i].setting); tmp = get_language_string(user, nameBuf); if(tmp) { - reply(getTextBot(), user, " %s", tmp); + reply(textclient, user, " %s", tmp); } } } @@ -216,7 +226,7 @@ CMD_BIND(neonspam_cmd_set) { } if(j == 0) { //unknown setting - reply(getTextBot(), user, "NS_SET_UNKNOWN_SETTING", argv[0]); + reply(textclient, user, "NS_SET_UNKNOWN_SETTING", argv[0]); } } else { char valueBuf[MAXLEN], nameBuf[MAXLEN]; @@ -237,14 +247,14 @@ CMD_BIND(neonspam_cmd_set) { res = mysql_use(); neonspam_settings_row = mysql_fetch_row(res); i = -1; - reply(getTextBot(), user, "NS_SET_HEADER", chan->name); + reply(textclient, user, "NS_SET_HEADER", chan->name); while(neonspam_settings[++i].setting) { if((chan->spam_settings->flags & (neonspam_settings[i].if_flag & SPAMSETTINGS_FLAGS)) != (neonspam_settings[i].if_flag & SPAMSETTINGS_FLAGS)) continue; if((neonspam_settings[i].if_flag & SPAMSETTINGS_ISTIMEBAN) && !boolflag) continue; neonspam_cmd_set_function *func = neonspam_settings[i].function; - value = func(client, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, NULL, valueBuf); + value = func(client, textclient, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, NULL, valueBuf); if(neonspam_settings[i].if_flag & SPAMSETTINGS_SETTIMEBAN) boolflag = !strcmp(value, "2"); //TODO: append option or help info @@ -282,13 +292,13 @@ CMD_BIND(neonspam_cmd_set) { } char **table_lines = table_end(table); for(i = 0; i < table->entrys; i++) { - reply(getTextBot(), user, table_lines[i]); + reply(textclient, user, table_lines[i]); } table_free(table); } } -static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf) { char *trigger; //get current trigger MYSQL_RES *res; @@ -303,7 +313,7 @@ static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct UserNo if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_TRIGGER_OWNER", chan->name); + reply(textclient, user, "NS_SET_TRIGGER_OWNER", chan->name); return NULL; } } @@ -317,7 +327,7 @@ static char* neonspam_cmd_set_trigger(struct ClientSocket *client, struct UserNo return trigger; } -static char* neonspam_cmd_setflags(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_setflags(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { char *value = ((chan->spam_settings->flags & flag) ? "1" : "0"); if(argument) { //binary argument... @@ -326,7 +336,7 @@ static char* neonspam_cmd_setflags(struct ClientSocket *client, struct UserNode } else if(!strcmp(argument, "1") || !stricmp(argument, "on") || !stricmp(argument, get_language_string(user, "NS_SET_ON"))) { chan->spam_settings->flags |= flag; } else { - reply(getTextBot(), user, "NS_SET_INVALID_BOOLEAN", argument); + reply(textclient, user, "NS_SET_INVALID_BOOLEAN", argument); return NULL; } char str_flags[50]; @@ -337,13 +347,13 @@ static char* neonspam_cmd_setflags(struct ClientSocket *client, struct UserNode return value; } -static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int exceptlvl_index, char *field, char *argument, char *retBuf) { +static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int exceptlvl_index, char *field, char *argument, char *retBuf) { unsigned int value = chan->spam_settings->exceptlevel[exceptlvl_index]; if(argument) { //numeric argument... (access) int caccess = atoi(argument); if(caccess < 0 || caccess > 501) { - reply(getTextBot(), user, "NS_INVALID_ACCESS", caccess); + reply(textclient, user, "NS_INVALID_ACCESS", caccess); return NULL; } int uaccess = getChannelAccess(user, chan); @@ -352,7 +362,7 @@ static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct UserNode if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_CANNOT_SET"); + reply(textclient, user, "NS_SET_CANNOT_SET"); return NULL; } } @@ -360,7 +370,7 @@ static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct UserNode if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_BADLEVEL"); + reply(textclient, user, "NS_SET_BADLEVEL"); return NULL; } } @@ -372,7 +382,7 @@ static char* neonspam_cmd_setexcept(struct ClientSocket *client, struct UserNode return retBuf; } -static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int mysqlindex, char *mysqlfield, char *argument, char *retBuf) { +static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int mysqlindex, char *mysqlfield, char *argument, char *retBuf) { if(argument) { /* valid options: * 0/kick - kick @@ -386,7 +396,7 @@ static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct UserN } else if(!strcmp(argument, "2") || !stricmp(argument, "ban")) { argument = "2"; } else { - reply(getTextBot(), user, "NS_SET_INVALID_OPTION_STR", argument); + reply(textclient, user, "NS_SET_INVALID_OPTION_STR", argument); return NULL; } printf_mysql_query("UPDATE `channels` SET `%s` = '%s' WHERE `channel_id` = '%d' ", mysqlfield, argument, chan->channel_id); @@ -405,15 +415,15 @@ static char* neonspam_cmd_set_reaction(struct ClientSocket *client, struct UserN } } -static char* neonspam_cmd_set_reaction_time(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int mysqlindex, char *mysqlfield, char *argument, char *retBuf) { +static char* neonspam_cmd_set_reaction_time(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int mysqlindex, char *mysqlfield, char *argument, char *retBuf) { int duration; if(argument) { duration = strToTime(user, argument); if(duration < 30) { - reply(getTextBot(), user, "NS_TIMEBAN_DURATION_TOO_SHORT", 30); + reply(textclient, user, "NS_TIMEBAN_DURATION_TOO_SHORT", 30); return NULL; } - printf_mysql_query("UPDATE `channels` SET `%s` = '%s' WHERE `channel_id` = '%d' ", mysqlfield, argument, chan->channel_id); + printf_mysql_query("UPDATE `channels` SET `%s` = '%d' WHERE `channel_id` = '%d' ", mysqlfield, duration, chan->channel_id); } else { if(neonspam_settings_row) { duration = atoi(neonspam_settings_row[mysqlindex] ? neonspam_settings_row[mysqlindex] : neonspam_settings_defaults[mysqlindex]); @@ -430,14 +440,14 @@ static char* neonspam_cmd_set_reaction_time(struct ClientSocket *client, struct return retBuf; } -static char* neonspam_cmd_setpercent(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int percent_index, char *mysqlfield, char *argument, char *retBuf) { +static char* neonspam_cmd_setpercent(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int percent_index, char *mysqlfield, char *argument, char *retBuf) { unsigned int value = chan->spam_settings->percent[percent_index]; if(argument) { //numeric argument... (access) value = atoi(argument); if(value < 0 || value > 100) { //invalid percent value - reply(getTextBot(), user, "SS_SET_PERCENT", value); + reply(textclient, user, "SS_SET_PERCENT", value); return NULL; } chan->spam_settings->percent[percent_index] = value; @@ -447,13 +457,13 @@ static char* neonspam_cmd_setpercent(struct ClientSocket *client, struct UserNod return retBuf; } -static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int sensibility_index, char *mysqlfield, char *argument, char *retBuf) { +static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int sensibility_index, char *mysqlfield, char *argument, char *retBuf) { if(argument) { //change value char *delimiter = strstr(argument, ":"); if(!delimiter) { //invalid format - reply(getTextBot(), user, "SS_SET_SENSIBILITY", argument); + reply(textclient, user, "SS_SET_SENSIBILITY", argument); return NULL; } *delimiter = '\0'; @@ -462,12 +472,12 @@ static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct Use int timep = atoi(delimiter); if(amount > MAX_FLOOD_AMOUNT || amount < MIN_FLOOD_AMOUNT) { //invalid amount - reply(getTextBot(), user, "SS_SET_SENSIBILITY_AMOUNT", amount, MIN_FLOOD_AMOUNT, MAX_FLOOD_AMOUNT); + reply(textclient, user, "SS_SET_SENSIBILITY_AMOUNT", amount, MIN_FLOOD_AMOUNT, MAX_FLOOD_AMOUNT); return NULL; } if(timep > MAX_FLOOD_TIME || timep < 0) { //invalid time period - reply(getTextBot(), user, "SS_SET_SENSIBILITY_TIME", timep, 0, MAX_FLOOD_TIME); + reply(textclient, user, "SS_SET_SENSIBILITY_TIME", timep, 0, MAX_FLOOD_TIME); return NULL; } char amountfield[50], timefield[50]; @@ -483,16 +493,16 @@ static char* neonspam_cmd_setsensibility(struct ClientSocket *client, struct Use return retBuf; } -static char* neonspam_cmd_set_spamlimit(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_set_spamlimit(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int intparam, char *charparam, char *argument, char *retBuf) { if(argument) { //change value int amount = atoi(argument); if(amount > 10 || amount < 2) { //invalid amount - reply(getTextBot(), user, "SS_SET_SPAMLIMIT", amount, 2, 10); + reply(textclient, user, "SS_SET_SPAMLIMIT", amount, 2, 10); return NULL; } - printf_mysql_query("UPDATE `channels` SET `channel_maxrepeat` = '%d' WHERE `channel_id` = '%d' ", amount, chan->channel_id); + printf_mysql_query("UPDATE `channels` SET `channel_spam_limit` = '%d' WHERE `channel_id` = '%d' ", amount, chan->channel_id); sprintf(retBuf, "%d", amount); chan->spam_settings->spam_amount = amount; } else @@ -500,7 +510,7 @@ static char* neonspam_cmd_set_spamlimit(struct ClientSocket *client, struct User return retBuf; } -static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { int i = 0; int value = -1; int identical = 1; @@ -524,7 +534,7 @@ static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct UserNod } else if(!strcmp(argument, "1") || !stricmp(argument, "on") || !stricmp(argument, get_language_string(user, "NS_SET_ON"))) { value = 1; } else { - reply(getTextBot(), user, "NS_SET_INVALID_BOOLEAN", argument); + reply(textclient, user, "NS_SET_INVALID_BOOLEAN", argument); return NULL; } i = 0; @@ -532,7 +542,7 @@ static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct UserNod while(neonspam_settings[i].setting) { if(neonspam_settings[i].flags & SET_SCANOPS) { neonspam_cmd_set_function *func = neonspam_settings[i].function; - func(client, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, (value ? "1" : "0"), valueBuf); + func(client, textclient, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, (value ? "1" : "0"), valueBuf); } i++; } @@ -545,7 +555,7 @@ static char* neonspam_cmd_setscanops(struct ClientSocket *client, struct UserNod return "?"; } -static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { int i = 0; int value = -1; int identical = 1; @@ -569,7 +579,7 @@ static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct UserN } else if(!strcmp(argument, "1") || !stricmp(argument, "on") || !stricmp(argument, get_language_string(user, "NS_SET_ON"))) { value = 1; } else { - reply(getTextBot(), user, "NS_SET_INVALID_BOOLEAN", argument); + reply(textclient, user, "NS_SET_INVALID_BOOLEAN", argument); return NULL; } i = 0; @@ -577,7 +587,7 @@ static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct UserN while(neonspam_settings[i].setting) { if(neonspam_settings[i].flags & SET_SCANVOICE) { neonspam_cmd_set_function *func = neonspam_settings[i].function; - func(client, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, (value ? "1" : "0"), valueBuf); + func(client, textclient, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, (value ? "1" : "0"), valueBuf); } i++; } @@ -590,7 +600,7 @@ static char* neonspam_cmd_setscanvoice(struct ClientSocket *client, struct UserN return "?"; } -static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { +static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan, struct Event *event, int flag, char *charparam, char *argument, char *retBuf) { int i = 0; int value = -1; int identical = 1; @@ -611,7 +621,7 @@ static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct User //numeric argument... (access) int caccess = atoi(argument); if(caccess < 0 || caccess > 501) { - reply(getTextBot(), user, "NS_INVALID_ACCESS", caccess); + reply(textclient, user, "NS_INVALID_ACCESS", caccess); return NULL; } int uaccess = getChannelAccess(user, chan); @@ -620,7 +630,7 @@ static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct User if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_CANNOT_SET"); + reply(textclient, user, "NS_SET_CANNOT_SET"); return NULL; } } @@ -628,7 +638,7 @@ static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct User if(isGodMode(user)) { event->flags |= CMDFLAG_OPLOG; } else { - reply(getTextBot(), user, "NS_SET_BADLEVEL"); + reply(textclient, user, "NS_SET_BADLEVEL"); return NULL; } } @@ -638,7 +648,7 @@ static char* neonspam_cmd_setscanexcept(struct ClientSocket *client, struct User while(neonspam_settings[i].setting) { if(neonspam_settings[i].flags & SET_SCANEXCEPT) { neonspam_cmd_set_function *func = neonspam_settings[i].function; - func(client, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, retBuf, valueBuf); + func(client, textclient, user, chan, event, neonspam_settings[i].intparam, neonspam_settings[i].charparam, retBuf, valueBuf); } i++; }