]> jfr.im git - irc/blitzed-org/charybdis.git/commitdiff
Tweak auto-accept:
authorJilles Tjoelker <redacted>
Sun, 4 Jul 2010 15:14:56 +0000 (17:14 +0200)
committerJilles Tjoelker <redacted>
Sun, 4 Jul 2010 15:14:56 +0000 (17:14 +0200)
* 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

include/numeric.h
modules/core/m_message.c
src/messages.tab

index 9a17db1cd973153a309f945b427dfa569b0c9301..65a6cee33437c85d18c2687ed4fa0860983b1bd8 100644 (file)
@@ -297,6 +297,8 @@ extern const char *form_str(int);
 
 #define ERR_NOOPERHOST       491
 
+#define ERR_OWNMODE          494 /* from bahamut -- jilles */
+
 #define ERR_UMODEUNKNOWNFLAG 501
 #define ERR_USERSDONTMATCH   502
 
index e2dd4de6c4204263d847cd1a7cb2cfb2dcb4920c..2be4c1ed31c3e0461178feb67d3dced60efdca77 100644 (file)
@@ -682,6 +682,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)
@@ -726,17 +752,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))
        {
                /* XXX Controversial? allow opers always to send through a +g */
index 7d6562d15c07efae6a0eccd078a7080660f08f0a..8c78808e983480712ffa2c2aee6e05cd4edadc3f 100644 (file)
@@ -515,7 +515,7 @@ static  const char *  replies[] = {
 /* 491 ERR_NOOPERHOST, */       ":No appropriate operator blocks were found for your host",
 /* 492 */       NULL,
 /* 493 */       NULL,
-/* 494 */       NULL,
+/* 494 ERR_OWNMODE, */          "%s :cannot answer you while you are %s, your message was not sent",
 /* 495 */       NULL,
 /* 496 */       NULL,
 /* 497 */       NULL,