Add umode +C, which blocks CTCPs to anyone with it set.

This commit is contained in:
B.Greenham 2010-02-22 22:14:47 -05:00
parent 3d17692d72
commit ccfc9b567d
8 changed files with 16 additions and 3 deletions

View 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.

View 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.

View 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)

View 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

View 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 */

View 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,

View 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}
};

View 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 */