summaryrefslogtreecommitdiff
path: root/modules/nickserv
diff options
context:
space:
mode:
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