Add chmode +G, which blocks messages in all caps.
This commit is contained in:
parent
3b84aed4b4
commit
2b3c7c29c3
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue