Pace aways.
This becomes important because of away-notify sending aways to common channels much like nick changes (which are also paced). Marking as unaway is not limited (but obviously only does something if the user was away before). To allow users to fix typos in away messages, two aways are allowed in sequence if away has not been used recently.
This commit is contained in:
parent
29d224a1f8
commit
d42e6915cf
8 changed files with 32 additions and 2 deletions
|
@ -515,6 +515,7 @@ general {
|
||||||
throttle_duration = 60;
|
throttle_duration = 60;
|
||||||
throttle_count = 4;
|
throttle_count = 4;
|
||||||
max_ratelimit_tokens = 30;
|
max_ratelimit_tokens = 30;
|
||||||
|
away_interval = 30;
|
||||||
};
|
};
|
||||||
|
|
||||||
modules {
|
modules {
|
||||||
|
|
|
@ -1271,6 +1271,12 @@ general {
|
||||||
* you're doing.
|
* you're doing.
|
||||||
*/
|
*/
|
||||||
max_ratelimit_tokens = 30;
|
max_ratelimit_tokens = 30;
|
||||||
|
|
||||||
|
/* away_interval: the minimum interval between AWAY commands. One
|
||||||
|
* additional AWAY command is allowed, and only marking as away
|
||||||
|
* counts.
|
||||||
|
*/
|
||||||
|
away_interval = 30;
|
||||||
};
|
};
|
||||||
|
|
||||||
modules {
|
modules {
|
||||||
|
|
|
@ -237,7 +237,7 @@ struct LocalUser
|
||||||
|
|
||||||
struct DNSQuery *dnsquery; /* for outgoing server's name lookup */
|
struct DNSQuery *dnsquery; /* for outgoing server's name lookup */
|
||||||
|
|
||||||
time_t last_away; /* Away since... */
|
time_t next_away; /* Don't allow next away before... */
|
||||||
time_t last;
|
time_t last;
|
||||||
|
|
||||||
/* clients allowed to talk through +g */
|
/* clients allowed to talk through +g */
|
||||||
|
|
|
@ -225,6 +225,7 @@ struct config_file_entry
|
||||||
int operspy_dont_care_user_info;
|
int operspy_dont_care_user_info;
|
||||||
int use_propagated_bans;
|
int use_propagated_bans;
|
||||||
int max_ratelimit_tokens;
|
int max_ratelimit_tokens;
|
||||||
|
int away_interval;
|
||||||
|
|
||||||
int client_flood_max_lines;
|
int client_flood_max_lines;
|
||||||
int client_flood_burst_rate;
|
int client_flood_burst_rate;
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
#include "s_serv.h"
|
#include "s_serv.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
|
|
||||||
|
|
||||||
static int m_away(struct Client *, struct Client *, int, const char **);
|
static int m_away(struct Client *, struct Client *, int, const char **);
|
||||||
|
|
||||||
struct Message away_msgtab = {
|
struct Message away_msgtab = {
|
||||||
|
@ -93,6 +92,21 @@ m_away(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Rate limit this because it is sent to common channels. */
|
||||||
|
if(!IsOper(source_p) &&
|
||||||
|
source_p->localClient->next_away > rb_current_time())
|
||||||
|
{
|
||||||
|
sendto_one(source_p, form_str(RPL_LOAD2HI),
|
||||||
|
me.name, source_p->name, "AWAY");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(source_p->localClient->next_away < rb_current_time() -
|
||||||
|
ConfigFileEntry.away_interval)
|
||||||
|
source_p->localClient->next_away = rb_current_time();
|
||||||
|
else
|
||||||
|
source_p->localClient->next_away = rb_current_time() +
|
||||||
|
ConfigFileEntry.away_interval;
|
||||||
|
|
||||||
if(source_p->user->away == NULL)
|
if(source_p->user->away == NULL)
|
||||||
allocate_away(source_p);
|
allocate_away(source_p);
|
||||||
if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1))
|
if(strncmp(source_p->user->away, parv[1], AWAYLEN - 1))
|
||||||
|
|
|
@ -524,6 +524,12 @@ static struct InfoStruct info_table[] = {
|
||||||
&ConfigFileEntry.max_ratelimit_tokens,
|
&ConfigFileEntry.max_ratelimit_tokens,
|
||||||
"The maximum number of tokens that can be accumulated for executing rate-limited commands",
|
"The maximum number of tokens that can be accumulated for executing rate-limited commands",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"away_interval",
|
||||||
|
OUTPUT_DECIMAL,
|
||||||
|
&ConfigFileEntry.away_interval,
|
||||||
|
"The minimum time between aways",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"default_split_server_count",
|
"default_split_server_count",
|
||||||
OUTPUT_DECIMAL,
|
OUTPUT_DECIMAL,
|
||||||
|
|
|
@ -2278,6 +2278,7 @@ static struct ConfEntry conf_general_table[] =
|
||||||
{ "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num },
|
{ "client_flood_message_num", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_num },
|
||||||
{ "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time },
|
{ "client_flood_message_time", CF_INT, NULL, 0, &ConfigFileEntry.client_flood_message_time },
|
||||||
{ "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens },
|
{ "max_ratelimit_tokens", CF_INT, NULL, 0, &ConfigFileEntry.max_ratelimit_tokens },
|
||||||
|
{ "away_interval", CF_INT, NULL, 0, &ConfigFileEntry.away_interval },
|
||||||
{ "\0", 0, NULL, 0, NULL }
|
{ "\0", 0, NULL, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -746,6 +746,7 @@ set_default_conf(void)
|
||||||
ConfigFileEntry.operspy_dont_care_user_info = NO;
|
ConfigFileEntry.operspy_dont_care_user_info = NO;
|
||||||
ConfigFileEntry.use_propagated_bans = YES;
|
ConfigFileEntry.use_propagated_bans = YES;
|
||||||
ConfigFileEntry.max_ratelimit_tokens = 30;
|
ConfigFileEntry.max_ratelimit_tokens = 30;
|
||||||
|
ConfigFileEntry.away_interval = 30;
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
ConfigFileEntry.compression_level = 4;
|
ConfigFileEntry.compression_level = 4;
|
||||||
|
|
Loading…
Reference in a new issue