diff --git a/Changes b/Changes index d7dc1090a..264bbbebc 100644 --- a/Changes +++ b/Changes @@ -2390,3 +2390,5 @@ seen. gmtime warning still there - Fixed a bug in +f + modes-on-join + 't' subfloodtype, reported by Rocko (#0001228). - Fixed a crashbug with +f and services, reported by Rocko (#0001227). - And another +f + modes-on-join one... +- Made anti away flood system work just like anti nick flood (#0001205). + NO_FLOOD_AWAY is now enabled and away-flood is set to 4 per 120s by default. diff --git a/include/config.h b/include/config.h index 3271b7481..9898cc098 100644 --- a/include/config.h +++ b/include/config.h @@ -351,7 +351,7 @@ * NO_FLOOD_AWAY - enables limiting of how frequently a client can set /away */ -#undef NO_FLOOD_AWAY +#define NO_FLOOD_AWAY /* * Define your network service names here. diff --git a/src/modules/m_away.c b/src/modules/m_away.c index cca54d895..e6b954b00 100644 --- a/src/modules/m_away.c +++ b/src/modules/m_away.c @@ -138,23 +138,20 @@ int m_away(aClient *cptr, aClient *sptr, int parc, char *parv[]) { } #ifdef NO_FLOOD_AWAY - if (MyClient(sptr) && AWAY_PERIOD) + if (MyClient(sptr) && AWAY_PERIOD && !IsAnOper(sptr)) { if ((sptr->user->flood.away_t + AWAY_PERIOD) <= timeofday) - sptr->user->flood.away_c = 0; - - if (!IsAnOper(sptr)) { + sptr->user->flood.away_c = 0; sptr->user->flood.away_t = timeofday; - if (sptr->user->flood.away_c < AWAY_COUNT) - sptr->user->flood.away_c++; - if (sptr->user->flood.away_c >= AWAY_COUNT) - { - sendto_one(sptr, err_str(ERR_TOOMANYAWAY), me.name, parv[0]); - return 0; - } } - + if (sptr->user->flood.away_c <= AWAY_COUNT) + sptr->user->flood.away_c++; + if (sptr->user->flood.away_c > AWAY_COUNT) + { + sendto_one(sptr, err_str(ERR_TOOMANYAWAY), me.name, parv[0]); + return 0; + } } #endif /* Marking as away */ diff --git a/src/s_conf.c b/src/s_conf.c index eb36b56a8..21b5c4493 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1305,7 +1305,10 @@ void config_setdefaultsettings(aConfiguration *i) i->oper_snomask = strdup(SNO_DEFOPER); i->ident_read_timeout = 30; i->ident_connect_timeout = 10; - i->nick_count = 3; i->nick_period = 60; /* nickflood protection: 3 per 60s */ + i->nick_count = 3; i->nick_period = 60; /* nickflood protection: max 3 per 60s */ +#ifdef NO_FLOOD_AWAY + i->away_count = 4; i->away_period = 120; /* awayflood protection: max 4 per 120s */ +#endif } int init_conf(char *rootconf, int rehash)