From c13a2d9ad3893a66b8f782546fdf5b2a9743fd87 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Mon, 24 Dec 2007 21:47:05 +0100 Subject: [PATCH] Add mass_notice oper priv, enabled by default for compatibility. Controls /wallops and masked notices/privmsgs. --- doc/example.conf | 1 + doc/reference.conf | 1 + include/s_newconf.h | 5 +++-- modules/core/m_message.c | 7 +++++++ modules/m_wallops.c | 7 +++++++ src/newconf.c | 3 ++- src/s_newconf.c | 1 + 7 files changed, 22 insertions(+), 3 deletions(-) diff --git a/doc/example.conf b/doc/example.conf index 6f66957..35a1b55 100755 --- a/doc/example.conf +++ b/doc/example.conf @@ -232,6 +232,7 @@ operator "god" { * channels etc. see /quote help operspy * hidden_oper: hides the oper from /stats p (OLD UMODE +p) * remoteban: allows remote kline etc [DEFAULT] + * mass_notice: allows sending wallops and mass notices [DEFAULT] */ flags = global_kill, remote, kline, unkline, gline, die, rehash, admin, xline, operwall; diff --git a/doc/reference.conf b/doc/reference.conf index 4d96ae3..76458a3 100755 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -398,6 +398,7 @@ operator "god" { * channels etc. see /quote help operspy * hidden_oper: hides the oper from /stats p (OLD UMODE +p) * remoteban: allows remote kline etc [DEFAULT] + * mass_notice: allows sending wallops and mass notices [DEFAULT] */ flags = global_kill, remote, kline, unkline, gline, die, rehash, admin, xline, operwall; diff --git a/include/s_newconf.h b/include/s_newconf.h index a938860..8e8e63b 100644 --- a/include/s_newconf.h +++ b/include/s_newconf.h @@ -152,14 +152,14 @@ extern void cluster_generic(struct Client *, const char *, int cltype, #define OPER_INVIS 0x08000 #define OPER_SPY 0x10000 #define OPER_REMOTEBAN 0x20000 -/* 0x40000 */ +#define OPER_MASSNOTICE 0x40000 /* 0x400000 and above are in client.h */ #define OPER_FLAGS (OPER_KLINE|OPER_UNKLINE|OPER_LOCKILL|OPER_GLOBKILL|\ OPER_REMOTE|OPER_GLINE|OPER_XLINE|OPER_RESV|\ OPER_NICKS|OPER_REHASH|OPER_DIE|OPER_ADMIN|\ OPER_HADMIN|OPER_OPERWALL|OPER_INVIS|OPER_SPY|\ - OPER_REMOTEBAN) + OPER_REMOTEBAN|OPER_MASSNOTICE) #define IsOperConfEncrypted(x) ((x)->flags & OPER_ENCRYPTED) @@ -181,6 +181,7 @@ extern void cluster_generic(struct Client *, const char *, int cltype, #define IsOperSpy(x) ((x)->flags2 & OPER_SPY) #define IsOperInvis(x) ((x)->flags2 & OPER_INVIS) #define IsOperRemoteBan(x) ((x)->flags2 & OPER_REMOTEBAN) +#define IsOperMassNotice(x) ((x)->flags2 & OPER_MASSNOTICE) extern struct oper_conf *make_oper_conf(void); extern void free_oper_conf(struct oper_conf *); diff --git a/modules/core/m_message.c b/modules/core/m_message.c index e6fe7ef..96da9d2 100644 --- a/modules/core/m_message.c +++ b/modules/core/m_message.c @@ -972,6 +972,13 @@ handle_special(int p_or_n, const char *command, struct Client *client_p, return; } + if(MyClient(source_p) && !IsOperMassNotice(source_p)) + { + sendto_one(source_p, form_str(ERR_NOPRIVS), + me.name, source_p->name, "mass_notice"); + return; + } + if((s = strrchr(nick, '.')) == NULL) { sendto_one_numeric(source_p, ERR_NOTOPLEVEL, diff --git a/modules/m_wallops.c b/modules/m_wallops.c index 82a2965..ccd25e9 100644 --- a/modules/m_wallops.c +++ b/modules/m_wallops.c @@ -104,6 +104,13 @@ ms_wallops(struct Client *client_p, struct Client *source_p, int parc, const cha { const char *prefix = ""; + if (MyClient(source_p) && !IsOperMassNotice(source_p)) + { + sendto_one(source_p, form_str(ERR_NOPRIVS), + me.name, source_p->name, "mass_notice"); + return 0; + } + if (IsPerson(source_p)) { if (!strncmp(parv[1], "OPERWALL - ", 11) || diff --git a/src/newconf.c b/src/newconf.c index bf33a0f..48c6160 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -326,6 +326,7 @@ static struct mode_table flag_table[] = { {"oper_spy", OPER_SPY }, {"hidden_oper", OPER_INVIS }, {"remoteban", OPER_REMOTEBAN }, + {"mass_notice", OPER_MASSNOTICE }, {NULL, 0} }; @@ -466,7 +467,7 @@ conf_begin_oper(struct TopConf *tc) } yy_oper = make_oper_conf(); - yy_oper->flags |= OPER_ENCRYPTED|OPER_RESV|OPER_OPERWALL|OPER_REMOTEBAN; + yy_oper->flags |= OPER_ENCRYPTED|OPER_RESV|OPER_OPERWALL|OPER_REMOTEBAN|OPER_MASSNOTICE; return 0; } diff --git a/src/s_newconf.c b/src/s_newconf.c index c93b57e..60e85fd 100644 --- a/src/s_newconf.c +++ b/src/s_newconf.c @@ -344,6 +344,7 @@ static struct oper_flags oper_flagtable[] = { OPER_SPY, 'S', 's' }, { OPER_INVIS, 'P', 'p' }, { OPER_REMOTEBAN, 'B', 'b' }, + { OPER_MASSNOTICE, 'M', 'm' }, { 0, '\0', '\0' } };