diff options
Diffstat (limited to 'modules/nickserv')
| -rw-r--r-- | modules/nickserv/nickserv.cpp | 56 | ||||
| -rw-r--r-- | modules/nickserv/ns_ajoin.cpp | 4 | ||||
| -rw-r--r-- | modules/nickserv/ns_cert.cpp | 10 | ||||
| -rw-r--r-- | modules/nickserv/ns_drop.cpp | 4 | ||||
| -rw-r--r-- | modules/nickserv/ns_group.cpp | 14 | ||||
| -rw-r--r-- | modules/nickserv/ns_identify.cpp | 2 | ||||
| -rw-r--r-- | modules/nickserv/ns_list.cpp | 4 | ||||
| -rw-r--r-- | modules/nickserv/ns_maxemail.cpp | 6 | ||||
| -rw-r--r-- | modules/nickserv/ns_recover.cpp | 8 | ||||
| -rw-r--r-- | modules/nickserv/ns_register.cpp | 48 | ||||
| -rw-r--r-- | modules/nickserv/ns_resetpass.cpp | 10 | ||||
| -rw-r--r-- | modules/nickserv/ns_set.cpp | 32 | ||||
| -rw-r--r-- | modules/nickserv/ns_set_keepmodes.cpp | 2 | ||||
| -rw-r--r-- | modules/nickserv/ns_set_kill.cpp | 4 | ||||
| -rw-r--r-- | modules/nickserv/ns_set_misc.cpp | 12 | ||||
| -rw-r--r-- | modules/nickserv/ns_suspend.cpp | 8 |
16 files changed, 112 insertions, 112 deletions
diff --git a/modules/nickserv/nickserv.cpp b/modules/nickserv/nickserv.cpp index 25d9a364e..7d34061c7 100644 --- a/modules/nickserv/nickserv.cpp +++ b/modules/nickserv/nickserv.cpp @@ -98,7 +98,7 @@ class NickServRelease final public: NickServRelease(Module *me, NickAlias *na, time_t delay) - : User(na->nick, Config->GetModule(me)->Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me)->Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL) + : User(na->nick, Config->GetModule(me).Get<const Anope::string>("enforceruser", "user"), Config->GetModule(me).Get<const Anope::string>("enforcerhost", Me->GetName()), "", "", Me, "Services Enforcer", Anope::CurTime, "", {}, IRCD->UID_Retrieve(), NULL) , Timer(me, delay) , nick(na->nick) { @@ -140,12 +140,12 @@ class NickServCore final { collided.Unset(na); - new NickServHeld(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m")); + new NickServHeld(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m")); if (IRCD->CanSVSHold) - IRCD->SendSVSHold(na->nick, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m")); + IRCD->SendSVSHold(na->nick, Config->GetModule(this).Get<time_t>("releasetimeout", "1m")); else - new NickServRelease(this, na, Config->GetModule(this)->Get<time_t>("releasetimeout", "1m")); + new NickServRelease(this, na, Config->GetModule(this).Get<time_t>("releasetimeout", "1m")); } } @@ -176,7 +176,7 @@ public: bool IsGuestNick(const Anope::string &nick) const override { - const auto guestnick = Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####"); + const auto guestnick = Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####"); if (guestnick.empty()) return false; // No guest nick. @@ -208,7 +208,7 @@ public: else if (MOD_RESULT == EVENT_ALLOW) return; - if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership")) + if (Config->GetModule("nickserv").Get<bool>("nonicknameownership")) return; if (!na->nc->HasExt("KILL_IMMED")) @@ -224,13 +224,13 @@ public: } else if (na->nc->HasExt("KILL_QUICK")) { - time_t killquick = Config->GetModule("nickserv")->Get<time_t>("killquick", "20s"); + time_t killquick = Config->GetModule("nickserv").Get<time_t>("killquick", "20s"); u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(killquick, u->Account()).c_str()); new NickServCollide(this, this, u, na, killquick); } else { - time_t kill = Config->GetModule("nickserv")->Get<time_t>("kill", "60s"); + time_t kill = Config->GetModule("nickserv").Get<time_t>("kill", "60s"); u->SendMessage(NickServ, _("If you do not change within %s, I will change your nick."), Anope::Duration(kill, u->Account()).c_str()); new NickServCollide(this, this, u, na, kill); } @@ -241,10 +241,10 @@ public: void OnUserLogin(User *u) override { NickAlias *na = NickAlias::Find(u->nick); - if (na && *na->nc == u->Account() && !Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) + if (na && *na->nc == u->Account() && !Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !na->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); - const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid"); + const Anope::string &modesonid = Config->GetModule(this).Get<Anope::string>("modesonid"); if (!modesonid.empty()) u->SetModes(NickServ, modesonid); } @@ -261,7 +261,7 @@ public: for (auto i = 0; i < 10; ++i) { guestnick.clear(); - for (auto guestnickchr : Config->GetModule(this)->Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick)) + for (auto guestnickchr : Config->GetModule(this).Get<Anope::string>("guestnick", "Guest####").substr(0, IRCD->MaxNick)) { if (guestnickchr == '#') guestnick.append(Anope::ToString(abs(Anope::RandomNumber()) % 10)); @@ -319,9 +319,9 @@ public: collided.Unset(na); /* clear pending collide */ } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - const Anope::string &nsnick = conf->GetModule(this)->Get<const Anope::string>("client"); + const Anope::string &nsnick = conf.GetModule(this).Get<const Anope::string>("client"); if (nsnick.empty()) throw ConfigException(Module::name + ": <client> must be defined"); @@ -332,7 +332,7 @@ public: NickServ = bi; - spacesepstream(conf->GetModule(this)->Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults); + spacesepstream(conf.GetModule(this).Get<const Anope::string>("defaults", "memo_signon memo_receive")).GetTokens(defaults); if (defaults.empty()) { defaults.emplace_back("MEMO_SIGNON"); @@ -376,9 +376,9 @@ public: void OnNickIdentify(User *u) override { - Configuration::Block *block = Config->GetModule(this); + Configuration::Block &block = Config->GetModule(this); - if (block->Get<bool>("modeonid", "yes")) + if (block.Get<bool>("modeonid", "yes")) { for (const auto &[_, cc] : u->chans) { @@ -388,11 +388,11 @@ public: } } - const Anope::string &modesonid = block->Get<const Anope::string>("modesonid"); + const Anope::string &modesonid = block.Get<const Anope::string>("modesonid"); if (!modesonid.empty()) u->SetModes(NickServ, modesonid); - if (block->Get<bool>("forceemail", "yes") && u->Account()->email.empty()) + if (block.Get<bool>("forceemail", "yes") && u->Account()->email.empty()) { u->SendMessage(NickServ, _("You must now supply an email for your nick.\n" "This email will allow you to retrieve your password in\n" @@ -434,8 +434,8 @@ public: const NickAlias *na = NickAlias::Find(u->nick); - const Anope::string &unregistered_notice = Config->GetModule(this)->Get<const Anope::string>("unregistered_notice"); - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified()) + const Anope::string &unregistered_notice = Config->GetModule(this).Get<const Anope::string>("unregistered_notice"); + if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && !unregistered_notice.empty() && !na && !u->IsIdentified()) u->SendMessage(NickServ, unregistered_notice.replace_all_cs("%n", u->nick)); else if (na && !u->IsIdentified(true)) this->Validate(u); @@ -477,7 +477,7 @@ public: { /* Reset +r and re-send account (even though it really should be set at this point) */ IRCD->SendLogin(u, na); - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED")) + if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == u->Account() && !na->nc->HasExt("UNCONFIRMED")) u->SetMode(NickServ, "REGISTERED"); Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->display; } @@ -496,7 +496,7 @@ public: { if (!params.empty() || source.c || source.service != *NickServ) return EVENT_CONTINUE; - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership")) + if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership")) source.Reply(_("\002%s\002 allows you to register a nickname and\n" "prevent others from using it. The following\n" "commands allow for registration and maintenance of\n" @@ -521,7 +521,7 @@ public: "Services Operators can also drop any nickname without needing\n" "to identify for the nick, and may view the access list for\n" "any nickname.")); - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y"); + time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y"); if (nickserv_expire >= 86400) source.Reply(_(" \n" "Accounts that are not used anymore are subject to\n" @@ -538,7 +538,7 @@ public: void OnUserQuit(User *u, const Anope::string &msg) override { - if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this)->Get<bool>("hidenetsplitquit")) + if (u->server && !u->server->GetQuitReason().empty() && Config->GetModule(this).Get<bool>("hidenetsplitquit")) return; /* Update last quit and last seen for the user */ @@ -555,7 +555,7 @@ public: if (Anope::NoExpire || Anope::ReadOnly) return; - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "90d"); + time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "90d"); for (nickalias_map::const_iterator it = NickAliasList->begin(), it_end = NickAliasList->end(); it != it_end; ) { @@ -571,7 +571,7 @@ public: if (nickserv_expire && Anope::CurTime - na->last_seen >= nickserv_expire) expire = true; - if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay")) + if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay")) expire = false; FOREACH_MOD(OnPreNickExpire, (na, expire)); @@ -589,13 +589,13 @@ public: { if (!na->nc->HasExt("UNCONFIRMED")) { - time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "1y"); + time_t nickserv_expire = Config->GetModule(this).Get<time_t>("expire", "1y"); if (!na->HasExt("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->last_seen != Anope::CurTime)) info[_("Expires")] = Anope::strftime(na->last_seen + nickserv_expire, source.GetAccount()); } else { - time_t unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d"); info[_("Expires")] = Anope::strftime(na->time_registered + unconfirmed_expire, source.GetAccount()); } } diff --git a/modules/nickserv/ns_ajoin.cpp b/modules/nickserv/ns_ajoin.cpp index 8643a2c1b..a169022b1 100644 --- a/modules/nickserv/ns_ajoin.cpp +++ b/modules/nickserv/ns_ajoin.cpp @@ -139,9 +139,9 @@ class CommandNSAJoin final if ((*channels)->at(i)->channel.equals_ci(chan)) break; - if ((*channels)->size() >= Config->GetModule(this->owner)->Get<unsigned>("ajoinmax")) + if ((*channels)->size() >= Config->GetModule(this->owner).Get<unsigned>("ajoinmax")) { - source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner)->Get<unsigned>("ajoinmax")); + source.Reply(_("Sorry, the maximum of %d auto join entries has been reached."), Config->GetModule(this->owner).Get<unsigned>("ajoinmax")); return; } else if (i != (*channels)->size()) diff --git a/modules/nickserv/ns_cert.cpp b/modules/nickserv/ns_cert.cpp index 9a697df17..15f6dbab8 100644 --- a/modules/nickserv/ns_cert.cpp +++ b/modules/nickserv/ns_cert.cpp @@ -204,7 +204,7 @@ private: void DoAdd(CommandSource &source, NickCore *nc, Anope::string certfp) { NSCertList *cl = nc->Require<NSCertList>("certificates"); - unsigned max = Config->GetModule(this->owner)->Get<unsigned>("max", "5"); + unsigned max = Config->GetModule(this->owner).Get<unsigned>("max", "5"); if (cl->GetCertCount() >= max) { @@ -325,7 +325,7 @@ public: source.Reply(ACCESS_DENIED); return; } - else if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) + else if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && source.GetAccount() != na->nc && na->nc->IsServicesOper() && !cmd.equals_ci("LIST")) { source.Reply(_("You may view but not modify the certificate list of other Services Operators.")); return; @@ -401,7 +401,7 @@ public: if (!nc || nc->HasExt("NS_SUSPENDED")) return; - unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins"); if (maxlogins && nc->users.size() >= maxlogins) { u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), nc->display.c_str(), maxlogins); @@ -420,7 +420,7 @@ public: void OnNickRegister(User *u, NickAlias *na, const Anope::string &pass) override { - if (!Config->GetModule(this)->Get<bool>("automatic", "yes") || !u || u->fingerprint.empty()) + if (!Config->GetModule(this).Get<bool>("automatic", "yes") || !u || u->fingerprint.empty()) return; auto *cl = certs.Require(na->nc); @@ -437,7 +437,7 @@ public: { BotInfo *NickServ = Config->GetClient("NickServ"); - unsigned int maxlogins = Config->GetModule("ns_identify")->Get<unsigned int>("maxlogins"); + unsigned int maxlogins = Config->GetModule("ns_identify").Get<unsigned int>("maxlogins"); if (maxlogins && na->nc->users.size() >= maxlogins) { u->SendMessage(NickServ, _("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); diff --git a/modules/nickserv/ns_drop.cpp b/modules/nickserv/ns_drop.cpp index 791db0bfb..f2e152ce8 100644 --- a/modules/nickserv/ns_drop.cpp +++ b/modules/nickserv/ns_drop.cpp @@ -51,13 +51,13 @@ public: return; } - if (Config->GetModule("nickserv")->Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper()) + if (Config->GetModule("nickserv").Get<bool>("secureadmins", "yes") && !is_mine && na->nc->IsServicesOper()) { source.Reply(_("You may not drop other Services Operators' nicknames.")); return; } - if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv")->Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display")) + if (na->nc->na == na && na->nc->aliases->size() > 1 && Config->GetModule("nickserv").Get<bool>("preservedisplay") && !source.HasPriv("nickserv/drop/display")) { source.Reply(_("You may not drop \002%s\002 as it is the display nick for the account."), na->nick.c_str()); return; diff --git a/modules/nickserv/ns_group.cpp b/modules/nickserv/ns_group.cpp index 47d8066e0..69df8d16e 100644 --- a/modules/nickserv/ns_group.cpp +++ b/modules/nickserv/ns_group.cpp @@ -138,7 +138,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks")) + if (Config->GetModule("nickserv").Get<bool>("restrictopernicks")) { for (auto *o : Oper::opers) { @@ -151,8 +151,8 @@ public: } NickAlias *target, *na = NickAlias::Find(source.GetNick()); - time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay"); - unsigned maxaliases = Config->GetModule(this->owner)->Get<unsigned>("maxaliases"); + time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay"); + unsigned maxaliases = Config->GetModule(this->owner).Get<unsigned>("maxaliases"); if (!(target = NickAlias::Find(nick))) source.Reply(NICK_X_NOT_REGISTERED, nick.c_str()); else if (user && Anope::CurTime < user->lastnickreg + reg_delay) @@ -165,7 +165,7 @@ public: Log(LOG_COMMAND, source, this) << "and tried to group to SUSPENDED nick " << target->nick; source.Reply(NICK_X_SUSPENDED, target->nick.c_str()); } - else if (na && Config->GetModule(this->owner)->Get<bool>("nogroupchange")) + else if (na && Config->GetModule(this->owner).Get<bool>("nogroupchange")) source.Reply(_("Your nick is already registered.")); else if (na && *target->nc == *na->nc) source.Reply(_("You are already a member of the group of \002%s\002."), target->nick.c_str()); @@ -336,8 +336,8 @@ public: ListFormatter list(source.GetAccount()); list.AddColumn(_("Nick")).AddColumn(_("Expires")); - time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "90d"), - unconfirmed_expire = Config->GetModule("ns_register")->Get<time_t>("unconfirmedexpire", "1d"); + time_t nickserv_expire = Config->GetModule("nickserv").Get<time_t>("expire", "90d"), + unconfirmed_expire = Config->GetModule("ns_register").Get<time_t>("unconfirmedexpire", "1d"); for (auto *na2 : *nc->aliases) { Anope::string expires; @@ -398,7 +398,7 @@ public: NSGroup(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsgroup(this), commandnsungroup(this), commandnsglist(this) { - if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership")) + if (Config->GetModule("nickserv").Get<bool>("nonicknameownership")) throw ModuleException(modname + " can not be used with options:nonicknameownership enabled"); } }; diff --git a/modules/nickserv/ns_identify.cpp b/modules/nickserv/ns_identify.cpp index c1f077ee5..44e6bb840 100644 --- a/modules/nickserv/ns_identify.cpp +++ b/modules/nickserv/ns_identify.cpp @@ -95,7 +95,7 @@ public: return; } - unsigned int maxlogins = Config->GetModule(this->owner)->Get<unsigned int>("maxlogins"); + unsigned int maxlogins = Config->GetModule(this->owner).Get<unsigned int>("maxlogins"); if (na && maxlogins && na->nc->users.size() >= maxlogins) { source.Reply(_("Account \002%s\002 has already reached the maximum number of simultaneous logins (%u)."), na->nc->display.c_str(), maxlogins); diff --git a/modules/nickserv/ns_list.cpp b/modules/nickserv/ns_list.cpp index c322d259b..5a5beacbd 100644 --- a/modules/nickserv/ns_list.cpp +++ b/modules/nickserv/ns_list.cpp @@ -30,7 +30,7 @@ public: bool is_servadmin = source.HasCommand("nickserv/list"); int count = 0, from = 0, to = 0; bool suspended, nsnoexpire, unconfirmed; - unsigned listmax = Config->GetModule(this->owner)->Get<unsigned>("listmax", "50"); + unsigned listmax = Config->GetModule(this->owner).Get<unsigned>("listmax", "50"); suspended = nsnoexpire = unconfirmed = false; @@ -164,7 +164,7 @@ public: " \002LIST #51-100\002\n" " Lists all registered nicks within the given range (51-100).")); - const Anope::string ®exengine = Config->GetBlock("options")->Get<const Anope::string>("regexengine"); + const Anope::string ®exengine = Config->GetBlock("options").Get<const Anope::string>("regexengine"); if (!regexengine.empty()) { source.Reply(" "); diff --git a/modules/nickserv/ns_maxemail.cpp b/modules/nickserv/ns_maxemail.cpp index 45409188d..ab18e4b54 100644 --- a/modules/nickserv/ns_maxemail.cpp +++ b/modules/nickserv/ns_maxemail.cpp @@ -38,7 +38,7 @@ class NSMaxEmail final bool CheckLimitReached(CommandSource &source, const Anope::string &email) { - int NSEmailMax = Config->GetModule(this)->Get<int>("maxemails"); + int NSEmailMax = Config->GetModule(this).Get<int>("maxemails"); if (NSEmailMax < 1 || email.empty()) return false; @@ -79,9 +79,9 @@ public: { } - void OnReload(Configuration::Conf *conf) override + void OnReload(Configuration::Conf &conf) override { - clean = conf->GetModule(this)->Get<bool>("remove_aliases", "true"); + clean = conf.GetModule(this).Get<bool>("remove_aliases", "true"); } EventReturn OnPreCommand(CommandSource &source, Command *command, std::vector<Anope::string> ¶ms) override diff --git a/modules/nickserv/ns_recover.cpp b/modules/nickserv/ns_recover.cpp index 8de4a9e40..062eb1dfc 100644 --- a/modules/nickserv/ns_recover.cpp +++ b/modules/nickserv/ns_recover.cpp @@ -71,7 +71,7 @@ public: Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->display; } - if (Config->GetModule("ns_recover")->Get<bool>("restoreonrecover")) + if (Config->GetModule("ns_recover").Get<bool>("restoreonrecover")) { if (!u->chans.empty()) { @@ -239,14 +239,14 @@ public: commandnsrecover(this), recover(this, "recover"), svsnick(this, "svsnick") { - if (Config->GetModule("nickserv")->Get<bool>("nonicknameownership")) + if (Config->GetModule("nickserv").Get<bool>("nonicknameownership")) throw ModuleException(modname + " can not be used with options:nonicknameownership enabled"); } void OnUserNickChange(User *u, const Anope::string &oldnick) override { - if (Config->GetModule(this)->Get<bool>("restoreonrecover")) + if (Config->GetModule(this).Get<bool>("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); BotInfo *NickServ = Config->GetClient("NickServ"); @@ -281,7 +281,7 @@ public: void OnJoinChannel(User *u, Channel *c) override { - if (Config->GetModule(this)->Get<bool>("restoreonrecover")) + if (Config->GetModule(this).Get<bool>("restoreonrecover")) { NSRecoverInfo *ei = recover.Get(u); diff --git a/modules/nickserv/ns_register.cpp b/modules/nickserv/ns_register.cpp index 38fa55ca5..8222f7ad3 100644 --- a/modules/nickserv/ns_register.cpp +++ b/modules/nickserv/ns_register.cpp @@ -56,7 +56,7 @@ public: NickAlias *u_na = NickAlias::Find(u->nick); /* Set +r if they're on a nick in the group */ - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc) + if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && u_na && *u_na->nc == *na->nc) u->SetMode(source.service, "REGISTERED"); } } @@ -79,7 +79,7 @@ public: if (na) { IRCD->SendLogin(source.GetUser(), na); - if (!Config->GetModule("nickserv")->Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED")) + if (!Config->GetModule("nickserv").Get<bool>("nonicknameownership") && na->nc == source.GetAccount() && !na->nc->HasExt("UNCONFIRMED")) source.GetUser()->SetMode(source.service, "REGISTERED"); } } @@ -124,7 +124,7 @@ public: CommandNSRegister(Module *creator) : Command(creator, "nickserv/register", 1, 2) { this->SetDesc(_("Register a nickname")); - if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes")) + if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes")) this->SetSyntax(_("\037password\037 \037email\037")); else this->SetSyntax(_("\037password\037 \037[email]\037")); @@ -137,7 +137,7 @@ public: Anope::string u_nick = source.GetNick(); Anope::string pass = params[0]; Anope::string email = params.size() > 1 ? params[1] : ""; - const Anope::string &nsregister = Config->GetModule(this->owner)->Get<const Anope::string>("registration"); + const Anope::string &nsregister = Config->GetModule(this->owner).Get<const Anope::string>("registration"); if (Anope::ReadOnly) { @@ -151,8 +151,8 @@ public: return; } - time_t nickregdelay = Config->GetModule(this->owner)->Get<time_t>("nickregdelay"); - time_t reg_delay = Config->GetModule("nickserv")->Get<time_t>("regdelay"); + time_t nickregdelay = Config->GetModule(this->owner).Get<time_t>("nickregdelay"); + time_t reg_delay = Config->GetModule("nickserv").Get<time_t>("regdelay"); if (u && !u->HasMode("OPER") && nickregdelay && Anope::CurTime - u->timestamp < nickregdelay) { auto waitperiod = (u->timestamp + nickregdelay) - Anope::CurTime; @@ -179,7 +179,7 @@ public: return; } - if (Config->GetModule("nickserv")->Get<bool>("restrictopernicks")) + if (Config->GetModule("nickserv").Get<bool>("restrictopernicks")) { for (auto *o : Oper::opers) { @@ -191,10 +191,10 @@ public: } } - unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10"); - unsigned int maxpasslen = Config->GetModule("nickserv")->Get<unsigned>("maxpasslen", "50"); + unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10"); + unsigned int maxpasslen = Config->GetModule("nickserv").Get<unsigned>("maxpasslen", "50"); - if (Config->GetModule("nickserv")->Get<bool>("forceemail", "yes") && email.empty()) + if (Config->GetModule("nickserv").Get<bool>("forceemail", "yes") && email.empty()) this->OnSyntaxError(source, ""); else if (u && Anope::CurTime < u->lastnickreg + reg_delay) { @@ -271,7 +271,7 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10"); + unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10"); this->SendSyntax(source); source.Reply(" "); source.Reply(_("Registers your nickname in the %s database. Once\n" @@ -294,7 +294,7 @@ public: source.service->nick.c_str(), source.service->nick.c_str(), minpasslen); - if (!Config->GetModule("nickserv")->Get<bool>("forceemail", "yes")) + if (!Config->GetModule("nickserv").Get<bool>("forceemail", "yes")) { source.Reply(" "); source.Reply(_("The \037email\037 parameter is optional and will set the email\n" @@ -322,7 +322,7 @@ public: void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override { - if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail")) { source.Reply(ACCESS_DENIED); return; @@ -336,7 +336,7 @@ public: source.Reply(_("Your account is already confirmed.")); else { - if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner)->Get<time_t>("resenddelay")) + if (Anope::CurTime < source.nc->lastmail + Config->GetModule(this->owner).Get<time_t>("resenddelay")) source.Reply(_("Cannot send mail now; please retry a little later.")); else if (SendRegmail(source.GetUser(), na, source.service)) { @@ -353,7 +353,7 @@ public: bool OnHelp(CommandSource &source, const Anope::string &subcommand) override { - if (!Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) + if (!Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail")) return false; this->SendSyntax(source); @@ -364,7 +364,7 @@ public: void OnServHelp(CommandSource &source) override { - if (Config->GetModule(this->owner)->Get<const Anope::string>("registration").equals_ci("mail")) + if (Config->GetModule(this->owner).Get<const Anope::string>("registration").equals_ci("mail")) Command::OnServHelp(source); } }; @@ -384,7 +384,7 @@ public: commandnsregister(this), commandnsconfirm(this), commandnsrsend(this), unconfirmed(this, "UNCONFIRMED"), passcode(this, "passcode") { - if (Config->GetModule(this)->Get<const Anope::string>("registration").equals_ci("disable")) + if (Config->GetModule(this).Get<const Anope::string>("registration").equals_ci("disable")) throw ModuleException("Module " + this->name + " will not load with registration disabled."); } @@ -393,14 +393,14 @@ public: BotInfo *NickServ; if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ"))) { - const Anope::string &nsregister = Config->GetModule(this)->Get<const Anope::string>("registration"); + const Anope::string &nsregister = Config->GetModule(this).Get<const Anope::string>("registration"); if (nsregister.equals_ci("admin")) u->SendMessage(NickServ, _("All new accounts must be validated by an administrator. Please wait for your registration to be confirmed.")); else u->SendMessage(NickServ, _("Your email address is not confirmed. To confirm it, follow the instructions that were emailed to you.")); const NickAlias *this_na = u->AccountNick(); time_t time_registered = Anope::CurTime - this_na->time_registered; - time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d"); if (unconfirmed_expire > time_registered) u->SendMessage(NickServ, _("Your account will expire, if not confirmed, in %s."), Anope::Duration(unconfirmed_expire - time_registered, u->Account()).c_str()); } @@ -410,7 +410,7 @@ public: { if (unconfirmed.HasExt(na->nc)) { - time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d"); + time_t unconfirmed_expire = Config->GetModule(this).Get<time_t>("unconfirmedexpire", "1d"); if (unconfirmed_expire && Anope::CurTime - na->time_registered >= unconfirmed_expire) expire = true; } @@ -428,15 +428,15 @@ static bool SendRegmail(User *u, const NickAlias *na, BotInfo *bi) *code = Anope::Random(15); } - Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_subject").c_str()), - message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("registration_message").c_str()); + Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_subject").c_str()), + message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("registration_message").c_str()); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname")); subject = subject.replace_all_cs("%c", *code); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname")); message = message.replace_all_cs("%c", *code); return Mail::Send(u, nc, bi, subject, message); diff --git a/modules/nickserv/ns_resetpass.cpp b/modules/nickserv/ns_resetpass.cpp index fbb8d1540..52dd4e139 100644 --- a/modules/nickserv/ns_resetpass.cpp +++ b/modules/nickserv/ns_resetpass.cpp @@ -73,7 +73,7 @@ public: NSResetPass(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR), commandnsresetpass(this), reset(this, "reset") { - if (!Config->GetBlock("mail")->Get<bool>("usemail")) + if (!Config->GetBlock("mail").Get<bool>("usemail")) throw ModuleException("Not using mail."); } @@ -132,16 +132,16 @@ public: static bool SendResetEmail(User *u, const NickAlias *na, BotInfo *bi) { - Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_subject").c_str()), - message = Language::Translate(na->nc, Config->GetBlock("mail")->Get<const Anope::string>("reset_message").c_str()), + Anope::string subject = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_subject").c_str()), + message = Language::Translate(na->nc, Config->GetBlock("mail").Get<const Anope::string>("reset_message").c_str()), passcode = Anope::Random(20); subject = subject.replace_all_cs("%n", na->nick); - subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); + subject = subject.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname")); subject = subject.replace_all_cs("%c", passcode); message = message.replace_all_cs("%n", na->nick); - message = message.replace_all_cs("%N", Config->GetBlock("networkinfo")->Get<const Anope::string>("networkname")); + message = message.replace_all_cs("%N", Config->GetBlock("networkinfo").Get<const Anope::string>("networkname")); message = message.replace_all_cs("%c", passcode); ResetInfo *ri = na->nc->Extend<ResetInfo>("reset"); diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp index a1291fe26..b9d489ee3 100644 --- a/modules/nickserv/ns_set.cpp +++ b/modules/nickserv/ns_set.cpp @@ -34,8 +34,8 @@ public: source.Reply(_("Sets various nickname options. \037option\037 can be one of:")); Anope::string this_name = source.command; - bool hide_privileged_commands = Config->GetBlock("options")->Get<bool>("hideprivilegedcommands"), - hide_registered_commands = Config->GetBlock("options")->Get<bool>("hideregisteredcommands"); + bool hide_privileged_commands = Config->GetBlock("options").Get<bool>("hideprivilegedcommands"), + hide_registered_commands = Config->GetBlock("options").Get<bool>("hideregisteredcommands"); for (const auto &[c_name, info] : source.service->commands) { if (c_name.find_ci(this_name + " ") == 0) @@ -134,14 +134,14 @@ public: return; } - unsigned int minpasslen = Config->GetModule("nickserv")->Get<unsigned>("minpasslen", "10"); + unsigned int minpasslen = Config->GetModule("nickserv").Get<unsigned>("minpasslen", "10"); if (len < minpasslen) { source.Reply(PASSWORD_TOO_SHORT, minpasslen); return; } |
