summaryrefslogtreecommitdiff
path: root/modules/nickserv/nickserv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nickserv/nickserv.cpp')
-rw-r--r--modules/nickserv/nickserv.cpp56
1 files changed, 28 insertions, 28 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());
}
}