]> jfr.im git - irc/rqf/shadowircd.git/commitdiff
Add chmode +G, which blocks messages in all caps.
authorB.Greenham <redacted>
Thu, 25 Feb 2010 06:51:28 +0000 (01:51 -0500)
committerB.Greenham <redacted>
Thu, 25 Feb 2010 06:51:28 +0000 (01:51 -0500)
help/opers/cmode
include/channel.h
modules/core/m_message.c
src/chmode.c

index 0bef5f697e8871815c61028bbc9ae9c05593a79f..af502195d4701d65048064fd78ab9fcef0316f80 100644 (file)
@@ -35,6 +35,8 @@ NO PARAMETERS:
               channel.
      +N     - No nickchanges. People on the channel will not be able to
               change nick.
+     +N     - Block messages in all caps. Messages that are more than
+              50% capital letters will be blocked.
 
 WITH PARAMETERS:
      +f     - Forward.  Forwards users who cannot join because of +i,
index 4064c3dfa8a0e5b84fdb83bedb8de214d89b3a27..db181167b85b0546bccf8b7657293fe47dc2d665 100644 (file)
@@ -179,6 +179,7 @@ typedef int (*ExtbanFunc)(const char *data, struct Client *client_p,
 #define MODE_NOACTION  0x32000 /* Block CTCP ACTION directed to this channel */
 #define MODE_NOKICK    0x64000 /* Disable /kick on this channel */
 #define MODE_NONICK    0x128000 /* Disable /nick for anyone on this channel */
+#define MODE_NOCAPS    0x256000 /* Block messages in all capital letters */
 
 #define CHFL_BAN        0x10000000     /* ban channel flag */
 #define CHFL_EXCEPTION  0x20000000     /* exception to ban channel flag */
index 8277301ca7c0e33c52a8e9a2069a2e16a880f655..a3378f147d67c618811fbe81bad4bf90a846fc14 100644 (file)
@@ -484,6 +484,9 @@ msg_channel(int p_or_n, const char *command,
 {
        int result;
        char text2[BUFSIZE];
+       int contor;
+       int caps = 0;
+       int len = 0;
 
        if(MyClient(source_p))
        {
@@ -513,6 +516,21 @@ msg_channel(int p_or_n, const char *command,
                if(result == CAN_SEND_OPV ||
                   !flood_attack_channel(p_or_n, source_p, chptr, chptr->chname))
                {
+                       if (strlen(text) > 10 && chptr->mode.mode & MODE_NOCAPS)
+                       {
+                               for(contor=0; contor < strlen(text); contor++)
+                               {
+                                       if(IsUpper(text[contor]) && !isdigit(text[contor]))
+                                               caps++; 
+                                       len++;
+                               }
+                               if(((caps*100)/(len)) >= 50)
+                               {
+                                       sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
+                                                       form_str(ERR_CANNOTSENDTOCHAN), chptr->chname);
+                                       return;
+                               }
+                       }
                        if (p_or_n != PRIVMSG && chptr->mode.mode & MODE_NONOTICE)
                        {
                                sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN,
index 49c570468eabe835a335c75e0ac90e7eee89e44f..2319c51677a583ebea23be192c52a4ae3491cce0 100644 (file)
@@ -1403,7 +1403,7 @@ struct ChannelMode chmode_table[256] =
   {chm_simple, MODE_NOACTION },        /* D */
   {chm_simple, MODE_NOKICK },          /* E */
   {chm_simple, MODE_FREETARGET },      /* F */
-  {chm_nosuch, 0 },                    /* G */
+  {chm_simple, MODE_NOCAPS },          /* G */
   {chm_nosuch, 0 },                    /* H */
   {chm_ban,    CHFL_INVEX },           /* I */
   {chm_nosuch, 0 },                    /* J */