Tweak auto-accept:

* does not apply to NOTICE (as those may well be automated)
* mirrors +g behaviour so that no useless accept entries are added for services
* respects max_accept, if it would be exceeded the message is dropped with numeric 494
* check moved up so this is checked before floodcount/tgchange

Pulled from Charybdis upstream changeset 1388:b1ef26176350 done by jilles.
This commit is contained in:
JD Horelick 2010-07-04 15:27:34 -04:00
parent dab6375a1e
commit 33736ea75f
3 changed files with 29 additions and 12 deletions

View File

@ -308,6 +308,8 @@ extern const char *form_str(int);
#define ERR_KICKNOREJOIN 495
#define ERR_OWNMODE 494 /* from bahamut -- jilles */
#define ERR_UMODEUNKNOWNFLAG 501
#define ERR_USERSDONTMATCH 502

View File

@ -739,6 +739,32 @@ msg_client(int p_or_n, const char *command,
if(MyClient(source_p))
{
/*
* XXX: Controversial? Allow target users to send replies
* through a +g. Rationale is that people can presently use +g
* as a way to taunt users, e.g. harass them and hide behind +g
* as a way of griefing. --nenolod
*/
if(p_or_n != NOTICE && MyClient(source_p) &&
IsSetCallerId(source_p) &&
!accept_message(target_p, source_p) &&
!IsOper(target_p))
{
if(rb_dlink_list_length(&source_p->localClient->allow_list) <
ConfigFileEntry.max_accept)
{
rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list);
rb_dlinkAddAlloc(source_p, &target_p->on_allow_list);
}
else
{
sendto_one_numeric(source_p, ERR_OWNMODE,
form_str(ERR_OWNMODE),
target_p->name, "+g");
return;
}
}
/* reset idle time for message only if its not to self
* and its not a notice */
if(p_or_n != NOTICE)
@ -783,17 +809,6 @@ msg_client(int p_or_n, const char *command,
sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY),
target_p->name, target_p->user->away);
/*
* XXX: Controversial? Allow target users to send replies through a +g.
* Rationale is that people can presently use +g as a way to taunt users,
* e.g. harass them and hide behind +g as a way of griefing. --nenolod
*/
if(MyClient(source_p) && IsSetCallerId(source_p) && !accept_message(target_p, source_p))
{
rb_dlinkAddAlloc(target_p, &source_p->localClient->allow_list);
rb_dlinkAddAlloc(source_p, &target_p->on_allow_list);
}
if(MyClient(target_p))
{
if (IsSetNoCTCP(target_p) && p_or_n != NOTICE && *text == '\001' && strncasecmp(text + 1, "ACTION", 6))

View File

@ -515,7 +515,7 @@ static const char * replies[] = {
/* 491 ERR_NOOPERHOST, */ ":No appropriate operator blocks were found for your host",
/* 492 ERR_NOCTCP */ ":Can't send CTCP to %s (+C set)",
/* 493 */ NULL,
/* 494 */ NULL,
/* 494 ERR_OWNMODE, */ "%s :cannot answer you while you are %s, your message was not sent",
/* 495 ERR_KICKNOREJOIN */ ":%s 495 %s %s :Cannot rejoin channel so soon after being kicked (+J set)",
/* 496 */ NULL,
/* 497 */ NULL,