diff options
-rw-r--r-- | data/example_new.conf | 33 | ||||
-rw-r--r-- | include/extern.h | 44 | ||||
-rw-r--r-- | src/config.c | 101 |
3 files changed, 111 insertions, 67 deletions
diff --git a/data/example_new.conf b/data/example_new.conf index 081864827..7a90aa8ed 100644 --- a/data/example_new.conf +++ b/data/example_new.conf @@ -752,4 +752,37 @@ operserv * supported. */ disableraw = yes + + /* + * Defines what actions should trigger notifications. The list must be separated by spaces. + * + * The notifications are: + * - oper: A user has become an IRC operator + * - bados: A non-IRCop attempts to use OperServ + * - osglobal: OperServ's GLOBAL command was used + * - osmode: OperServ's MODE command was used + * - osclearmodes: OperServ's CLEARMODES command was used + * - oskick: OperServ's KICK command was used + * - osakill: OperServ's AKILL command was used + * - ossgline: OperServ's SGLINE command was used + * - ossqline: OperServ's SQLINE command was used + * - osszline: OperServ's SZLINE command was used + * - osnoop: OperServ's NOOP command was used + * - osjupe: OperServ's JUPE command was used + * - osraw: OperServ's RAW command was used + * - akillexpire: An AKILL has expired + * - sglineexpire: An SGLINE has expired + * - sqlineexpire: An SQLINE has expired + * - szlineexpire: An SZLINE has expired + * - exceptionexpire: A session exception has expired + * - getpass: NickServ's or ChanServ's GETPASS command was used + * - setpass: A Services Admin has set the password of a nickname or channel they do + * not normally have access to + * - forbid: NickServ's or ChanServ's FORBID command was used + * - drop: A Services Admin has dropped a nickname or channel they do not normally + * have access to + * + * This directive is optional, if left blank, there will be no notifications. + */ + notifications="osglobal osmode osclearmodes oskick osakill ossgline ossqline osszline osnoop osjupe osraw getpass setpass forbid drop" } diff --git a/include/extern.h b/include/extern.h index ea32a4a63..43ae78e5e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -387,28 +387,28 @@ E bool AkillOnAdd; E bool KillonSGline; E bool KillonSQline; E bool DisableRaw; -E int WallOper; -E int WallBadOS; -E int WallOSGlobal; -E int WallOSMode; -E int WallOSClearmodes; -E int WallOSKick; -E int WallOSAkill; -E int WallOSSGLine; -E int WallOSSQLine; -E int WallOSSZLine; -E int WallOSNoOp; -E int WallOSJupe; -E int WallOSRaw; -E int WallAkillExpire; -E int WallSGLineExpire; -E int WallSQLineExpire; -E int WallSZLineExpire; -E int WallExceptionExpire; -E int WallDrop; -E int WallForbid; -E int WallGetpass; -E int WallSetpass; +E bool WallOper; +E bool WallBadOS; +E bool WallOSGlobal; +E bool WallOSMode; +E bool WallOSClearmodes; +E bool WallOSKick; +E bool WallOSAkill; +E bool WallOSSGLine; +E bool WallOSSQLine; +E bool WallOSSZLine; +E bool WallOSNoOp; +E bool WallOSJupe; +E bool WallOSRaw; +E bool WallAkillExpire; +E bool WallSGLineExpire; +E bool WallSQLineExpire; +E bool WallSZLineExpire; +E bool WallExceptionExpire; +E bool WallDrop; +E bool WallForbid; +E bool WallGetpass; +E bool WallSetpass; E int AddAkiller; E int parse_directive(Directive * d, char *dir, int ac, char *av[MAXPARAMS], int linenum, int reload, char *s); diff --git a/src/config.c b/src/config.c index ff144360e..888cc12dc 100644 --- a/src/config.c +++ b/src/config.c @@ -192,28 +192,29 @@ time_t SZLineExpiry; bool AkillOnAdd; bool KillonSGline; bool KillonSQline; -int WallOper; -int WallBadOS; -int WallOSGlobal; -int WallOSMode; -int WallOSClearmodes; -int WallOSKick; -int WallOSAkill; -int WallOSSGLine; -int WallOSSQLine; -int WallOSSZLine; -int WallOSNoOp; -int WallOSJupe; -int WallOSRaw; -int WallAkillExpire; -int WallSGLineExpire; -int WallSQLineExpire; -int WallSZLineExpire; -int WallExceptionExpire; -int WallDrop; -int WallForbid; -int WallGetpass; -int WallSetpass; +static std::string OSNotifications; +bool WallOper; +bool WallBadOS; +bool WallOSGlobal; +bool WallOSMode; +bool WallOSClearmodes; +bool WallOSKick; +bool WallOSAkill; +bool WallOSSGLine; +bool WallOSSQLine; +bool WallOSSZLine; +bool WallOSNoOp; +bool WallOSJupe; +bool WallOSRaw; +bool WallAkillExpire; +bool WallSGLineExpire; +bool WallSQLineExpire; +bool WallSZLineExpire; +bool WallExceptionExpire; +bool WallDrop; +bool WallForbid; +bool WallGetpass; +bool WallSetpass; int AddAkiller; int LimitSessions; @@ -656,6 +657,7 @@ int ServerConfig::Read(bool bail) {"operserv", "killonsgline", "no", new ValueContainerBool(&KillonSGline), DT_BOOLEAN, NoValidation}, {"operserv", "killonsqline", "no", new ValueContainerBool(&KillonSQline), DT_BOOLEAN, NoValidation}, {"operserv", "disableraw", "no", new ValueContainerBool(&DisableRaw), DT_BOOLEAN, NoValidation}, + {"operserv", "notifications", "", new ValueContainerString(&OSNotifications), DT_STRING, NoValidation}, {NULL, NULL, NULL, NULL, DT_NOTHING, NoValidation} }; /* These tags can occur multiple times, and therefore they have special code to read them @@ -1335,29 +1337,6 @@ Directive directives[] = { {"UseTokens", {{PARAM_SET, 0, &UseTokens}}}, {"UseTS6", {{PARAM_SET, 0, &UseTS6}}}, {"UnRestrictSAdmin", {{PARAM_SET, PARAM_RELOAD, &UnRestrictSAdmin}}}, - {"WallAkillExpire", {{PARAM_SET, PARAM_RELOAD, &WallAkillExpire}}}, - {"WallBadOS", {{PARAM_SET, PARAM_RELOAD, &WallBadOS}}}, - {"WallDrop", {{PARAM_SET, PARAM_RELOAD, &WallDrop}}}, - {"WallExceptionExpire", - {{PARAM_SET, PARAM_RELOAD, &WallExceptionExpire}}}, - {"WallForbid", {{PARAM_SET, PARAM_RELOAD, &WallForbid}}}, - {"WallGetpass", {{PARAM_SET, PARAM_RELOAD, &WallGetpass}}}, - {"WallOper", {{PARAM_SET, PARAM_RELOAD, &WallOper}}}, - {"WallOSAkill", {{PARAM_SET, PARAM_RELOAD, &WallOSAkill}}}, - {"WallOSClearmodes", {{PARAM_SET, PARAM_RELOAD, &WallOSClearmodes}}}, - {"WallOSGlobal", {{PARAM_SET, PARAM_RELOAD, &WallOSGlobal}}}, - {"WallOSKick", {{PARAM_SET, PARAM_RELOAD, &WallOSKick}}}, - {"WallOSJupe", {{PARAM_SET, PARAM_RELOAD, &WallOSJupe}}}, - {"WallOSMode", {{PARAM_SET, PARAM_RELOAD, &WallOSMode}}}, - {"WallOSNoOp", {{PARAM_SET, PARAM_RELOAD, &WallOSNoOp}}}, - {"WallOSRaw", {{PARAM_SET, PARAM_RELOAD, &WallOSRaw}}}, - {"WallOSSGLine", {{PARAM_SET, PARAM_RELOAD, &WallOSSGLine}}}, - {"WallOSSQLine", {{PARAM_SET, PARAM_RELOAD, &WallOSSQLine}}}, - {"WallOSSZLine", {{PARAM_SET, PARAM_RELOAD, &WallOSSZLine}}}, - {"WallSetpass", {{PARAM_SET, PARAM_RELOAD, &WallSetpass}}}, - {"WallSGLineExpire", {{PARAM_SET, PARAM_RELOAD, &WallSGLineExpire}}}, - {"WallSQLineExpire", {{PARAM_SET, PARAM_RELOAD, &WallSQLineExpire}}}, - {"WallSZLineExpire", {{PARAM_SET, PARAM_RELOAD, &WallSZLineExpire}}}, {"WarningTimeout", {{PARAM_TIME, PARAM_RELOAD, &WarningTimeout}}}, {"GlobalOnDefcon", {{PARAM_SET, PARAM_RELOAD, &GlobalOnDefcon}}}, {"GlobalOnDefconMore", @@ -1806,6 +1785,38 @@ int read_config(int reload) } } + WallOper = WallBadOS = WallOSGlobal = WallOSMode = WallOSClearmodes = WallOSKick = WallOSAkill = WallOSSGLine = WallOSSQLine = WallOSSZLine = WallOSNoOp = + WallOSJupe = WallOSRaw = WallAkillExpire = WallSGLineExpire = WallSQLineExpire = WallSZLineExpire = WallExceptionExpire = WallGetpass = WallSetpass = + WallForbid = WallDrop = false; + if (!OSNotifications.empty()) { + spacesepstream notifications(OSNotifications); + std::string notice; + while (notifications.GetToken(notice)) { + if (notice == "oper") WallOper = true; + else if (notice == "bados") WallBadOS = true; + else if (notice == "osglobal") WallOSGlobal = true; + else if (notice == "osmode") WallOSMode = true; + else if (notice == "osclearmodes") WallOSClearmodes = true; + else if (notice == "oskick") WallOSKick = true; + else if (notice == "osakill") WallOSAkill = true; + else if (notice == "ossgline") WallOSSGLine = true; + else if (notice == "ossqline") WallOSSQLine = true; + else if (notice == "osszline") WallOSSZLine = true; + else if (notice == "osnoop") WallOSNoOp = true; + else if (notice == "osjupe") WallOSJupe = true; + else if (notice == "osraw") WallOSRaw = true; + else if (notice == "akillexpire") WallAkillExpire = true; + else if (notice == "sglineexpire") WallSGLineExpire = true; + else if (notice == "sqlineexpire") WallSQLineExpire = true; + else if (notice == "szlineexpire") WallSZLineExpire = true; + else if (notice == "exceptionexpire") WallExceptionExpire = true; + else if (notice == "getpass") WallGetpass = true; + else if (notice == "setpass") WallSetpass = true; + else if (notice == "forbid") WallForbid = true; + else if (notice == "drop") WallDrop = true; + } + } + /* Services Root building */ if (ServicesRoot && !reload) { /* Check to prevent segmentation fault if it's missing */ |