summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJared Adams <jaxad0127@gmail.com>2009-10-25 19:36:15 -0600
committerJared Adams <jaxad0127@gmail.com>2009-10-25 19:36:15 -0600
commitdb43fb1b34028335e2cec64bf7e7b26761f2b37d (patch)
tree1ed16941b8cabb7fd93f59450cac460f454af2f0 /src
parentf35eb0f269b2e7a2cdbd8ab9e66422decbaeeaaa (diff)
downloadtmwa-db43fb1b34028335e2cec64bf7e7b26761f2b37d.tar.gz
tmwa-db43fb1b34028335e2cec64bf7e7b26761f2b37d.tar.bz2
tmwa-db43fb1b34028335e2cec64bf7e7b26761f2b37d.tar.xz
tmwa-db43fb1b34028335e2cec64bf7e7b26761f2b37d.zip
Prevent auto bans from multiplying
Diffstat (limited to 'src')
-rw-r--r--src/map/map.h4
-rw-r--r--src/map/pc.c2
-rw-r--r--src/map/tmw.c12
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);