Variable cleanup for flood_*

This commit is contained in:
Berke Viktor 2012-10-22 12:20:47 +02:00
parent b563b93414
commit 87e903cd73
3 changed files with 16 additions and 18 deletions

View File

@ -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;

View File

@ -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"),

View File

@ -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;