From 87e903cd739ae68aaadd086ebb2b831680e882cb Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Mon, 22 Oct 2012 12:20:47 +0200 Subject: [PATCH] Variable cleanup for flood_* --- src/common/cfgfiles.c | 16 ++++++++-------- src/common/ignore.c | 8 ++++---- src/common/xchat.h | 10 ++++------ 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/common/cfgfiles.c b/src/common/cfgfiles.c index 974f721a..5c8a144d 100644 --- a/src/common/cfgfiles.c +++ b/src/common/cfgfiles.c @@ -430,10 +430,10 @@ const struct prefs vars[] = {"dnsprogram", P_OFFSET (hex_dnsprogram), TYPE_STR}, - {"flood_ctcp_num", P_OFFINT (ctcp_number_limit), TYPE_INT}, - {"flood_ctcp_time", P_OFFINT (ctcp_time_limit), TYPE_INT}, - {"flood_msg_num", P_OFFINT (msg_number_limit), TYPE_INT}, - {"flood_msg_time", P_OFFINT (msg_time_limit), TYPE_INT}, + {"flood_ctcp_num", P_OFFINT (hex_flood_ctcp_num), TYPE_INT}, + {"flood_ctcp_time", P_OFFINT (hex_flood_ctcp_time), TYPE_INT}, + {"flood_msg_num", P_OFFINT (hex_flood_msg_time), TYPE_INT}, + {"flood_msg_time", P_OFFINT (hex_flood_msg_time), TYPE_INT}, {"gui_auto_open_chat", P_OFFINT (autoopendccchatwindow), TYPE_BOOL}, {"gui_auto_open_dialog", P_OFFINT (autodialog), TYPE_BOOL}, @@ -713,10 +713,10 @@ load_config (void) prefs.show_separator = 1; prefs.hex_dcc_blocksize = 1024; prefs.throttle = 1; - /*FIXME*/ prefs.msg_time_limit = 30; - prefs.msg_number_limit = 5; - prefs.ctcp_time_limit = 30; - prefs.ctcp_number_limit = 5; + /*FIXME*/ prefs.hex_flood_msg_time = 30; + prefs.hex_flood_msg_time = 5; + prefs.hex_flood_ctcp_time = 30; + prefs.hex_flood_ctcp_num = 5; prefs.topicbar = 1; prefs.lagometer = 1; prefs.throttlemeter = 1; diff --git a/src/common/ignore.c b/src/common/ignore.c index cd0305e5..93ca5a76 100644 --- a/src/common/ignore.c +++ b/src/common/ignore.c @@ -364,10 +364,10 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct serv->ctcp_counter++; } else { - if (difftime (current_time, serv->ctcp_last_time) < prefs.ctcp_time_limit) /*if we got the ctcp in the seconds limit */ + if (difftime (current_time, serv->ctcp_last_time) < prefs.hex_flood_ctcp_time) /*if we got the ctcp in the seconds limit */ { serv->ctcp_counter++; - if (serv->ctcp_counter == prefs.ctcp_number_limit) /*if we reached the maximun numbers of ctcp in the seconds limits */ + if (serv->ctcp_counter == prefs.hex_flood_ctcp_num) /*if we reached the maximun numbers of ctcp in the seconds limits */ { serv->ctcp_last_time = current_time; /*we got the flood, restore all the vars for next one */ serv->ctcp_counter = 0; @@ -398,10 +398,10 @@ flood_check (char *nick, char *ip, server *serv, session *sess, int what) /*0=ct } else { if (difftime (current_time, serv->msg_last_time) < - prefs.msg_time_limit) + prefs.hex_flood_msg_time) { serv->msg_counter++; - if (serv->msg_counter == prefs.msg_number_limit) /*if we reached the maximun numbers of ctcp in the seconds limits */ + if (serv->msg_counter == prefs.hex_flood_msg_time) /*if we reached the maximun numbers of ctcp in the seconds limits */ { snprintf (buf, sizeof (buf), _("You are being MSG flooded from %s, setting gui_auto_open_dialog OFF.\n"), diff --git a/src/common/xchat.h b/src/common/xchat.h index 85a57e33..f4f5e075 100644 --- a/src/common/xchat.h +++ b/src/common/xchat.h @@ -128,6 +128,10 @@ struct hexchatprefs int hex_dcc_port_last; int hex_dcc_stall_timeout; int hex_dcc_timeout; + int hex_flood_ctcp_num; /*flood */ + int hex_flood_ctcp_time; /*seconds of floods */ + int hex_flood_msg_num; /*same deal */ + int hex_flood_msg_time; unsigned int hex_away_auto_unmark; unsigned int hex_away_omit_alerts; @@ -316,12 +320,6 @@ struct hexchatprefs unsigned int identd; unsigned int gui_one_instance; - unsigned int ctcp_number_limit; /*flood */ - unsigned int ctcp_time_limit; /*seconds of floods */ - - unsigned int msg_number_limit; /*same deal */ - unsigned int msg_time_limit; - unsigned int url_grabber; unsigned int url_grabber_limit; unsigned int url_logging;