diff options
| author | Adam <Adam@anope.org> | 2017-05-29 12:49:22 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2017-05-29 13:11:16 -0400 |
| commit | 3f143633541a5361bf5b02b0d69b65447aea7b79 (patch) | |
| tree | 3a33bd044bc8936150dcab38f355f3c3726b05e5 | |
| parent | e36d24a6c500b5ad921041fcb905f684c09d71e9 (diff) | |
Remove recognized status and secure
Also remove /ns status, which is now almost useless with no recognized
status, and /ns access.
31 files changed, 41 insertions, 894 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf index 22881217c..e19d67b90 100644 --- a/data/chanserv.example.conf +++ b/data/chanserv.example.conf @@ -67,8 +67,6 @@ module * access level or superior * - private: Hide the channel from ChanServ's LIST command * - restricted: Kick/ban users who are restricted from the channel - * - secure: Enable channel security, requiring the user to be identified with NickServ in - * order to be considered for being on the access list of the channel * - secureops: Only allow operator status to be given if the user is on the access list * - securefounder: Only allow the real founder of the channel to drop the channel, change it's * password, or change the founder or successor @@ -82,10 +80,10 @@ module * not in use. * - none: No defaults * - * This directive is optional, if left blank, the options will default to keeptopic, chanserv/secure, securefounder, + * This directive is optional, if left blank, the options will default to keeptopic, securefounder, * and signkick. If you really want no defaults, use "none" by itself as the option. */ - defaults = "keeptopic peace secure securefounder signkick" + defaults = "keeptopic peace securefounder signkick" /* * The maximum number of channels which may be registered to a single nickname. @@ -1123,7 +1121,6 @@ command { service = "OperServ"; name = "SEEN"; command = "operserv/seen"; permis * chanserv/set/peace - Used for configuring if users are able to kick other users with higher access than them. * chanserv/set/persist - Used for setting whether ChanServ should stay in channels after the last user leaves. * chanserv/set/restricted - Used for setting whether users not on a channel's access list can join. - * chanserv/set/secure - Used for setting whether users who are recognized for accounts should have their access in channels. * chanserv/set/securefounder - Used for setting whether users with founder level access in channels have true founder or not. * chanserv/set/secureops - Used for restricting who can have channel op privilege in a channel to those whom have access in the channel. * chanserv/set/signkick - Used for setting signkick, which appends the kicker's name to kicks sent through ChanServ. @@ -1164,7 +1161,6 @@ command { service = "ChanServ"; name = "SET KEEPMODES"; command = "chanserv/set/ command { service = "ChanServ"; name = "SET PEACE"; command = "chanserv/set/peace"; } command { service = "ChanServ"; name = "SET PERSIST"; command = "chanserv/set/persist"; } command { service = "ChanServ"; name = "SET RESTRICTED"; command = "chanserv/set/restricted"; } -command { service = "ChanServ"; name = "SET SECURE"; command = "chanserv/set/secure"; } command { service = "ChanServ"; name = "SET SECUREFOUNDER"; command = "chanserv/set/securefounder"; } command { service = "ChanServ"; name = "SET SECUREOPS"; command = "chanserv/set/secureops"; } command { service = "ChanServ"; name = "SET SIGNKICK"; command = "chanserv/set/signkick"; } diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf index ceef600ab..5da993265 100644 --- a/data/nickserv.example.conf +++ b/data/nickserv.example.conf @@ -85,8 +85,6 @@ module * - killprotect: Kill nick if not identified within 60 seconds * - killquick: Kill nick if not identified within 20 seconds, this one overrides the above * option and the above must be specified with this one - * - secure: Enable nickname security, requiring the nick's password before any operations - * can be done on it * - private: Hide the nick from NickServ's LIST command * - hide_email: Hide's the nick's e-mail address from NickServ's INFO command * - hide_mask: Hide's the nick's last or current user@host from NickServ's INFO command @@ -100,10 +98,10 @@ module * - keepmodes: Enables keepmodes, which retains user modes across sessions * - noexpire: Enables no expire. Unconfirmed expire overrules this. * - * This directive is optional, if left blank, the options will default to nickserv/secure, memo_signon, and + * This directive is optional, if left blank, the options will default to memo_signon and * memo_receive. If you really want no defaults, use "none" by itself as the option. */ - defaults = "secure private hide_email hide_mask memo_signon memo_receive autoop" + defaults = "private hide_email hide_mask memo_signon memo_receive autoop" /* * The minimum length of time between consecutive uses of NickServ's REGISTER command. This @@ -230,33 +228,6 @@ command_group command { service = "NickServ"; name = "HELP"; command = "generic/help"; } /* - * nickserv/access - * - * Provides the command nickserv/access. - * - * Used for configuring what hosts have access to your account. - */ -module -{ - name = "nickserv/access" - - /* - * The maximum number of entries allowed on a nickname's access list. - * If not set, the default is 32. This number cannot be set to 0. - */ - accessmax = 32 - - /* - * If set, Services will add the usermask of registering users to the access list of their - * newly created account. If not set, users will always have to identify to NickServ before - * being recognized, unless they manually add an address to the access list of their account. - * This directive is optional. - */ - addaccessonreg = yes -} -command { service = "NickServ"; name = "ACCESS"; command = "nickserv/access"; } - -/* * nickserv/ajoin * * Provides the command nickserv/ajoin. @@ -511,7 +482,6 @@ command { service = "NickServ"; name = "RESETPASS"; command = "nickserv/resetpas * nickserv/set/language, nickserv/saset/language - Used for configuring what language services use. * 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/saset/noexpire - Used for configuring noexpire, which prevents nicks from expiring. */ module @@ -553,9 +523,6 @@ command { service = "NickServ"; name = "SASET MESSAGE"; command = "nickserv/sase command { service = "NickServ"; name = "SET PASSWORD"; command = "nickserv/set/password"; } command { service = "NickServ"; name = "SASET PASSWORD"; command = "nickserv/saset/password"; permission = "nickserv/saset/password"; } -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 = "SASET NOEXPIRE"; command = "nickserv/saset/noexpire"; permission = "nickserv/saset/noexpire"; } @@ -578,16 +545,6 @@ command { service = "NickServ"; name = "SASET URL"; command = "nickserv/saset/mi #command { service = "NickServ"; name = "SASET FACEBOOK"; command = "nickserv/saset/misc"; misc_description = _("Associate a Facebook URL with this account"); permission = "nickserv/saset/facebook"; group = "nickserv/admin"; } /* - * nickserv/status - * - * Provides the nickserv/status command. - * - * Used to determine if a user is recognized or identified by services. - */ -module { name = "nickserv/status" } -command { service = "NickServ"; name = "STATUS"; command = "nickserv/status"; } - -/* * nickserv/suspend * * Provides the commands nickserv/suspend and nickserv/unsuspend. diff --git a/include/modules/chanserv/channel.h b/include/modules/chanserv/channel.h index 92f9099d6..7c114eea0 100644 --- a/include/modules/chanserv/channel.h +++ b/include/modules/chanserv/channel.h @@ -86,9 +86,6 @@ class CoreExport Channel : public Serialize::Object virtual bool IsRestricted() anope_abstract; virtual void SetRestricted(bool) anope_abstract; - virtual bool IsSecure() anope_abstract; - virtual void SetSecure(bool) anope_abstract; - virtual bool IsSecureOps() anope_abstract; virtual void SetSecureOps(bool) anope_abstract; diff --git a/include/modules/nickserv/access.h b/include/modules/nickserv/access.h deleted file mode 100644 index 800014b9b..000000000 --- a/include/modules/nickserv/access.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2014-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -class NickAccess : public Serialize::Object -{ - public: - static constexpr const char *const NAME = "nsaccess"; - - using Serialize::Object::Object; - - virtual NickServ::Account *GetAccount() anope_abstract; - virtual void SetAccount(NickServ::Account *) anope_abstract; - - virtual Anope::string GetMask() anope_abstract; - virtual void SetMask(const Anope::string &) anope_abstract; -}; - - diff --git a/include/modules/nickserv/account.h b/include/modules/nickserv/account.h index e40ae75df..0d99e9ad8 100644 --- a/include/modules/nickserv/account.h +++ b/include/modules/nickserv/account.h @@ -77,9 +77,6 @@ class CoreExport Account : public Serialize::Object virtual bool IsMsg() anope_abstract; virtual void SetMsg(bool) anope_abstract; - virtual bool IsSecure() anope_abstract; - virtual void SetSecure(bool) anope_abstract; - virtual bool IsMemoSignon() anope_abstract; virtual void SetMemoSignon(bool) anope_abstract; @@ -106,14 +103,6 @@ class CoreExport Account : public Serialize::Object */ virtual void SetDisplay(Nick *na) anope_abstract; - /** Is the given user on this accounts access list? - * - * @param u The user - * - * @return true if the user is on the access list - */ - virtual bool IsOnAccess(User *u) anope_abstract; - virtual MemoServ::MemoInfo *GetMemos() anope_abstract; virtual unsigned int GetChannelCount() anope_abstract; diff --git a/include/users.h b/include/users.h index f3847af47..6528977a0 100644 --- a/include/users.h +++ b/include/users.h @@ -55,8 +55,6 @@ class CoreExport User : public virtual Base, public virtual Extensible, public C Anope::string vident; Anope::string ident; Anope::string uid; - /* If the user is on the access list of the nick they're on */ - bool on_access; /* Map of user modes and the params this user has (if any) */ ModeList modes; /* NickServ::Account account the user is currently loggged in as, if they are logged in */ @@ -242,12 +240,6 @@ class CoreExport User : public virtual Base, public virtual Extensible, public C */ bool IsIdentified(bool check_nick = false) const; - /** Check if the user is recognized for their nick (on the nicks access list) - * @param check_secure Only returns true if the user has secure off - * @return true or false - */ - bool IsRecognized(bool check_secure = true) const; - /** Check if the user is a services oper * @return true if they are an oper */ diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp index b9e519427..5f7c71c8c 100644 --- a/modules/chanserv/main/channel.cpp +++ b/modules/chanserv/main/channel.cpp @@ -247,16 +247,6 @@ void ChannelImpl::SetRestricted(bool restricted) Set(&ChannelType::restricted, restricted); } -bool ChannelImpl::IsSecure() -{ - return Get(&ChannelType::secure); -} - -void ChannelImpl::SetSecure(bool secure) -{ - Set(&ChannelType::secure, secure); -} - bool ChannelImpl::IsSecureOps() { return Get(&ChannelType::secureops); @@ -370,12 +360,6 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed) return group; NickServ::Account *nc = u->Account(); - if (nc == NULL && !this->IsSecure() && u->IsRecognized()) - { - NickServ::Nick *na = NickServ::FindNick(u->nick); - if (na != NULL) - nc = na->GetAccount(); - } group.super_admin = u->super_admin; group.founder = IsFounder(u); diff --git a/modules/chanserv/main/channel.h b/modules/chanserv/main/channel.h index cd419b351..eebddf91b 100644 --- a/modules/chanserv/main/channel.h +++ b/modules/chanserv/main/channel.h @@ -35,7 +35,6 @@ class ChannelImpl : public ChanServ::Channel Serialize::Storage<bool> peace; Serialize::Storage<bool> securefounder; Serialize::Storage<bool> restricted; - Serialize::Storage<bool> secure; Serialize::Storage<bool> secureops; Serialize::Storage<bool> signkick; Serialize::Storage<bool> signkicklevel; @@ -110,9 +109,6 @@ class ChannelImpl : public ChanServ::Channel bool IsRestricted() override; void SetRestricted(bool) override; - bool IsSecure() override; - void SetSecure(bool) override; - bool IsSecureOps() override; void SetSecureOps(bool) override; diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp index 8e5c10b48..ca74263cd 100644 --- a/modules/chanserv/main/channeltype.cpp +++ b/modules/chanserv/main/channeltype.cpp @@ -39,7 +39,6 @@ ChannelType::ChannelType(Module *me) : Serialize::Type<ChannelImpl>(me) , peace(this, "peace", &ChannelImpl::peace) , securefounder(this, "securefounder", &ChannelImpl::securefounder) , restricted(this, "restricted", &ChannelImpl::restricted) - , secure(this, "secure", &ChannelImpl::secure) , secureops(this, "secureops", &ChannelImpl::secureops) , signkick(this, "signkick", &ChannelImpl::signkick) , signkicklevel(this, "signkicklevel", &ChannelImpl::signkicklevel) diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h index 1e10f01ea..af4bc6cc9 100644 --- a/modules/chanserv/main/channeltype.h +++ b/modules/chanserv/main/channeltype.h @@ -48,7 +48,7 @@ class ChannelType : public Serialize::Type<ChannelImpl> Serialize::ObjectField<ChannelImpl, BotInfo *> servicebot; Serialize::Field<ChannelImpl, bool> greet, fantasy, noautoop, peace, securefounder, - restricted, secure, secureops, signkick, signkicklevel, noexpire, keepmodes, + restricted, secureops, signkick, signkicklevel, noexpire, keepmodes, persist, topiclock, keeptopic, _private; ChannelType(Module *); diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp index 0dbb8c65c..b35d3ae51 100644 --- a/modules/chanserv/set.cpp +++ b/modules/chanserv/set.cpp @@ -702,73 +702,6 @@ class CommandCSSetRestricted : public Command } }; -class CommandCSSetSecure : public Command -{ - public: - CommandCSSetSecure(Module *creator, const Anope::string &cname = "chanserv/set/secure") : Command(creator, cname, 2, 2) - { - this->SetDesc(_("Activate security features")); - this->SetSyntax(_("\037channel\037 {ON | OFF}")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - const Anope::string &chan = params[0]; - const Anope::string ¶m = params[1]; - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - ChanServ::Channel *ci = ChanServ::Find(chan); - if (ci == NULL) - { - source.Reply(_("Channel \002{0}\002 isn't registered."), chan); - return; - } - - EventReturn MOD_RESULT; - MOD_RESULT = EventManager::Get()->Dispatch(&Event::SetChannelOption::OnSetChannelOption, source, this, ci, param); - if (MOD_RESULT == EVENT_STOP) - return; - - if (MOD_RESULT != EVENT_ALLOW && !source.AccessFor(ci).HasPriv("SET") && source.GetPermission().empty() && !source.HasOverridePriv("chanserv/administration")) - { - source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "SET", ci->GetName()); - return; - } - - if (param.equals_ci("ON")) - { - logger.Command(source, ci, _("{source} used {command} on {channel} to enable secure")); - - ci->SetSecure(true); - source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->GetName()); - } - else if (param.equals_ci("OFF")) - { - logger.Command(source, ci, _("{source} used {command} on {channel} to disable secure")); - - ci->SetSecure(false); - source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName()); - } - else - { - this->OnSyntaxError(source, "SECURE"); - } - } - - bool OnHelp(CommandSource &source, const Anope::string &) override - { - source.Reply(_("Enables or disables security features for a channel." - " When \002secure\002 is set, only users who have logged in (eg. not recognized based on their hostmask)" - " will be given access to channels from account-based access entries")); - return true; - } -}; - class CommandCSSetSecureFounder : public Command { public: @@ -1143,7 +1076,6 @@ class CSSet : public Module CommandCSSetPeace commandcssetpeace; CommandCSSetPersist commandcssetpersist; CommandCSSetRestricted commandcssetrestricted; - CommandCSSetSecure commandcssetsecure; CommandCSSetSecureFounder commandcssetsecurefounder; CommandCSSetSecureOps commandcssetsecureops; CommandCSSetSignKick commandcssetsignkick; @@ -1176,7 +1108,6 @@ class CSSet : public Module , commandcssetpeace(this) , commandcssetpersist(this) , commandcssetrestricted(this) - , commandcssetsecure(this) , commandcssetsecurefounder(this) , commandcssetsecureops(this) , commandcssetsignkick(this) @@ -1301,8 +1232,6 @@ class CSSet : public Module info.AddOption(_("Peace")); if (ci->IsRestricted()) info.AddOption(_("Restricted access")); - if (ci->IsSecure()) - info.AddOption(_("Security")); if (ci->IsSecureFounder()) info.AddOption(_("Secure founder")); if (ci->IsSecureOps()) diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp index 5c0f43108..9cdc0bff4 100644 --- a/modules/database/flatfile.cpp +++ b/modules/database/flatfile.cpp @@ -24,7 +24,6 @@ #include "modules/chanserv/log.h" #include "modules/chanserv/set_misc.h" #include "modules/chanserv/suspend.h" -#include "modules/nickserv/access.h" #include "modules/nickserv/ajoin.h" #include "modules/nickserv/cert.h" #include "modules/nickserv/set_misc.h" @@ -49,6 +48,7 @@ class DBFlatFile : public Module account->SetLanguage(data["language"]); account->SetOper(Oper::Find(account->GetDisplay())); +#if 0 spacesepstream sep = data["access"]; for (Anope::string token; sep.GetToken(token);) { @@ -59,6 +59,7 @@ class DBFlatFile : public Module access->SetMask(token); } } +#endif MemoServ::MemoInfo *memos = account->GetMemos(); if (memos != nullptr) @@ -71,7 +72,7 @@ class DBFlatFile : public Module catch (const ConvertException &) { } } - sep = data["memoignore"]; + spacesepstream sep = data["memoignore"]; for (Anope::string token; memos && sep.GetToken(token);) { MemoServ::Ignore *ign = Serialize::New<MemoServ::Ignore *>(); diff --git a/modules/database/old.cpp b/modules/database/old.cpp index 49692b8bd..80e179637 100644 --- a/modules/database/old.cpp +++ b/modules/database/old.cpp @@ -30,7 +30,6 @@ #include "modules/nickserv/suspend.h" #include "modules/chanserv/suspend.h" #include "modules/chanserv/access.h" -#include "modules/nickserv/access.h" #define READ(x) \ if (true) \ @@ -517,8 +516,8 @@ static void LoadNicks() READ(read_uint32(&u32, f)); if (u32 & OLD_NI_KILLPROTECT) nc->SetKillProtect(true); - if (u32 & OLD_NI_SECURE) - nc->SetSecure(true); + //if (u32 & OLD_NI_SECURE) + // nc->SetSecure(true); if (u32 & OLD_NI_MSG) nc->SetMsg(true); if (u32 & OLD_NI_MEMO_HARDMAX) @@ -608,12 +607,14 @@ static void LoadNicks() { READ(read_string(buffer, f)); +#if 0 NickAccess *a = Serialize::New<NickAccess *>(); if (a) { a->SetAccount(nc); a->SetMask(buffer); } +#endif } int16_t i16; @@ -868,8 +869,8 @@ static void LoadChannels() ci->SetRestricted(true); if (tmpu32 & OLD_CI_PEACE) ci->SetPeace(true); - if (tmpu32 & OLD_CI_SECURE) - ci->SetSecure(true); + //if (tmpu32 & OLD_CI_SECURE) + // ci->SetSecure(true); if (tmpu32 & OLD_CI_NO_EXPIRE) ci->SetNoExpire(true); if (tmpu32 & OLD_CI_MEMO_HARDMAX) diff --git a/modules/nickserv/access.cpp b/modules/nickserv/access.cpp deleted file mode 100644 index f0116d95c..000000000 --- a/modules/nickserv/access.cpp +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Anope IRC Services - * - * Copyright (C) 2003-2017 Anope Team <team@anope.org> - * - * This file is part of Anope. Anope is free software; you can - * redistribute it and/or modify it under the terms of the GNU - * General Public License as published by the Free Software - * Foundation, version 2. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see see <http://www.gnu.org/licenses/>. - */ - -#include "module.h" -#include "modules/nickserv.h" -#include "modules/nickserv/access.h" - -class NickAccessImpl : public NickAccess -{ - friend class NickAccessType; - - Serialize::Storage<NickServ::Account *> account; - Serialize::Storage<Anope::string> mask; - - public: - using NickAccess::NickAccess; - - NickServ::Account *GetAccount() override; - void SetAccount(NickServ::Account *) override; - - Anope::string GetMask() override; - void SetMask(const Anope::string &) override; -}; - -class NickAccessType : public Serialize::Type<NickAccessImpl> -{ - public: - Serialize::ObjectField<NickAccessImpl, NickServ::Account *> account; - Serialize::Field<NickAccessImpl, Anope::string> mask; - - NickAccessType(Module *creator) : Serialize::Type<NickAccessImpl>(creator) - , account(this, "account", &NickAccessImpl::account, true) - , mask(this, "mask", &NickAccessImpl::mask) - { - } -}; - -NickServ::Account *NickAccessImpl::GetAccount() -{ - return Get(&NickAccessType::account); -} - -void NickAccessImpl::SetAccount(NickServ::Account *acc) -{ - Set(&NickAccessType::account, acc); -} - -Anope::string NickAccessImpl::GetMask() -{ - return Get(&NickAccessType::mask); -} - -void NickAccessImpl::SetMask(const Anope::string &m) -{ - Set(&NickAccessType::mask, m); -} - -class CommandNSAccess : public Command -{ - private: - void DoAdd(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - if (mask.empty()) - { - this->OnSyntaxError(source, "ADD"); - return; - } - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - std::vector<NickAccess *> access = nc->GetRefs<NickAccess *>(); - - if (access.size() >= Config->GetModule(this->GetOwner())->Get<unsigned>("accessmax", "32")) - { - source.Reply(_("Sorry, the maximum of \002{0}\002 access entries has been reached."), Config->GetModule(this->GetOwner())->Get<unsigned>("accessmax")); - return; - } - - for (NickAccess *a : access) - if (a->GetMask().equals_ci(mask)) - { - source.Reply(_("Mask \002{0}\002 already present on the access list of \002{1}\002."), mask, nc->GetDisplay()); - return; - } - - NickAccess *a = Serialize::New<NickAccess *>(); - a->SetAccount(nc); - a->SetMask(mask); - - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, _("{source} used {command} to add mask {0} to {1}"), mask, nc->GetDisplay()); - source.Reply(_("\002{0}\002 added to the access list of \002{1}\002."), mask, nc->GetDisplay()); - } - - void DoDel(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - if (mask.empty()) - { - this->OnSyntaxError(source, "DEL"); - return; - } - - if (Anope::ReadOnly) - { - source.Reply(_("Services are in read-only mode.")); - return; - } - - for (NickAccess *a : nc->GetRefs<NickAccess *>()) - if (a->GetMask().equals_ci(mask)) - { - a->Delete(); - logger.Command(nc == source.GetAccount() ? LogType::COMMAND : LogType::ADMIN, source, - _("{source} used {command} to delete mask {0} from {1}"), - mask, nc->GetDisplay()); - source.Reply(_("\002{0}\002 deleted from the access list of \002{1}\002."), mask, nc->GetDisplay()); - return; - } - - - source.Reply(_("\002{0}\002 not found on the access list of \002{1}\002."), mask, nc->GetDisplay()); - } - - void DoList(CommandSource &source, NickServ::Account *nc, const Anope::string &mask) - { - std::vector<NickAccess *> access = nc->GetRefs<NickAccess *>(); - if (access.empty()) - { - source.Reply(_("The access list of \002{0}\002 is empty."), nc->GetDisplay()); - return; - } - - source.Reply(_("Access list for \002{0}\002:"), nc->GetDisplay()); - for (NickAccess *a : access) - { - if (!mask.empty() && !Anope::Match(a->GetMask(), mask)) - continue; - - source.Reply(" {0}", a->GetMask()); - } - } - public: - CommandNSAccess(Module *creator) : Command(creator, "nickserv/access", 1, 3) - { - this->SetDesc(_("Modify the list of authorized addresses")); - this->SetSyntax(_("ADD [\037nickname\037] \037mask\037")); - this->SetSyntax(_("DEL [\037nickname\037] \037mask\037")); - this->SetSyntax(_("LIST [\037nickname\037]")); - } - - void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override - { - const Anope::string &cmd = params[0]; - Anope::string nick, mask; - - if (cmd.equals_ci("LIST")) - nick = params.size() > 1 ? params[1] : ""; - else - { - nick = params.size() == 3 ? params[1] : ""; - mask = params.size() > 1 ? params[params.size() - 1] : ""; - } - - NickServ::Account *nc; - if (!nick.empty() && source.HasPriv("nickserv/access")) - { - NickServ::Nick *na = NickServ::FindNick(nick); - if (na == NULL) - { - source.Reply(_("\002{0}\002 isn't registered."), nick); - return; - } - - if (Config->GetModule("nickserv/main")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->GetAccount() && na->GetAccount()->GetOper() && !cmd.equals_ci("LIST")) - { - source.Reply(_("You may view but not modify the access list of other Services Operators.")); - return; - } - - nc = na->GetAccount(); - } - else - { - nc = source.nc; - } - - if (!mask.empty() && (mask.find('@') == Anope::string::npos || mask.find('!') != Anope::string::npos)) - { - source.Reply(_("Mask must be in the form \037user\037@\037host\037.")); - source.Reply(_("\002%s%s HELP %s\002 for more information."), Config->StrictPrivmsg, source.service->nick, source.GetCommand()); // XXX - return; - } - - if (cmd.equals_ci("LIST")) - return |
