diff options
-rw-r--r-- | data/anope.example.conf | 2 | ||||
-rw-r--r-- | data/nickserv.example.conf | 5 | ||||
-rw-r--r-- | modules/commands/cs_access.cpp | 6 | ||||
-rw-r--r-- | modules/commands/cs_flags.cpp | 6 | ||||
-rw-r--r-- | modules/commands/cs_xop.cpp | 6 | ||||
-rw-r--r-- | modules/commands/ns_set.cpp | 93 |
6 files changed, 115 insertions, 3 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf index f2fe66837..9ce2805fd 100644 --- a/data/anope.example.conf +++ b/data/anope.example.conf @@ -792,7 +792,7 @@ log * nickserv/saset/autoop nickserv/saset/email nickserv/saset/greet nickserv/saset/password * nickserv/saset/display nickserv/saset/kill nickserv/saset/language nickserv/saset/message * nickserv/saset/private nickserv/saset/secure nickserv/saset/url nickserv/saset/noexpire - * nickserv/saset/keepmodes + * nickserv/saset/keepmodes nickserv/saset/neverop * * hostserv/set hostserv/del hostserv/list * diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf index 69f2fa07e..d693297f5 100644 --- a/data/nickserv.example.conf +++ b/data/nickserv.example.conf @@ -107,6 +107,7 @@ module * - memo_receive: Notify user if they have a new memo as soon as it's received * - memo_mail: Notify user if they have a new memo by mail * - autoop: User will be automatically opped in channels they enter and have access to + * - neverop: User can not be added to access lists * - msg: Messages will be sent as PRIVMSGs instead of NOTICEs, requires options:useprivmsg * to be enabled as well * - ns_keep_modes: Enables keepmodes, which retains user modes across sessions @@ -532,6 +533,7 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas * nickserv/set/message, nickserv/saset/message - Used to configure how services send messages to you. * nickserv/set/password, nickserv/saset/password - Used for changing a users password. * nickserv/set/secure, nickserv/saset/secure - Used for configuring whether a user can identify by simply being recognized by nickserv/access. + * nickserv/set/neverop, nickserv/saset/neverop - Used to configure whether a user can be added to access lists * nickserv/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring. */ module @@ -576,6 +578,9 @@ command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/sas command { service = "NickServ"; name = "SET SECURE"; command = "nickserv/set/secure"; } command { service = "NickServ"; name = "SASET SECURE"; command = "nickserv/saset/secure"; permission = "nickserv/saset/secure"; } +command { service = "NickServ"; name = "SET NEVEROP"; command = "nickserv/set/neverop"; } +command { service = "NickServ"; name = "SASET NEVEROP"; command = "nickserv/saset/neverop"; permission = "nickserv/saset/neverop"; } + command { service = "NickServ"; name = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; } diff --git a/modules/commands/cs_access.cpp b/modules/commands/cs_access.cpp index 7a37c5434..9c0caa9c7 100644 --- a/modules/commands/cs_access.cpp +++ b/modules/commands/cs_access.cpp @@ -166,6 +166,12 @@ class CommandCSAccess : public Command source.Reply(_("Masks and unregistered users may not be on access lists.")); return; } + else if (na && na->nc->HasExt("NEVEROP")) + { + source.Reply(_("\002%s\002 does not wish to be added to channel access lists."), + na->nc->display.c_str()); + return; + } else if (mask.find_first_of("!*@") == Anope::string::npos && !na) { User *targ = User::Find(mask, true); diff --git a/modules/commands/cs_flags.cpp b/modules/commands/cs_flags.cpp index 54a99d7b6..e1ea5ba00 100644 --- a/modules/commands/cs_flags.cpp +++ b/modules/commands/cs_flags.cpp @@ -120,6 +120,12 @@ class CommandCSFlags : public Command source.Reply(_("Masks and unregistered users may not be on access lists.")); return; } + else if (na && na->nc->HasExt("NEVEROP")) + { + source.Reply(_("\002%s\002 does not wish to be added to channel access lists."), + na->nc->display.c_str()); + return; + } else if (mask.find_first_of("!*@") == Anope::string::npos && !na) { User *targ = User::Find(mask, true); diff --git a/modules/commands/cs_xop.cpp b/modules/commands/cs_xop.cpp index 69f998740..051af5470 100644 --- a/modules/commands/cs_xop.cpp +++ b/modules/commands/cs_xop.cpp @@ -166,6 +166,12 @@ class CommandCSXOP : public Command source.Reply(_("Masks and unregistered users may not be on access lists.")); return; } + else if (na && na->nc->HasExt("NEVEROP")) + { + source.Reply(_("\002%s\002 does not wish to be added to channel access lists."), + na->nc->display.c_str()); + return; + } else if (mask.find_first_of("!*@") == Anope::string::npos && !na) { User *targ = User::Find(mask, true); diff --git a/modules/commands/ns_set.cpp b/modules/commands/ns_set.cpp index b18bb9cff..f020d4959 100644 --- a/modules/commands/ns_set.cpp +++ b/modules/commands/ns_set.cpp @@ -322,6 +322,89 @@ class CommandNSSASetAutoOp : public CommandNSSetAutoOp } }; +class CommandNSSetNeverOp : public Command +{ + public: + CommandNSSetNeverOp(Module *creator, const Anope::string &sname = "nickserv/set/neverop", size_t min = 1) : Command(creator, sname, min, min + 1) + { + this->SetDesc(_("Sets whether you can be added to a channel access list.")); + this->SetSyntax("{ON | OFF}"); + } + + void Run(CommandSource &source, const Anope::string &user, const Anope::string ¶m) + { + if (Anope::ReadOnly) + { + source.Reply(READ_ONLY_MODE); + return; + } + + const NickAlias *na = NickAlias::Find(user); + if (na == NULL) + { + source.Reply(NICK_X_NOT_REGISTERED, user.c_str()); + return; + } + NickCore *nc = na->nc; + + EventReturn MOD_RESULT; + FOREACH_RESULT(OnSetNickOption, MOD_RESULT, (source, this, nc, param)); + if (MOD_RESULT == EVENT_STOP) + return; + + if (param.equals_ci("ON")) + { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable neverop for " << na->nc->display; + nc->Extend<bool>("NEVEROP"); + source.Reply(_("%s can no longer be added to channel access lists."), nc->display.c_str()); + } + else if (param.equals_ci("OFF")) + { + Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable neverop for " << na->nc->display; + nc->Shrink<bool>("NEVEROP"); + source.Reply(_("%s can now be added to channel access lists."), nc->display.c_str()); + } + else + this->OnSyntaxError(source, "NEVEROP"); + } + + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override + { + this->Run(source, source.nc->display, params[0]); + } + + bool OnHelp(CommandSource &source, const Anope::string &) override + { + this->SendSyntax(source); + source.Reply(" "); + source.Reply(_("Sets whether you can be added to a channel access list.")); + return true; + } +}; + +class CommandNSSASetNeverOp : public CommandNSSetNeverOp +{ + public: + CommandNSSASetNeverOp(Module *creator) : CommandNSSetNeverOp(creator, "nickserv/saset/neverop", 2) + { + this->ClearSyntax(); + this->SetSyntax(_("\037nickname\037 {ON | OFF}")); + } + + void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override + { + this->Run(source, params[0], params[1]); + } + + bool OnHelp(CommandSource &source, const Anope::string &) override + { + this->SendSyntax(source); + source.Reply(" "); + source.Reply(_("Sets whether the given nickname can be added to a channel access list.")); + return true; + } +}; + class CommandNSSetDisplay : public Command { public: @@ -1157,6 +1240,9 @@ class NSSet : public Module CommandNSSetAutoOp commandnssetautoop; CommandNSSASetAutoOp commandnssasetautoop; + CommandNSSetNeverOp commandnssetneverop; + CommandNSSASetNeverOp commandnssasetneverop; + CommandNSSetDisplay commandnssetdisplay; CommandNSSASetDisplay commandnssasetdisplay; @@ -1183,7 +1269,7 @@ class NSSet : public Module CommandNSSASetNoexpire commandnssasetnoexpire; - SerializableExtensibleItem<bool> autoop, killprotect, kill_quick, kill_immed, + SerializableExtensibleItem<bool> autoop, neverop, killprotect, kill_quick, kill_immed, message, secure, noexpire; struct KeepModes : SerializableExtensibleItem<bool> @@ -1239,6 +1325,7 @@ class NSSet : public Module NSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsset(this), commandnssaset(this), commandnssetautoop(this), commandnssasetautoop(this), + commandnssetneverop(this), commandnssasetneverop(this), commandnssetdisplay(this), commandnssasetdisplay(this), commandnssetemail(this), commandnssasetemail(this), commandnssetkeepmodes(this), commandnssasetkeepmodes(this), @@ -1249,7 +1336,7 @@ class NSSet : public Module commandnssetsecure(this), commandnssasetsecure(this), commandnssasetnoexpire(this), - autoop(this, "AUTOOP"), + autoop(this, "AUTOOP"), neverop(this, "NEVEROP"), killprotect(this, "KILLPROTECT"), kill_quick(this, "KILL_QUICK"), kill_immed(this, "KILL_IMMED"), message(this, "MSG"), secure(this, "NS_SECURE"), noexpire(this, "NS_NO_EXPIRE"), @@ -1314,6 +1401,8 @@ class NSSet : public Module info.AddOption(_("Message mode")); if (autoop.HasExt(na->nc)) info.AddOption(_("Auto-op")); + if (neverop.HasExt(na->nc)) + info.AddOption(_("Never-op")); if (noexpire.HasExt(na)) info.AddOption(_("No expire")); if (keep_modes.HasExt(na->nc)) |