diff --git a/help/opers/umode b/help/opers/umode index 788c625..9eaf131 100644 --- a/help/opers/umode +++ b/help/opers/umode @@ -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. diff --git a/help/users/umode b/help/users/umode index 00b7743..3ae38c9 100644 --- a/help/users/umode +++ b/help/users/umode @@ -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. diff --git a/include/client.h b/include/client.h index 4a28a30..dbd6910 100644 --- a/include/client.h +++ b/include/client.h @@ -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) diff --git a/include/numeric.h b/include/numeric.h index 92dc560..c90fcd0 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -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 diff --git a/modules/core/m_message.c b/modules/core/m_message.c index faca813..cd35b33 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -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 */ diff --git a/src/messages.tab b/src/messages.tab index e87ce9c..40b1de1 100644 --- a/src/messages.tab +++ b/src/messages.tab @@ -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, diff --git a/src/newconf.c b/src/newconf.c index 782ed1a..bf72c6a 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -303,6 +303,7 @@ static struct mode_table umode_table[] = { {"servnotice", UMODE_SERVNOTICE}, {"wallop", UMODE_WALLOP }, {"operwall", UMODE_OPERWALL }, + {"noctcp", UMODE_NOCTCP }, {NULL, 0} }; diff --git a/src/s_user.c b/src/s_user.c index d8be934..1a0bff5 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -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 */