]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Add umode +C, which blocks CTCPs to anyone with it set.
authorB.Greenham <redacted>
Tue, 23 Feb 2010 03:14:47 +0000 (22:14 -0500)
committerB.Greenham <redacted>
Tue, 23 Feb 2010 03:14:47 +0000 (22:14 -0500)
help/opers/umode
help/users/umode
include/client.h
include/numeric.h
modules/core/m_message.c
src/messages.tab
src/newconf.c
src/s_user.c

index 788c625480882a865ff81aa3fb60b3f4b25f8110..9eaf13169602ffe502d138153e5e3fc22b97d2f9 100644 (file)
@@ -13,6 +13,7 @@ Usermodes: (* designates that the umode is oper only)
        * +l     - Can see oper locops (local wallops).
        * +s     - Can see server notices (see /quote help snomask).
        * +z     - Can see operwalls.
+         +C     - Prevents you from receiving CTCPs other than ACTION.
          +D     - Deaf - ignores all channel messages.
          +Q     - Prevents you from being affected by channel forwarding.
          +R     - Prevents non accept unidentified users from messaging you.
index 00b7743bad428cf95200853de5a277294d084ac7..3ae38c94fccc538273ed8dc3ef2b317f821909db 100644 (file)
@@ -9,6 +9,7 @@ Usermodes:
          +i     - Designates this client 'invisible'.
          +g     - "caller id" mode only allow accept clients to message you
          +w     - Can see oper wallops.
+         +C     - Prevents you from receiving CTCPs other than ACTION.
          +D     - Deaf - ignores all channel messages.
          +Q     - Prevents you from being affected by channel forwarding.
          +R     - Prevents non accept unidentified users from messaging you.
index 4a28a3079c959fc21372b623d3f95e3a99daab40..dbd6910ff4b3fb75ffd2af19c945623fbf65b2fa 100644 (file)
@@ -421,6 +421,7 @@ struct ListClient
 #define UMODE_DEAF        0x0080
 #define UMODE_NOFORWARD    0x0100      /* don't forward */
 #define UMODE_REGONLYMSG   0x0200      /* only allow logged in users to msg */
+#define UMODE_NOCTCP   0x0400          /* block CTCPs except for ACTION */
 
 /* user information flags, only settable by remote mode or local oper */
 #define UMODE_OPER         0x1000      /* Operator */
@@ -514,6 +515,7 @@ struct ListClient
 #define IsDeaf(x)              ((x)->umodes & UMODE_DEAF)
 #define IsNoForward(x)         ((x)->umodes & UMODE_NOFORWARD)
 #define IsSetRegOnlyMsg(x)     ((x)->umodes & UMODE_REGONLYMSG)
+#define IsSetNoCTCP(x)         ((x)->umodes & UMODE_NOCTCP)
 
 #define SetGotId(x)             ((x)->flags |= FLAGS_GOTID)
 #define IsGotId(x)              (((x)->flags & FLAGS_GOTID) != 0)
index 92dc560fa3abf8bc32fe896089f192d0aac20ecd..c90fcd0a357cffa5b45144cfa635f063325a7498 100644 (file)
@@ -296,6 +296,8 @@ extern const char *form_str(int);
 
 #define ERR_NOOPERHOST       491
 
+#define ERR_NOCTCP                     492
+
 #define ERR_UMODEUNKNOWNFLAG 501
 #define ERR_USERSDONTMATCH   502
 
index faca81371c5cd7ab0fad5d26d44210eb1eb62a60..cd35b33c345411f606d543c098533c428ccdf9c4 100644 (file)
@@ -728,8 +728,14 @@ msg_client(int p_or_n, const char *command,
 
        if(MyClient(target_p))
        {
+               if (IsSetNoCTCP(target_p) && p_or_n != NOTICE && *text == '\001' && strncasecmp(text + 1, "ACTION", 6))
+               {   
+                           sendto_one_numeric(source_p, ERR_NOCTCP,
+                                   form_str(ERR_NOCTCP),
+                                   target_p->name);
+               }
                /* XXX Controversial? allow opers always to send through a +g */
-               if(!IsServer(source_p) && (IsSetCallerId(target_p) ||
+               else if(!IsServer(source_p) && (IsSetCallerId(target_p) ||
                                        (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0])))
                {
                        /* Here is the anti-flood bot/spambot code -db */
index e87ce9ca1f80a109c9d01354533e338fbd656f9b..40b1de159cda86dba5ec7ddb491f8386ac4ddc4f 100644 (file)
@@ -513,7 +513,7 @@ static  const char *  replies[] = {
 /* 489 ERR_VOICENEEDED */      ":%s 489 %s %s :You're neither voiced nor channel operator",
 /* 490 */       NULL,
 /* 491 ERR_NOOPERHOST, */       ":No appropriate operator blocks were found for your host",
-/* 492 */       NULL,
+/* 492 ERR_NOCTCP */                    ":Can't send CTCP to %s (+C set)",
 /* 493 */       NULL,
 /* 494 */       NULL,
 /* 495 */       NULL,
index 782ed1aaebbf5d3285041cc3a6c5a38d517c0680..bf72c6a37c5ce077ba25a35fd9056a115425a2fa 100644 (file)
@@ -303,6 +303,7 @@ static struct mode_table umode_table[] = {
        {"servnotice",  UMODE_SERVNOTICE},
        {"wallop",      UMODE_WALLOP    },
        {"operwall",    UMODE_OPERWALL  },
+       {"noctcp",              UMODE_NOCTCP    },
        {NULL, 0}
 };
 
index d8be934ccdbc0cb0752e614e1ab54024f96c49b0..1a0bff50cc4fe429eef1be28e0b3384934376cd1 100644 (file)
@@ -69,7 +69,7 @@ int user_modes[256] = {
        0,                      /* @ */
        0,                      /* A */
        0,                      /* B */
-       0,                      /* C */
+       UMODE_NOCTCP,   /* C */
        UMODE_DEAF,             /* D */
        0,                      /* E */
        0,                      /* F */