From db43fb1b34028335e2cec64bf7e7b26761f2b37d Mon Sep 17 00:00:00 2001 From: Jared Adams Date: Sun, 25 Oct 2009 19:36:15 -0600 Subject: Prevent auto bans from multiplying --- src/map/map.h | 4 ++++ src/map/pc.c | 2 ++ src/map/tmw.c | 12 +++++++++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/map/map.h b/src/map/map.h index 9a6b3ef..c0a9772 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -358,6 +358,10 @@ struct map_session_data { int ignoreAll; short sg_count; + struct { + unsigned in_progress : 1; + } auto_ban_info; + time_t chat_reset_due; time_t chat_repeat_reset_due; int chat_lines_in; diff --git a/src/map/pc.c b/src/map/pc.c index 0b251cc..75ae42c 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -841,6 +841,8 @@ int pc_authok(int id, int login_id2, time_t connect_until_time, short tmw_versio } } + sd->auto_ban_info.in_progress = 0; + // Initialize antispam vars sd->chat_reset_due = sd->chat_lines_in = sd->chat_total_repeats = sd->chat_repeat_reset_due = 0; sd->chat_lastmsg[0] = '\0'; diff --git a/src/map/tmw.c b/src/map/tmw.c index 25aa55b..a19eb26 100644 --- a/src/map/tmw.c +++ b/src/map/tmw.c @@ -68,10 +68,12 @@ int tmw_CheckChatSpam(struct map_session_data *sd, char* message) { if (sd->chat_lines_in >= battle_config.chat_spam_flood || sd->chat_total_repeats >= battle_config.chat_spam_flood) { sd->chat_lines_in = sd->chat_total_repeats = 0; - if (battle_config.chat_spam_ban > 0) { + if (battle_config.chat_spam_ban > 0 && !sd->auto_ban_info.in_progress) { tmw_GmHackMsg("%s has been autobanned for chat spam", sd->status.name); gm_log("server(0,0) Server : @autoban %s %dh (chat spam)", sd->status.name, battle_config.chat_spam_ban); + sd->auto_ban_info.in_progress = 1; + clif_displaymessage(sd->fd, "You have been banned for spamming. Please do not spam."); chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, battle_config.chat_spam_ban, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second) clif_setwaitclose(sd->fd); @@ -146,10 +148,12 @@ int tmw_CheckTradeSpam(struct map_session_data *sd) { if (sd->trades_in >= battle_config.trade_spam_flood) { sd->trades_in = 0; - if (battle_config.trade_spam_ban > 0) { + if (battle_config.trade_spam_ban > 0 && !sd->auto_ban_info.in_progress) { tmw_GmHackMsg("%s has been autobanned for trade spam", sd->status.name); gm_log("server(0,0) Server : @autoban %s %dh (trade spam)", sd->status.name, battle_config.trade_spam_ban); + sd->auto_ban_info.in_progress = 1; + clif_displaymessage(sd->fd, "You have been banned for trade spamming. Please do not trade spam."); chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, battle_config.trade_spam_ban, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second) clif_setwaitclose(sd->fd); @@ -181,10 +185,12 @@ int tmw_CheckSitSpam(struct map_session_data *sd) { if (sd->sits_in >= battle_config.sit_spam_flood) { sd->sits_in = 0; - if (battle_config.sit_spam_ban > 0) { + if (battle_config.sit_spam_ban > 0 && !sd->auto_ban_info.in_progress) { tmw_GmHackMsg("%s has been autobanned for sit spam", sd->status.name); gm_log("server(0,0) Server : @autoban %s %dh (sit spam)", sd->status.name, battle_config.sit_spam_ban); + sd->auto_ban_info.in_progress = 1; + clif_displaymessage(sd->fd, "You have been banned for sit spamming. Please do not sit spam."); chrif_char_ask_name(-1, sd->status.name, 2, 0, 0, 0, battle_config.sit_spam_ban, 0, 0); // type: 2 - ban (year, month, day, hour, minute, second) clif_setwaitclose(sd->fd); -- cgit v1.2.3-70-g09d2