summaryrefslogtreecommitdiff
path: root/modules/nickserv
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-11-25 16:35:10 -0500
committerAdam <Adam@anope.org>2016-11-25 16:35:56 -0500
commita635344582a13d935631fbe930d79d3788359c8a (patch)
treecd7b372d02f94c7f6c18542e06d29deff0f19842 /modules/nickserv
parentf30d99f81f6fb8abd7ca555068173bad6c99e07a (diff)
Rename most ext fields names to be consistent with everything else, add accessors for many
Diffstat (limited to 'modules/nickserv')
-rw-r--r--modules/nickserv/ajoin.cpp12
-rw-r--r--modules/nickserv/alist.cpp6
-rw-r--r--modules/nickserv/cert.cpp8
-rw-r--r--modules/nickserv/group.cpp4
-rw-r--r--modules/nickserv/info.cpp26
-rw-r--r--modules/nickserv/list.cpp22
-rw-r--r--modules/nickserv/main/account.cpp170
-rw-r--r--modules/nickserv/main/account.h63
-rw-r--r--modules/nickserv/main/accounttype.cpp17
-rw-r--r--modules/nickserv/main/accounttype.h4
-rw-r--r--modules/nickserv/main/nick.cpp14
-rw-r--r--modules/nickserv/main/nick.h4
-rw-r--r--modules/nickserv/main/nickserv.cpp32
-rw-r--r--modules/nickserv/main/nicktype.cpp3
-rw-r--r--modules/nickserv/main/nicktype.h4
-rw-r--r--modules/nickserv/recover.cpp6
-rw-r--r--modules/nickserv/register.cpp22
-rw-r--r--modules/nickserv/resetpass.cpp2
-rw-r--r--modules/nickserv/set.cpp80
-rw-r--r--modules/nickserv/set_misc.cpp2
-rw-r--r--modules/nickserv/suspend.cpp4
21 files changed, 374 insertions, 131 deletions
diff --git a/modules/nickserv/ajoin.cpp b/modules/nickserv/ajoin.cpp
index 98d93e8fe..91039a019 100644
--- a/modules/nickserv/ajoin.cpp
+++ b/modules/nickserv/ajoin.cpp
@@ -32,8 +32,8 @@ class AutoJoinImpl : public AutoJoin
AutoJoinImpl(Serialize::TypeBase *type) : AutoJoin(type) { }
AutoJoinImpl(Serialize::TypeBase *type, Serialize::ID id) : AutoJoin(type, id) { }
- NickServ::Account *GetOwner() override;
- void SetOwner(NickServ::Account *acc) override;
+ NickServ::Account *GetAccount() override;
+ void SetAccount(NickServ::Account *acc) override;
Anope::string GetChannel() override;
void SetChannel(const Anope::string &c) override;
@@ -49,19 +49,19 @@ class AutoJoinType : public Serialize::Type<AutoJoinImpl>
Serialize::Field<AutoJoinImpl, Anope::string> channel, key;
AutoJoinType(Module *me) : Serialize::Type<AutoJoinImpl>(me)
- , owner(this, "owner", &AutoJoinImpl::account, true)
+ , owner(this, "account", &AutoJoinImpl::account, true)
, channel(this, "channel", &AutoJoinImpl::channel)
, key(this, "key", &AutoJoinImpl::key)
{
}
};
-NickServ::Account *AutoJoinImpl::GetOwner()
+NickServ::Account *AutoJoinImpl::GetAccount()
{
return Get(&AutoJoinType::owner);
}
-void AutoJoinImpl::SetOwner(NickServ::Account *acc)
+void AutoJoinImpl::SetAccount(NickServ::Account *acc)
{
Set(&AutoJoinType::owner, acc);
}
@@ -158,7 +158,7 @@ class CommandNSAJoin : public Command
}
AutoJoin *entry = Serialize::New<AutoJoin *>();
- entry->SetOwner(nc);
+ entry->SetAccount(nc);
entry->SetChannel(chan);
entry->SetKey(key);
diff --git a/modules/nickserv/alist.cpp b/modules/nickserv/alist.cpp
index 3c8b573b0..cdb862436 100644
--- a/modules/nickserv/alist.cpp
+++ b/modules/nickserv/alist.cpp
@@ -66,7 +66,7 @@ class CommandNSAList : public Command
{
++chan_count;
entry["Number"] = stringify(chan_count);
- entry["Channel"] = (ci->HasFieldS("CS_NO_EXPIRE") ? "!" : "") + ci->GetName();
+ entry["Channel"] = (ci->IsNoExpire() ? "!" : "") + ci->GetName();
entry["Access"] = Language::Translate(source.GetAccount(), _("Founder"));
entry["Description"] = ci->GetDesc();
list.AddEntry(entry);
@@ -77,7 +77,7 @@ class CommandNSAList : public Command
{
++chan_count;
entry["Number"] = stringify(chan_count);
- entry["Channel"] = (ci->HasFieldS("CS_NO_EXPIRE") ? "!" : "") + ci->GetName();
+ entry["Channel"] = (ci->IsNoExpire() ? "!" : "") + ci->GetName();
entry["Access"] = Language::Translate(source.GetAccount(), _("Successor"));
entry["Description"] = ci->GetDesc();
list.AddEntry(entry);
@@ -91,7 +91,7 @@ class CommandNSAList : public Command
++chan_count;
entry["Number"] = stringify(chan_count);
- entry["Channel"] = (ci->HasFieldS("CS_NO_EXPIRE") ? "!" : "") + ci->GetName();
+ entry["Channel"] = (ci->IsNoExpire() ? "!" : "") + ci->GetName();
for (unsigned j = 0; j < access.size(); ++j)
entry["Access"] = entry["Access"] + ", " + access[j]->AccessSerialize();
entry["Access"] = entry["Access"].substr(2);
diff --git a/modules/nickserv/cert.cpp b/modules/nickserv/cert.cpp
index f84d32cea..f58515d70 100644
--- a/modules/nickserv/cert.cpp
+++ b/modules/nickserv/cert.cpp
@@ -86,7 +86,7 @@ class NSCertEntryType : public Serialize::Type<NSCertEntryImpl>
if (!cert.empty())
certmap[cert] = acc;
}
- } nc;
+ } account;
struct Mask : Serialize::Field<NSCertEntryImpl, Anope::string>
{
@@ -104,7 +104,7 @@ class NSCertEntryType : public Serialize::Type<NSCertEntryImpl>
} mask;
NSCertEntryType(Module *me) : Serialize::Type<NSCertEntryImpl>(me)
- , nc(this, "nc", &NSCertEntryImpl::account, true)
+ , account(this, "account", &NSCertEntryImpl::account, true)
, mask(this, "mask", &NSCertEntryImpl::cert)
{
}
@@ -119,12 +119,12 @@ NSCertEntryImpl::~NSCertEntryImpl()
NickServ::Account *NSCertEntryImpl::GetAccount()
{
- return Get<NickServ::Account *>(&NSCertEntryType::nc);
+ return Get<NickServ::Account *>(&NSCertEntryType::account);
}
void NSCertEntryImpl::SetAccount(NickServ::Account *nc)
{
- Set(&NSCertEntryType::nc, nc);
+ Set(&NSCertEntryType::account, nc);
}
Anope::string NSCertEntryImpl::GetCert()
diff --git a/modules/nickserv/group.cpp b/modules/nickserv/group.cpp
index ea62a9012..f5afb272e 100644
--- a/modules/nickserv/group.cpp
+++ b/modules/nickserv/group.cpp
@@ -329,11 +329,11 @@ class CommandNSGList : public Command
for (NickServ::Nick *na2 : nc->GetRefs<NickServ::Nick *>())
{
Anope::string expires;
- if (na2->HasFieldS("NS_NO_EXPIRE"))
+ if (na2->IsNoExpire())
expires = _("Does not expire");
else if (!nickserv_expire || Anope::NoExpire)
;
- else if (na2->GetAccount()->HasFieldS("UNCONFIRMED") && unconfirmed_expire)
+ else if (na2->GetAccount()->IsUnconfirmed() && unconfirmed_expire)
expires = Anope::strftime(na2->GetTimeRegistered() + unconfirmed_expire, source.GetAccount());
else
expires = Anope::strftime(na2->GetLastSeen() + nickserv_expire, source.GetAccount());
diff --git a/modules/nickserv/info.cpp b/modules/nickserv/info.cpp
index 08614315e..0fd4169e9 100644
--- a/modules/nickserv/info.cpp
+++ b/modules/nickserv/info.cpp
@@ -62,10 +62,10 @@ class CommandNSInfo : public Command
source.Reply(_("\002{0}\002 is \002{1}\002"), na->GetNick(), na->GetLastRealname());
- if (na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (na->GetAccount()->IsUnconfirmed())
source.Reply(_("\002{0}\002 has not confirmed their account."), na->GetNick());
- if (na->GetAccount()->GetOper() && (show_hidden || !na->GetAccount()->HasFieldS("HIDE_STATUS")))
+ if (na->GetAccount()->GetOper() && (show_hidden || !na->GetAccount()->IsHideStatus()))
source.Reply(_("\002{0}\002 is a Services Operator of type \002{1}\002."), na->GetNick(), na->GetAccount()->GetOper()->GetType()->GetName());
InfoFormatter info(source.nc);
@@ -78,7 +78,7 @@ class CommandNSInfo : public Command
info[_("Online from")] = na->GetLastRealhost();
shown = true;
}
- if ((show_hidden || !na->GetAccount()->HasFieldS("HIDE_MASK")) && (!shown || na->GetLastUsermask() != na->GetLastRealhost()))
+ if ((show_hidden || !na->GetAccount()->IsHideMask()) && (!shown || na->GetLastUsermask() != na->GetLastRealhost()))
info[_("Online from")] = na->GetLastUsermask();
else
source.Reply(_("\002{0}\002 is currently online."), na->GetNick());
@@ -86,7 +86,7 @@ class CommandNSInfo : public Command
else
{
Anope::string shown;
- if (show_hidden || !na->GetAccount()->HasFieldS("HIDE_MASK"))
+ if (show_hidden || !na->GetAccount()->IsHideMask())
{
info[_("Last seen address")] = na->GetLastUsermask();
shown = na->GetLastUsermask();
@@ -101,10 +101,10 @@ class CommandNSInfo : public Command
if (!nick_online)
info[_("Last seen")] = Anope::strftime(na->GetLastSeen(), source.GetAccount());
- if (!na->GetLastQuit().empty() && (show_hidden || !na->GetAccount()->HasFieldS("HIDE_QUIT")))
+ if (!na->GetLastQuit().empty() && (show_hidden || !na->GetAccount()->IsHideQuit()))
info[_("Last quit message")] = na->GetLastQuit();
- if (!na->GetAccount()->GetEmail().empty() && (show_hidden || !na->GetAccount()->HasFieldS("HIDE_EMAIL")))
+ if (!na->GetAccount()->GetEmail().empty() && (show_hidden || !na->GetAccount()->IsHideEmail()))
info[_("Email address")] = na->GetAccount()->GetEmail();
EventManager::Get()->Dispatch(&Event::NickInfo::OnNickInfo, source, na, info, show_hidden);
@@ -164,25 +164,25 @@ class CommandNSSetHide : public Command
if (param.equals_ci("EMAIL"))
{
- flag = "HIDE_EMAIL";
+ flag = "hide_email";
onmsg = _("The \002e-mail address\002 of \002{0}\002 will now be \002hidden\002.");
offmsg = _("The \002e-mail address\002 of \002{0}\002 will now be \002shown\002.");
}
else if (param.equals_ci("USERMASK"))
{
- flag = "HIDE_MASK";
+ flag = "hide_mask";
onmsg = _("The \002last seen host mask\002 of \002{0}\002 will now be \002hidden\002.");
offmsg = _("The \002last seen host mask\002 of \002{0}\002 will now be \002shown\002.");
}
else if (param.equals_ci("STATUS"))
{
- flag = "HIDE_STATUS";
+ flag = "hide_status";
onmsg = _("The \002services operator status\002 of \002{0}\002 will now be \002hidden\002.");
offmsg = _("The \002services operator status\002 of \002{0}\002 will now be \002shown\002.");
}
else if (param.equals_ci("QUIT"))
{
- flag = "HIDE_QUIT";
+ flag = "hide_quit";
onmsg = _("The \002last quit message\002 of \002{0}\002 will now be \002hidden\002.");
offmsg = _("The \002last quit message\002 of \002{0}\002 will now be \002shown\002.");
}
@@ -254,17 +254,11 @@ class NSInfo : public Module
CommandNSSetHide commandnssethide;
CommandNSSASetHide commandnssasethide;
- Serialize::Field<NickServ::Account, bool> hide_email, hide_usermask, hide_status, hide_quit;
-
public:
NSInfo(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, commandnsinfo(this)
, commandnssethide(this)
, commandnssasethide(this)
- , hide_email(this, "HIDE_EMAIL")
- , hide_usermask(this, "HIDE_MASK")
- , hide_status(this, "HIDE_STATUS")
- , hide_quit(this, "HIDE_QUIT")
{
}
diff --git a/modules/nickserv/list.cpp b/modules/nickserv/list.cpp
index 4b4a12d36..735df7d7d 100644
--- a/modules/nickserv/list.cpp
+++ b/modules/nickserv/list.cpp
@@ -84,7 +84,6 @@ class CommandNSList : public Command
list.AddColumn(_("Nick")).AddColumn(_("Last usermask"));
- // XXX wtf
Anope::map<NickServ::Nick *> ordered_map;
for (NickServ::Nick *na : NickServ::service->GetNickList())
ordered_map[na->GetNick()] = na;
@@ -94,13 +93,13 @@ class CommandNSList : public Command
NickServ::Nick *na = it->second;
/* Don't show private nicks to non-services admins. */
- if (na->GetAccount()->HasFieldS("NS_PRIVATE") && !is_servadmin && na->GetAccount() != mync)
+ if (na->GetAccount()->IsPrivate() && !is_servadmin && na->GetAccount() != mync)
continue;
- else if (nsnoexpire && !na->HasFieldS("NS_NO_EXPIRE"))
+ else if (nsnoexpire && !na->IsNoExpire())
continue;
else if (suspended && !na->GetAccount()->HasFieldS("NS_SUSPENDED"))
continue;
- else if (unconfirmed && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ else if (unconfirmed && !na->GetAccount()->IsUnconfirmed())
continue;
/* We no longer compare the pattern against the output buffer.
@@ -112,16 +111,16 @@ class CommandNSList : public Command
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nnicks <= listmax)
{
bool isnoexpire = false;
- if (is_servadmin && na->HasFieldS("NS_NO_EXPIRE"))
+ if (is_servadmin && na->IsNoExpire())
isnoexpire = true;
ListFormatter::ListEntry entry;
entry["Nick"] = (isnoexpire ? "!" : "") + na->GetNick();
- if (na->GetAccount()->HasFieldS("HIDE_MASK") && !is_servadmin && na->GetAccount() != mync)
+ if (na->GetAccount()->IsHideMask() && !is_servadmin && na->GetAccount() != mync)
entry["Last usermask"] = Language::Translate(source.GetAccount(), _("[Hostname hidden]"));
else if (na->GetAccount()->HasFieldS("NS_SUSPENDED"))
entry["Last usermask"] = Language::Translate(source.GetAccount(), _("[Suspended]"));
- else if (na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ else if (na->GetAccount()->IsUnconfirmed())
entry["Last usermask"] = Language::Translate(source.GetAccount(), _("[Unconfirmed]"));
else
entry["Last usermask"] = na->GetLastUsermask();
@@ -215,13 +214,13 @@ class CommandNSSetPrivate : public Command
if (param.equals_ci("ON"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable private for " << nc->GetDisplay();
- nc->SetS<bool>("NS_PRIVATE", true);
+ nc->SetPrivate(true);
source.Reply(_("Private option is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable private for " << nc->GetDisplay();
- nc->UnsetS<bool>("NS_PRIVATE");
+ nc->SetPrivate(true);
source.Reply(_("Private option is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
else
@@ -274,15 +273,12 @@ class NSList : public Module
CommandNSSetPrivate commandnssetprivate;
CommandNSSASetPrivate commandnssasetprivate;
- Serialize::Field<NickServ::Account, bool> priv;
-
public:
NSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, EventHook<Event::NickInfo>(this)
, commandnslist(this)
, commandnssetprivate(this)
, commandnssasetprivate(this)
- , priv(this, "NS_PRIVATE")
{
}
@@ -291,7 +287,7 @@ class NSList : public Module
if (!show_all)
return;
- if (priv.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsPrivate())
info.AddOption(_("Private"));
}
};
diff --git a/modules/nickserv/main/account.cpp b/modules/nickserv/main/account.cpp
index 1cd868194..fa6de8455 100644
--- a/modules/nickserv/main/account.cpp
+++ b/modules/nickserv/main/account.cpp
@@ -92,6 +92,176 @@ MemoServ::MemoInfo *AccountImpl::GetMemos()
return GetRef<MemoServ::MemoInfo *>();
}
+Anope::string AccountImpl::GetGreet()
+{
+ return Get(&AccountType::greet);
+}
+
+void AccountImpl::SetGreet(const Anope::string &greet)
+{
+ Set(&AccountType::greet, greet);
+}
+
+bool AccountImpl::IsUnconfirmed()
+{
+ return Get(&AccountType::unconfirmed);
+}
+
+void AccountImpl::SetUnconfirmed(bool unconfirmed)
+{
+ Set(&AccountType::greet, unconfirmed);
+}
+
+bool AccountImpl::IsPrivate()
+{
+ return Get(&AccountType::_private);
+}
+
+void AccountImpl::SetPrivate(bool _private)
+{
+ Set(&AccountType::_private, _private);
+}
+
+bool AccountImpl::IsAutoOp()
+{
+ return Get(&AccountType::autoop);
+}
+
+void AccountImpl::SetAutoOp(bool autoop)
+{
+ Set(&AccountType::autoop, autoop);
+}
+
+bool AccountImpl::IsKeepModes()
+{
+ return Get(&AccountType::keepmodes);
+}
+
+void AccountImpl::SetKeepModes(bool keepmodes)
+{
+ Set(&AccountType::keepmodes, keepmodes);
+}
+
+bool AccountImpl::IsKillProtect()
+{
+ return Get(&AccountType::killprotect);
+}
+
+void AccountImpl::SetKillProtect(bool killprotect)
+{
+ Set(&AccountType::killprotect, killprotect);
+}
+
+bool AccountImpl::IsKillQuick()
+{
+ return Get(&AccountType::killquick);
+}
+
+void AccountImpl::SetKillQuick(bool killquick)
+{
+ Set(&AccountType::killquick, killquick);
+}
+
+bool AccountImpl::IsKillImmed()
+{
+ return Get(&AccountType::killimmed);
+}
+
+void AccountImpl::SetKillImmed(bool killimmed)
+{
+ Set(&AccountType::killimmed, killimmed);
+}
+
+bool AccountImpl::IsMsg()
+{
+ return Get(&AccountType::msg);
+}
+
+void AccountImpl::SetMsg(bool msg)
+{
+ Set(&AccountType::msg, msg);
+}
+
+bool AccountImpl::IsSecure()
+{
+ return Get(&AccountType::secure);
+}
+
+void AccountImpl::SetSecure(bool secure)
+{
+ Set(&AccountType::secure, secure);
+}
+
+bool AccountImpl::IsMemoSignon()
+{
+ return Get(&AccountType::memosignon);
+}
+
+void AccountImpl::SetMemoSignon(bool memosignon)
+{
+ Set(&AccountType::memosignon, memosignon);
+}
+
+bool AccountImpl::IsMemoReceive()
+{
+ return Get(&AccountType::memoreceive);
+}
+
+void AccountImpl::SetMemoReceive(bool memoreceive)
+{
+ Set(&AccountType::memoreceive, memoreceive);
+}
+
+bool AccountImpl::IsMemoMail()
+{
+ return Get(&AccountType::memomail);
+}
+
+void AccountImpl::SetMemoMail(bool memomail)
+{
+ Set(&AccountType::memomail, memomail);
+}
+
+bool AccountImpl::IsHideEmail()
+{
+ return Get(&AccountType::hideemail);
+}
+
+void AccountImpl::SetHideEmail(bool hideemail)
+{
+ Set(&AccountType::hideemail, hideemail);
+}
+
+bool AccountImpl::IsHideMask()
+{
+ return Get(&AccountType::hidemask);
+}
+
+void AccountImpl::SetHideMask(bool hidemask)
+{
+ Set(&AccountType::hidemask, hidemask);
+}
+
+bool AccountImpl::IsHideStatus()
+{
+ return Get(&AccountType::hidestatus);
+}
+
+void AccountImpl::SetHideStatus(bool hidestatus)
+{
+ Set(&AccountType::hidestatus, hidestatus);
+}
+
+bool AccountImpl::IsHideQuit()
+{
+ return Get(&AccountType::hidequit);
+}
+
+void AccountImpl::SetHideQuit(bool hidequit)
+{
+ Set(&AccountType::hidequit, hidequit);
+}
+
void AccountImpl::SetDisplay(NickServ::Nick *na)
{
if (na->GetAccount() != this || na->GetNick() == this->GetDisplay())
diff --git a/modules/nickserv/main/account.h b/modules/nickserv/main/account.h
index 611233261..928213666 100644
--- a/modules/nickserv/main/account.h
+++ b/modules/nickserv/main/account.h
@@ -25,6 +25,18 @@ class AccountImpl : public NickServ::Account
Anope::string display, password, email, language;
Oper *oper = nullptr;
+ Anope::string greet;
+ bool unconfirmed = false;
+ bool _private = false;
+ bool autoop = false;
+ bool keepmodes = false;
+ bool killprotect = false;
+ bool killquick = false;
+ bool killimmed = false;
+ bool msg = false;
+ bool secure = false;
+ bool memosignon = false, memoreceive = false, memomail = false;
+ bool hideemail = false, hidemask = false, hidestatus = false, hidequit = false;
public:
using NickServ::Account::Account;
@@ -46,6 +58,57 @@ class AccountImpl : public NickServ::Account
Oper *GetOper() override;
void SetOper(Oper *) override;
+ Anope::string GetGreet() override;
+ void SetGreet(const Anope::string &) override;
+
+ bool IsUnconfirmed() override;
+ void SetUnconfirmed(bool) override;
+
+ bool IsPrivate() override;
+ void SetPrivate(bool) override;
+
+ bool IsAutoOp() override;
+ void SetAutoOp(bool) override;
+
+ bool IsKeepModes() override;
+ void SetKeepModes(bool) override;
+
+ bool IsKillProtect() override;
+ void SetKillProtect(bool) override;
+
+ bool IsKillQuick() override;
+ void SetKillQuick(bool) override;
+
+ bool IsKillImmed() override;
+ void SetKillImmed(bool) override;
+
+ bool IsMsg() override;
+ void SetMsg(bool) override;
+
+ bool IsSecure() override;
+ void SetSecure(bool) override;
+
+ bool IsMemoSignon() override;
+ void SetMemoSignon(bool) override;
+
+ bool IsMemoReceive() override;
+ void SetMemoReceive(bool) override;
+
+ bool IsMemoMail() override;
+ void SetMemoMail(bool) override;
+
+ bool IsHideEmail() override;
+ void SetHideEmail(bool) override;
+
+ bool IsHideMask() override;
+ void SetHideMask(bool) override;
+
+ bool IsHideStatus() override;
+ void SetHideStatus(bool) override;
+
+ bool IsHideQuit() override;
+ void SetHideQuit(bool) override;
+
MemoServ::MemoInfo *GetMemos() override;
void SetDisplay(NickServ::Nick *na) override;
diff --git a/modules/nickserv/main/accounttype.cpp b/modules/nickserv/main/accounttype.cpp
index ec37c18d4..ccc02726a 100644
--- a/modules/nickserv/main/accounttype.cpp
+++ b/modules/nickserv/main/accounttype.cpp
@@ -26,6 +26,23 @@ AccountType::AccountType(Module *me) : Serialize::Type<AccountImpl>(me)
, email(this, "email", &AccountImpl::email)
, language(this, "language", &AccountImpl::language)
, oper(this, "oper", &AccountImpl::oper)
+ , greet(this, "greet", &AccountImpl::greet)
+ , unconfirmed(this, "unconfirmed", &AccountImpl::unconfirmed)
+ , _private(this, "private", &AccountImpl::_private)
+ , autoop(this, "autoop", &AccountImpl::autoop)
+ , keepmodes(this, "keepmodes", &AccountImpl::keepmodes)
+ , killprotect(this, "killprotect", &AccountImpl::killprotect)
+ , killquick(this, "killquick", &AccountImpl::killquick)
+ , killimmed(this, "killimmed", &AccountImpl::killimmed)
+ , msg(this, "msg", &AccountImpl::msg)
+ , secure(this, "secure", &AccountImpl::secure)
+ , memosignon(this, "memo_signon", &AccountImpl::memosignon)
+ , memoreceive(this, "memo_receive", &AccountImpl::memoreceive)
+ , memomail(this, "memo_mail", &AccountImpl::memomail)
+ , hideemail(this, "hide_email", &AccountImpl::hideemail)
+ , hidemask(this, "hide_mask", &AccountImpl::hidemask)
+ , hidestatus(this, "hide_status", &AccountImpl::hidestatus)
+ , hidequit(this, "hide_quit", &AccountImpl::hidequit)
{
}
diff --git a/modules/nickserv/main/accounttype.h b/modules/nickserv/main/accounttype.h
index 8e831ed2c..f8d6a31a5 100644
--- a/modules/nickserv/main/accounttype.h
+++ b/modules/nickserv/main/accounttype.h
@@ -35,6 +35,10 @@ class AccountType : public Serialize::Type<AccountImpl>
/* Locale name of the language of the user. Empty means default language */
Serialize::Field<AccountImpl, Anope::string> language;
Serialize::ObjectField<AccountImpl, Oper *> oper;
+ Serialize::Field<AccountImpl, Anope::string> greet;
+ Serialize::Field<AccountImpl, bool> unconfirmed, _private, autoop, keepmodes,
+ killprotect, killquick, killimmed, msg, secure, memosignon, memoreceive,
+ memomail, hideemail, hidemask, hidestatus, hidequit;
AccountType(Module *);
diff --git a/modules/nickserv/main/nick.cpp b/modules/nickserv/main/nick.cpp
index 0f94e63af..1efa37a2b 100644
--- a/modules/nickserv/main/nick.cpp
+++ b/modules/nickserv/main/nick.cpp
@@ -128,11 +128,21 @@ void NickImpl::SetLastSeen(const time_t &ls)
NickServ::Account *NickImpl::GetAccount()
{
- return Get(&NickType::nc);
+ return Get(&NickType::account);
}
void NickImpl::SetAccount(NickServ::Account *acc)
{
- Set(&NickType::nc, acc);
+ Set(&NickType::account, acc);
+}
+
+bool NickImpl::IsNoExpire()
+{
+ return Get(&NickType::noexpire);
+}
+
+void NickImpl::SetNoExpire(bool noexpire)
+{
+ Set(&NickType::noexpire, noexpire);
}
diff --git a/modules/nickserv/main/nick.h b/modules/nickserv/main/nick.h
index 69f47efe8..9df205fb9 100644
--- a/modules/nickserv/main/nick.h
+++ b/modules/nickserv/main/nick.h
@@ -24,6 +24,7 @@ class NickImpl : public NickServ::Nick
NickServ::Account *account = nullptr;
Anope::string nick, last_quit, last_realname, last_usermask, last_realhost;
time_t time_registered = 0, last_seen = 0;
+ bool noexpire = false;
public:
NickImpl(Serialize::TypeBase *type) : NickServ::Nick(type) { }
@@ -54,4 +55,7 @@ class NickImpl : public NickServ::Nick
NickServ::Account *GetAccount() override;
void SetAccount(NickServ::Account *acc) override;
+
+ bool IsNoExpire() override;
+ void SetNoExpire(bool) override;
};
diff --git a/modules/nickserv/main/nickserv.cpp b/modules/nickserv/main/nickserv.cpp
index c41f3b3f3..60b136db1 100644
--- a/modules/nickserv/main/nickserv.cpp
+++ b/modules/nickserv/main/nickserv.cpp
@@ -244,7 +244,7 @@ class NickServCore : public Module, public NickServ::NickServService
if (MOD_RESULT == EVENT_ALLOW)
return;
- if (!na->GetAccount()->HasFieldS("NS_SECURE") && u->IsRecognized())
+ if (!na->GetAccount()->IsSecure() && u->IsRecognized())
{
na->SetLastSeen(Anope::CurTime);
na->SetLastUsermask(u->GetIdent() + "@" + u->GetDisplayedHost());
@@ -257,21 +257,21 @@ class NickServCore : public Module, public NickServ::NickServService
bool on_access = u->IsRecognized(false);
- if (on_access || !na->GetAccount()->HasFieldS("KILL_IMMED"))
+ if (on_access || !na->GetAccount()->IsKillImmed())
{
- if (na->GetAccount()->HasFieldS("NS_SECURE"))
+ if (na->GetAccount()->IsSecure())
u->SendMessage(*NickServ, _("This nickname is registered and protected. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX
else
u->SendMessage(*NickServ, _("This nickname is owned by someone else. If this is your nickname, type \002{0}{1} IDENTIFY \037password\037\002. Otherwise, please choose a different nickname."), Config->StrictPrivmsg, NickServ->nick); // XXX
}
- if (na->GetAccount()->HasFieldS("KILLPROTECT") && !on_access)
+ if (na->GetAccount()->IsKillProtect() && !on_access)
{
- if (na->GetAccount()->HasFieldS("KILL_IMMED"))
+ if (na->GetAccount()->IsKillImmed())
{
u->SendMessage(*NickServ, _("This nickname has been registered; you may not use it."));
this->Collide(u, na);
}
- else if (na->GetAccount()->HasFieldS("KILL_QUICK"))
+ else if (na->GetAccount()->IsKillQuick())
{
time_t killquick = Config->GetModule("nickserv/main")->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());
@@ -290,7 +290,7 @@ class NickServCore : public Module, public NickServ::NickServService
void OnUserLogin(User *u) override
{
NickServ::Nick *na = NickServ::FindNick(u->nick);
- if (na && na->GetAccount() == u->Account() && !Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (na && na->GetAccount() == u->Account() && !Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && !na->GetAccount()->IsUnconfirmed())
u->SetMode(NickServ, "REGISTERED");
const Anope::string &modesonid = Config->GetModule(this)->Get<Anope::string>("modesonid");
@@ -406,13 +406,9 @@ class NickServCore : public Module, public NickServ::NickServService
NickServ = bi;
- spacesepstream(conf->GetModule(this)->Get<Anope::string>("defaults", "ns_secure memo_signon memo_receive")).GetTokens(defaults);
+ spacesepstream(conf->GetModule(this)->Get<Anope::string>("defaults", "secure memo_signon memo_receive")).GetTokens(defaults);
if (defaults.empty())
- {
- defaults.push_back("NS_SECURE");
- defaults.push_back("MEMO_SIGNON");
- defaults.push_back("MEMO_RECEIVE");
- }
+ defaults = { "secure", "memo_signon", "memo_receive" };
else if (defaults[0].equals_ci("none"))
defaults.clear();
}
@@ -489,7 +485,7 @@ class NickServCore : public Module, public NickServ::NickServService
void OnNickGroup(User *u, NickServ::Nick *target) override
{
- if (!target->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (!target->GetAccount()->IsUnconfirmed())
u->SetMode(NickServ, "REGISTERED");
}
@@ -557,7 +553,7 @@ class NickServCore : public Module, public NickServ::NickServService
{
/* Reset +r and re-send account (even though it really should be set at this point) */
IRCD->SendLogin(u, na);
- if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == u->Account() && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == u->Account() && !na->GetAccount()->IsUnconfirmed())
u->SetMode(NickServ, "REGISTERED");
Log(u, "", NickServ) << u->GetMask() << " automatically identified for group " << u->Account()->GetDisplay();
}
@@ -620,7 +616,7 @@ class NickServCore : public Module, public NickServ::NickServService
{
/* Set default flags */
for (unsigned i = 0; i < defaults.size(); ++i)
- na->GetAccount()->SetS<bool>(defaults[i].upper(), true);
+ na->GetAccount()->SetS<bool>(defaults[i], true);
}
void OnUserQuit(User *u, const Anope::string &msg) override
@@ -668,10 +664,10 @@ class NickServCore : public Module, public NickServ::NickServService
void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
- if (!na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (!na->GetAccount()->IsUnconfirmed())
{
time_t nickserv_expire = Config->GetModule(this)->Get<time_t>("expire", "21d");
- if (!na->HasFieldS("NS_NO_EXPIRE") && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->GetLastSeen() != Anope::CurTime))
+ if (!na->IsNoExpire() && nickserv_expire && !Anope::NoExpire && (source.HasPriv("nickserv/auspex") || na->GetLastSeen() != Anope::CurTime))
info[_("Expires")] = Anope::strftime(na->GetLastSeen() + nickserv_expire, source.GetAccount());
}
else
diff --git a/modules/nickserv/main/nicktype.cpp b/modules/nickserv/main/nicktype.cpp
index 9efe55d86..b3bcdc0f7 100644
--- a/modules/nickserv/main/nicktype.cpp
+++ b/modules/nickserv/main/nicktype.cpp
@@ -28,7 +28,8 @@ NickType::NickType(Module *me) : Serialize::Type<NickImpl>(me)
, last_realhost(this, "last_realhost", &NickImpl::last_realhost)
, time_registered(this, "time_registered", &NickImpl::time_registered)
, last_seen(this, "last_seen", &NickImpl::last_seen)
- , nc(this, "nc", &NickImpl::account)
+ , account(this, "account", &NickImpl::account)
+ , noexpire(this, "noexpire", &NickImpl::noexpire)
{
}
diff --git a/modules/nickserv/main/nicktype.h b/modules/nickserv/main/nicktype.h
index 0779b08da..c702de5a1 100644
--- a/modules/nickserv/main/nicktype.h
+++ b/modules/nickserv/main/nicktype.h
@@ -38,7 +38,9 @@ class NickType : public Serialize::Type<NickImpl>
Serialize::Field<NickImpl, time_t> last_seen;
/* Account this nick is tied to. Multiple nicks can be tied to a single account. */
- Serialize::ObjectField<NickImpl, NickServ::Account *> nc;
+ Serialize::ObjectField<NickImpl, NickServ::Account *> account;
+
+ Serialize::Field<NickImpl, bool> noexpire;
NickType(Module *);
diff --git a/modules/nickserv/recover.cpp b/modules/nickserv/recover.cpp
index 6e4c7c6b3..f3fa24bb6 100644
--- a/modules/nickserv/recover.cpp
+++ b/modules/nickserv/recover.cpp
@@ -66,7 +66,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
// same person that is executing the command, so kill them off (old GHOST command).
else if (u->Account() == na->GetAccount())
{
- if (!source.GetAccount() && na->GetAccount()->HasFieldS("NS_SECURE"))
+ if (!source.GetAccount() && na->GetAccount()->IsSecure())
{
source.GetUser()->Login(u->Account());
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->GetDisplay();
@@ -97,7 +97,7 @@ class NSRecoverRequestListener : public NickServ::IdentifyRequestListener
/* User is not identified or not identified to the same account as the person using this command */
else
{
- if (!source.GetAccount() && na->GetAccount()->HasFieldS("NS_SECURE"))
+ if (!source.GetAccount() && na->GetAccount()->IsSecure())
{
source.GetUser()->Login(na->GetAccount()); // Identify the user using the command if they arent identified
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")";
@@ -193,7 +193,7 @@ class CommandNSRecover : public Command
bool ok = false;
if (source.GetAccount() == na->GetAccount())
ok = true;
- else if (!na->GetAccount()->HasFieldS("NS_SECURE") && source.GetUser() && na->GetAccount()->IsOnAccess(source.GetUser()))
+ else if (!na->GetAccount()->IsSecure() && source.GetUser() && na->GetAccount()->IsOnAccess(source.GetUser()))
ok = true;
if (certservice && source.GetUser() && certservice->Matches(source.GetUser(), na->GetAccount()))
diff --git a/modules/nickserv/register.cpp b/modules/nickserv/register.cpp
index 471ca57fa..4ceb3f113 100644
--- a/modules/nickserv/register.cpp
+++ b/modules/nickserv/register.cpp
@@ -36,7 +36,7 @@ class CommandNSConfirm : public Command
{
const Anope::string &passcode = params[0];
- if (source.nc && !source.nc->HasFieldS("UNCONFIRMED") && source.HasPriv("nickserv/confirm"))
+ if (source.nc && !source.nc->IsUnconfirmed() && source.HasPriv("nickserv/confirm"))
{
NickServ::Nick *na = NickServ::FindNick(passcode);
if (na == NULL)
@@ -45,13 +45,13 @@ class CommandNSConfirm : public Command
return;
}
- if (na->GetAccount()->HasFieldS("UNCONFIRMED") == false)
+ if (na->GetAccount()->IsUnconfirmed() == false)
{
source.Reply(_("\002{0}\002 is already confirmed."), na->GetNick());
return;
}
- na->GetAccount()->UnsetS<bool>("UNCONFIRMED");
+ na->GetAccount()->SetUnconfirmed(false);
EventManager::Get()->Dispatch(&NickServ::Event::NickConfirm::OnNickConfirm, source.GetUser(), na->GetAccount());
Log(LOG_ADMIN, source, this) << "to confirm nick " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")";
source.Reply(_("\002{0}\002 has been confirmed."), na->GetNick());
@@ -81,7 +81,7 @@ class CommandNSConfirm : public Command
nc->Shrink<Anope::string>("passcode");
Log(LOG_COMMAND, source, this) << "to confirm their email";
source.Reply(_("Your email address of \002{0}\002 has been confirmed."), source.nc->GetEmail());
- nc->UnsetS<bool>("UNCONFIRMED");
+ nc->SetUnconfirmed(false);
EventManager::Get()->Dispatch(&NickServ::Event::NickConfirm::OnNickConfirm, source.GetUser(), nc);
@@ -91,7 +91,7 @@ class CommandNSConfirm : public Command
if (na)
{
IRCD->SendLogin(source.GetUser(), na);
- if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == source.GetAccount() && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (!Config->GetModule("nickserv/main")->Get<bool>("nonicknameownership") && na->GetAccount() == source.GetAccount() && !na->GetAccount()->IsUnconfirmed())
source.GetUser()->SetMode(source.service, "REGISTERED");
}
}
@@ -263,14 +263,14 @@ class CommandNSRegister : public Command
if (nsregister.equals_ci("admin"))
{
- nc->SetS<bool>("UNCONFIRMED", true);
+ nc->SetUnconfirmed(true);
// User::Identify() called below will notify the user that their registration is pending
}
else if (nsregister.equals_ci("mail"))
{
if (!email.empty())
{
- nc->SetS<bool>("UNCONFIRMED", true);
+ nc->SetUnconfirmed(true);
SendRegmail(NULL, na, source.service);
}
}
@@ -332,7 +332,7 @@ class CommandNSResend : public Command
return;
}
- if (na->GetAccount() != source.GetAccount() || !source.nc->HasFieldS("UNCONFIRMED"))
+ if (na->GetAccount() != source.GetAccount() || !source.nc->IsUnconfirmed())
{
source.Reply(_("Your account is already confirmed."));
return;
@@ -379,7 +379,6 @@ class NSRegister : public Module
CommandNSConfirm commandnsconfirm;
CommandNSResend commandnsrsend;
- Serialize::Field<NickServ::Account, bool> unconfirmed;
Serialize::Field<NickServ::Account, Anope::string> passcode;
public:
@@ -389,7 +388,6 @@ class NSRegister : public Module
, commandnsregister(this)
, commandnsconfirm(this)
, commandnsrsend(this)
- , unconfirmed(this, "UNCONFIRMED")
, passcode(this, "passcode")
{
if (Config->GetModule(this)->Get<Anope::string>("registration").equals_ci("disable"))
@@ -399,7 +397,7 @@ class NSRegister : public Module
void OnNickIdentify(User *u) override
{
ServiceBot *NickServ;
- if (unconfirmed.HasExt(u->Account()) && (NickServ = Config->GetClient("NickServ")))
+ if (u->Account()->IsUnconfirmed() && (NickServ = Config->GetClient("NickServ")))
{
const Anope::string &nsregister = Config->GetModule(this)->Get<Anope::string>("registration");
if (nsregister.equals_ci("admin"))
@@ -416,7 +414,7 @@ class NSRegister : public Module
void OnPreNickExpire(NickServ::Nick *na, bool &expire) override
{
- if (unconfirmed.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsUnconfirmed())
{
time_t unconfirmed_expire = Config->GetModule(this)->Get<time_t>("unconfirmedexpire", "1d");
if (unconfirmed_expire && Anope::CurTime - na->GetTimeRegistered() >= unconfirmed_expire)
diff --git a/modules/nickserv/resetpass.cpp b/modules/nickserv/resetpass.cpp
index 6acfc905e..2a3a8c418 100644
--- a/modules/nickserv/resetpass.cpp
+++ b/modules/nickserv/resetpass.cpp
@@ -107,7 +107,7 @@ class NSResetPass : public Module
else if (passcode.equals_cs(ri->code))
{
reset.Unset(nc);
- nc->UnsetS<bool>("UNCONFIRMED");
+ nc->SetUnconfirmed(false);
Log(LOG_COMMAND, source, &commandnsresetpass) << "confirmed RESETPASS to forcefully identify as " << na->GetNick();
diff --git a/modules/nickserv/set.cpp b/modules/nickserv/set.cpp
index 4be031690..136d43be8 100644
--- a/modules/nickserv/set.cpp
+++ b/modules/nickserv/set.cpp
@@ -264,13 +264,13 @@ class CommandNSSetAutoOp : public Command
if (param.equals_ci("ON"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable autoop for " << na->GetAccount()->GetDisplay();
- nc->SetS<bool>("AUTOOP", true);
+ nc->SetAutoOp(true);
source.Reply(_("Services will from now on set status modes on \002{0}\002 in channels."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable autoop for " << na->GetAccount()->GetDisplay();
- nc->UnsetS<bool>("AUTOOP");
+ nc->SetAutoOp(false);
source.Reply(_("Services will no longer set status modes on \002{0}\002 in channels."), nc->GetDisplay());
}
else
@@ -452,7 +452,7 @@ class CommandNSSetEmail : public Command
}
NickServ::Account *nc = na->GetAccount();
- if (nc->HasFieldS("UNCONFIRMED"))
+ if (nc->IsUnconfirmed())
{
source.Reply(_("You may not change the email of an unconfirmed account."));
return;
@@ -566,13 +566,13 @@ class CommandNSSetKeepModes : public Command
if (param.equals_ci("ON"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable keepmodes for " << nc->GetDisplay();
- nc->SetS<bool>("NS_KEEP_MODES", true);
+ nc->SetKeepModes(true);
source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable keepmodes for " << nc->GetDisplay();
- nc->UnsetS<bool>("NS_KEEP_MODES");
+ nc->SetKeepModes(false);
source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), nc->GetDisplay());
}
else
@@ -652,17 +652,17 @@ class CommandNSSetKill : public Command
if (param.equals_ci("ON"))
{
- nc->SetS<bool>("KILLPROTECT", true);
- nc->UnsetS<bool>("KILL_QUICK");
- nc->UnsetS<bool>("KILL_IMMED");
+ nc->SetKillProtect(true);
+ nc->SetKillQuick(false);
+ nc->SetKillImmed(false);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill on for " << nc->GetDisplay();
source.Reply(_("Protection is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("QUICK"))
{
- nc->SetS<bool>("KILLPROTECT", true);
- nc->SetS<bool>("KILL_QUICK", true);
- nc->UnsetS<bool>("KILL_IMMED");
+ nc->SetKillProtect(true);
+ nc->SetKillQuick(true);
+ nc->SetKillImmed(false);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill quick for " << nc->GetDisplay();
source.Reply(_("Protection is now \002on\002 for \002{0}\002, with a reduced delay."), nc->GetDisplay());
}
@@ -670,9 +670,9 @@ class CommandNSSetKill : public Command
{
if (Config->GetModule(this->GetOwner())->Get<bool>("allowkillimmed"))
{
- nc->SetS<bool>("KILLPROTECT",true);
- nc->UnsetS<bool>("KILL_QUICK");
- nc->SetS<bool>("KILL_IMMED", true);
+ nc->SetKillProtect(true);
+ nc->SetKillQuick(false);
+ nc->SetKillImmed(true);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to set kill immed for " << nc->GetDisplay();
source.Reply(_("Protection is now \002on\002 for \002{0}\002, with no delay."), nc->GetDisplay());
}
@@ -681,9 +681,9 @@ class CommandNSSetKill : public Command
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetS<bool>("KILLPROTECT");
- nc->UnsetS<bool>("KILL_QUICK");
- nc->UnsetS<bool>("KILL_IMMED");
+ nc->SetKillProtect(true);
+ nc->SetKillQuick(false);
+ nc->SetKillImmed(false);
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable kill for " << nc->GetDisplay();
source.Reply(_("Protection is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
@@ -878,13 +878,13 @@ class CommandNSSetMessage : public Command
if (param.equals_ci("ON"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable " << source.command << " for " << nc->GetDisplay();
- nc->SetS<bool>("MSG", true);
+ nc->SetMsg(true);
source.Reply(_("Services will now reply to \002{0}\002 with \002messages\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable " << source.command << " for " << nc->GetDisplay();
- nc->UnsetS<bool>("MSG");
+ nc->SetMsg(false);
source.Reply(_("Services will now reply to \002{0}\002 with \002notices\002."), nc->GetDisplay());
}
else
@@ -975,13 +975,13 @@ class CommandNSSetSecure : public Command
if (param.equals_ci("ON"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to enable secure for " << nc->GetDisplay();
- nc->SetS<bool>("NS_SECURE", true);
+ nc->SetSecure(true);
source.Reply(_("Secure option is now \002on\002 for \002{0}\002."), nc->GetDisplay());
}
else if (param.equals_ci("OFF"))
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to disable secure for " << nc->GetDisplay();
- nc->UnsetS<bool>("NS_SECURE");
+ nc->SetSecure(false);
source.Reply(_("Secure option is now \002off\002 for \002{0}\002."), nc->GetDisplay());
}
else
@@ -1059,13 +1059,13 @@ class CommandNSSASetNoexpire : public Command
if (param.equals_ci("ON"))
{
Log(LOG_ADMIN, source, this) << "to enable noexpire for " << na->GetAccount()->GetDisplay();
- na->SetS<bool>("NS_NO_EXPIRE", true);
+ na->SetNoExpire(true);
source.Reply(_("\002{0}\002 \002will not\002 expire."), na->GetNick());
}
else if (param.equals_ci("OFF"))
{
Log(LOG_ADMIN, source, this) << "to disable noexpire for " << na->GetAccount()->GetDisplay();
- na->UnsetS<bool>("NS_NO_EXPIRE");
+ na->SetNoExpire(false);
source.Reply(_("\002{0}\002 \002will\002 expire."), na->GetNick());
}
else
@@ -1122,9 +1122,6 @@ class NSSet : public Module
CommandNSSASetNoexpire commandnssasetnoexpire;
- Serialize::Field<NickServ::Account, bool> autoop, keep_modes, killprotect, kill_quick, kill_immed, message, secure;
- Serialize::Field<NickServ::Nick, bool> noexpire;
-
/* email, passcode */
ExtensibleItem<std::pair<Anope::string, Anope::string > > ns_set_email;
@@ -1160,15 +1157,6 @@ class NSSet : public Module
, commandnssasetsecure(this)
, commandnssasetnoexpire(this)
- , autoop(this, "AUTOOP")
- , keep_modes(this, "NS_KEEP_MODES")
- , 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")
-
, ns_set_email(this, "ns_set_email")
{
@@ -1202,13 +1190,13 @@ class NSSet : public Module
if (chan->ci)
{
/* Only give modes if autoop is set */
- give_modes &= !user->Account() || autoop.HasExt(user->Account());
+ give_modes &= !user->Account() || user->Account()->IsAutoOp();
}
}
void OnPreNickExpire(NickServ::Nick *na, bool &expire) override
{
- if (noexpire.HasExt(na))
+ if (na->IsNoExpire())
expire = false;
}
@@ -1217,21 +1205,21 @@ class NSSet : public Module
if (!show_hidden)
return;
- if (kill_immed.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsKillImmed())
info.AddOption(_("Immediate protection"));
- else if (kill_quick.HasExt(na->GetAccount()))
+ else if (na->GetAccount()->IsKillQuick())
info.AddOption(_("Quick protection"));
- else if (killprotect.HasExt(na->GetAccount()))
+ else if (na->GetAccount()->IsKillProtect())
info.AddOption(_("Protection"));
- if (secure.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsSecure())
info.AddOption(_("Security"));
- if (message.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsMsg())
info.AddOption(_("Message mode"));
- if (autoop.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsAutoOp())
info.AddOption(_("Auto-op"));
- if (noexpire.HasExt(na))
+ if (na->IsNoExpire())
info.AddOption(_("No expire"));
- if (keep_modes.HasExt(na->GetAccount()))
+ if (na->GetAccount()->IsKeepModes())
info.AddOption(_("Keep modes"));
}
@@ -1260,7 +1248,7 @@ class NSSet : public Module
void OnUserLogin(User *u) override
{
- if (keep_modes.HasExt(u->Account()))
+ if (u->Account()->IsKeepModes())
for (NickServ::Mode *mode : u->Account()->GetRefs<NickServ::Mode *>())
{
UserMode *um = ModeManager::FindUserModeByName(mode->GetMode());
diff --git a/modules/nickserv/set_misc.cpp b/modules/nickserv/set_misc.cpp
index 899ddb4ab..af0859c6b 100644
--- a/modules/nickserv/set_misc.cpp
+++ b/modules/nickserv/set_misc.cpp
@@ -52,7 +52,7 @@ class NSMiscDataType : public Serialize::Type<NSMiscDataImpl>
Serialize::Field<NSMiscDataImpl, Anope::string> name, data;
NSMiscDataType(Module *me) : Serialize::Type<NSMiscDataImpl>(me)
- , owner(this, "nc", &NSMiscDataImpl::account, true)
+ , owner(this, "account", &NSMiscDataImpl::account, true)
, name(this, "name", &NSMiscDataImpl::name)
, data(this, "data", &NSMiscDataImpl::data)
{
diff --git a/modules/nickserv/suspend.cpp b/modules/nickserv/suspend.cpp
index e252eb67c..4ac1d7456 100644
--- a/modules/nickserv/suspend.cpp
+++ b/modules/nickserv/suspend.cpp
@@ -28,7 +28,7 @@ class NSSuspendInfoImpl : public NSSuspendInfo
NickServ::Account *account = nullptr;
Anope::string by, reason;
- time_t when = 0, expires =0;
+ time_t when = 0, expires = 0;
public:
NSSuspendInfoImpl(Serialize::TypeBase *type) : NSSuspendInfo(type) { }
@@ -58,7 +58,7 @@ class NSSuspendType : public Serialize::Type<NSSuspendInfoImpl>
Serialize::Field<NSSuspendInfoImpl, time_t> when, expires;
NSSuspendType(Module *me) : Serialize::Type<NSSuspendInfoImpl>(me)
- , account(this, "nick", &NSSuspendInfoImpl::account, true)
+ , account(this, "account", &NSSuspendInfoImpl::account, true)
, by(this, "by", &NSSuspendInfoImpl::by)
, reason(this, "reason", &NSSuspendInfoImpl::reason)
, when(this, "when", &NSSuspendInfoImpl::when)