summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/chanserv.example.conf10
-rw-r--r--data/nickserv.example.conf12
-rw-r--r--include/modules/chanserv/channel.h70
-rw-r--r--include/modules/memoserv.h3
-rw-r--r--include/modules/nickserv/account.h53
-rw-r--r--include/modules/nickserv/ajoin.h4
-rw-r--r--include/modules/nickserv/nick.h5
-rw-r--r--modules/botserv/assign.cpp2
-rw-r--r--modules/botserv/badwords.cpp2
-rw-r--r--modules/botserv/main/botserv.cpp4
-rw-r--r--modules/chanserv/akick.cpp22
-rw-r--r--modules/chanserv/ban.cpp14
-rw-r--r--modules/chanserv/drop.cpp4
-rw-r--r--modules/chanserv/enforce.cpp6
-rw-r--r--modules/chanserv/kick.cpp14
-rw-r--r--modules/chanserv/list.cpp16
-rw-r--r--modules/chanserv/log.cpp8
-rw-r--r--modules/chanserv/main/chanaccess.cpp6
-rw-r--r--modules/chanserv/main/chanaccesstype.h4
-rw-r--r--modules/chanserv/main/channel.cpp178
-rw-r--r--modules/chanserv/main/channel.h78
-rw-r--r--modules/chanserv/main/channeltype.cpp18
-rw-r--r--modules/chanserv/main/channeltype.h6
-rw-r--r--modules/chanserv/main/chanserv.cpp19
-rw-r--r--modules/chanserv/mode.cpp14
-rw-r--r--modules/chanserv/register.cpp2
-rw-r--r--modules/chanserv/seen.cpp2
-rw-r--r--modules/chanserv/set.cpp115
-rw-r--r--modules/chanserv/set_misc.cpp2
-rw-r--r--modules/chanserv/topic.cpp31
-rw-r--r--modules/chanserv/updown.cpp4
-rw-r--r--modules/database/flatfile.cpp2
-rw-r--r--modules/database/old.cpp78
-rw-r--r--modules/fantasy.cpp11
-rw-r--r--modules/greet.cpp23
-rw-r--r--modules/hostserv/request.cpp2
-rw-r--r--modules/memoserv/info.cpp20
-rw-r--r--modules/memoserv/main/memoinfo.cpp11
-rw-r--r--modules/memoserv/main/memoinfo.h4
-rw-r--r--modules/memoserv/main/memoinfotype.cpp1
-rw-r--r--modules/memoserv/main/memoinfotype.h1
-rw-r--r--modules/memoserv/main/memoserv.cpp6
-rw-r--r--modules/memoserv/send.cpp2
-rw-r--r--modules/memoserv/set.cpp41
-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
-rw-r--r--modules/protocol/inspircd20.cpp6
-rw-r--r--modules/protocol/ratbox.cpp2
-rw-r--r--modules/protocol/unreal.cpp2
-rw-r--r--modules/webcpanel/pages/chanserv/drop.cpp2
-rw-r--r--modules/webcpanel/pages/chanserv/set.cpp63
-rw-r--r--modules/webcpanel/pages/nickserv/alist.cpp4
-rw-r--r--modules/webcpanel/pages/nickserv/info.cpp63
-rw-r--r--src/users.cpp4
73 files changed, 1060 insertions, 521 deletions
diff --git a/data/chanserv.example.conf b/data/chanserv.example.conf
index c60a58621..22881217c 100644
--- a/data/chanserv.example.conf
+++ b/data/chanserv.example.conf
@@ -65,27 +65,27 @@ module
* - keeptopic: Retain topic when the channel is not in use
* - peace: Disallow users from kicking or removing modes from others who are of the same
* access level or superior
- * - cs_private: Hide the channel from ChanServ's LIST command
+ * - private: Hide the channel from ChanServ's LIST command
* - restricted: Kick/ban users who are restricted from the channel
- * - cs_secure: Enable channel security, requiring the user to be identified with NickServ in
+ * - secure: Enable channel security, requiring the user to be identified with NickServ in
* order to be considered for being on the access list of the channel
* - secureops: Only allow operator status to be given if the user is on the access list
* - securefounder: Only allow the real founder of the channel to drop the channel, change it's
* password, or change the founder or successor
* - signkick: Use of ChanServ's KICK command will cause the user's nick to be signed to the kick.
- * - signkick_level: Same as above, but the kick will not be signed if the user is at the same access
+ * - signkicklevel: Same as above, but the kick will not be signed if the user is at the same access
* level or superior to the target
* - topiclock: Disallow the topic to be changed except with ChanServ's TOPIC command
* - persist: Keep the channel open at all times
* - noautoop: Disables autoop on the channel
- * - cs_keep_modes: Enables keep modes on the channel, which retains modes when the channel is
+ * - keepmodes: Enables keep modes on the channel, which retains modes when the channel is
* not in use.
* - none: No defaults
*
* This directive is optional, if left blank, the options will default to keeptopic, chanserv/secure, securefounder,
* and signkick. If you really want no defaults, use "none" by itself as the option.
*/
- defaults = "keeptopic peace cs_secure securefounder signkick"
+ defaults = "keeptopic peace secure securefounder signkick"
/*
* The maximum number of channels which may be registered to a single nickname.
diff --git a/data/nickserv.example.conf b/data/nickserv.example.conf
index 1f07831c4..ceef600ab 100644
--- a/data/nickserv.example.conf
+++ b/data/nickserv.example.conf
@@ -83,11 +83,11 @@ module
*
* The options are:
* - killprotect: Kill nick if not identified within 60 seconds
- * - kill_quick: Kill nick if not identified within 20 seconds, this one overrides the above
+ * - killquick: Kill nick if not identified within 20 seconds, this one overrides the above
* option and the above must be specified with this one
- * - ns_secure: Enable nickname security, requiring the nick's password before any operations
+ * - secure: Enable nickname security, requiring the nick's password before any operations
* can be done on it
- * - ns_private: Hide the nick from NickServ's LIST command
+ * - private: Hide the nick from NickServ's LIST command
* - hide_email: Hide's the nick's e-mail address from NickServ's INFO command
* - hide_mask: Hide's the nick's last or current user@host from NickServ's INFO command
* - hide_quit: Hide's the nick's last quit message
@@ -97,13 +97,13 @@ module
* - autoop: User will be automatically opped in channels they enter and have access to
* - msg: Services messages will be sent as PRIVMSGs instead of NOTICEs, requires
* options:useprivmsg to be enabled as well
- * - ns_keepmodes: Enables keepmodes, which retains user modes across sessions
- * - ns_no_expire: Enables no expire. Unconfirmed expire overrules this.
+ * - keepmodes: Enables keepmodes, which retains user modes across sessions
+ * - noexpire: Enables no expire. Unconfirmed expire overrules this.
*
* This directive is optional, if left blank, the options will default to nickserv/secure, memo_signon, and
* memo_receive. If you really want no defaults, use "none" by itself as the option.
*/
- defaults = "ns_secure ns_private hide_email hide_mask memo_signon memo_receive autoop"
+ defaults = "secure private hide_email hide_mask memo_signon memo_receive autoop"
/*
* The minimum length of time between consecutive uses of NickServ's REGISTER command. This
diff --git a/include/modules/chanserv/channel.h b/include/modules/chanserv/channel.h
index 3ba5e7561..29e8ef9d7 100644
--- a/include/modules/chanserv/channel.h
+++ b/include/modules/chanserv/channel.h
@@ -27,12 +27,10 @@ class CoreExport Channel : public Serialize::Object
public:
::Channel *c = nullptr; /* Pointer to channel, if the channel exists */
- protected:
- using Serialize::Object::Object;
-
- public:
static constexpr const char *const NAME = "channel";
+ using Serialize::Object::Object;
+
virtual Anope::string GetName() anope_abstract;
virtual void SetName(const Anope::string &) anope_abstract;
@@ -40,10 +38,10 @@ class CoreExport Channel : public Serialize::Object
virtual void SetDesc(const Anope::string &) anope_abstract;
virtual time_t GetTimeRegistered() anope_abstract;
- virtual void SetTimeRegistered(const time_t &) anope_abstract;
+ virtual void SetTimeRegistered(time_t) anope_abstract;
virtual time_t GetLastUsed() anope_abstract;
- virtual void SetLastUsed(const time_t &) anope_abstract;
+ virtual void SetLastUsed(time_t) anope_abstract;
virtual Anope::string GetLastTopic() anope_abstract;
virtual void SetLastTopic(const Anope::string &) anope_abstract;
@@ -52,13 +50,13 @@ class CoreExport Channel : public Serialize::Object
virtual void SetLastTopicSetter(const Anope::string &) anope_abstract;
virtual time_t GetLastTopicTime() anope_abstract;
- virtual void SetLastTopicTime(const time_t &) anope_abstract;
+ virtual void SetLastTopicTime(time_t) anope_abstract;
virtual int16_t GetBanType() anope_abstract;
- virtual void SetBanType(const int16_t &) anope_abstract;
+ virtual void SetBanType(int16_t) anope_abstract;
virtual time_t GetBanExpire() anope_abstract;
- virtual void SetBanExpire(const time_t &) anope_abstract;
+ virtual void SetBanExpire(time_t) anope_abstract;
virtual BotInfo *GetBI() anope_abstract;
virtual void SetBI(BotInfo *) anope_abstract;
@@ -66,6 +64,58 @@ class CoreExport Channel : public Serialize::Object
virtual ServiceBot *GetBot() anope_abstract;
virtual void SetBot(ServiceBot *) anope_abstract;
+ /** Whether or not greets are enabled.
+ */
+ virtual bool IsGreet() anope_abstract;
+ virtual void SetGreet(bool) anope_abstract;
+
+ /** Whether or not fantasy is enabled.
+ */
+ virtual bool IsFantasy() anope_abstract;
+ virtual void SetFantasy(bool) anope_abstract;
+
+ virtual bool IsNoAutoop() anope_abstract;
+ virtual void SetNoAutoop(bool) anope_abstract;
+
+ virtual bool IsPeace() anope_abstract;
+ virtual void SetPeace(bool) anope_abstract;
+
+ virtual bool IsSecureFounder() anope_abstract;
+ virtual void SetSecureFounder(bool) anope_abstract;
+
+ virtual bool IsRestricted() anope_abstract;
+ virtual void SetRestricted(bool) anope_abstract;
+
+ virtual bool IsSecure() anope_abstract;
+ virtual void SetSecure(bool) anope_abstract;
+
+ virtual bool IsSecureOps() anope_abstract;
+ virtual void SetSecureOps(bool) anope_abstract;
+
+ virtual bool IsSignKick() anope_abstract;
+ virtual void SetSignKick(bool) anope_abstract;
+
+ virtual bool IsSignKickLevel() anope_abstract;
+ virtual void SetSignKickLevel(bool) anope_abstract;
+
+ virtual bool IsNoExpire() anope_abstract;
+ virtual void SetNoExpire(bool) anope_abstract;
+
+ virtual bool IsKeepModes() anope_abstract;
+ virtual void SetKeepModes(bool) anope_abstract;
+
+ virtual bool IsPersist() anope_abstract;
+ virtual void SetPersist(bool) anope_abstract;
+
+ virtual bool IsTopicLock() anope_abstract;
+ virtual void SetTopicLock(bool) anope_abstract;
+
+ virtual bool IsKeepTopic() anope_abstract;
+ virtual void SetKeepTopic(bool) anope_abstract;
+
+ virtual bool IsPrivate() anope_abstract;
+ virtual void SetPrivate(bool) anope_abstract;
+
/** Is the user the real founder?
* @param user The user
* @return true or false
@@ -198,4 +248,4 @@ class CoreExport Channel : public Serialize::Object
};
-} // namespace ChanServ \ No newline at end of file
+} // namespace ChanServ
diff --git a/include/modules/memoserv.h b/include/modules/memoserv.h
index 1268facef..8c39b5a5e 100644
--- a/include/modules/memoserv.h
+++ b/include/modules/memoserv.h
@@ -144,6 +144,9 @@ namespace MemoServ
virtual int16_t GetMemoMax() anope_abstract;
virtual void SetMemoMax(const int16_t &) anope_abstract;
+ virtual bool IsHardMax() anope_abstract;
+ virtual void SetHardMax(bool) anope_abstract;
+
virtual std::vector<Memo *> GetMemos() anope_abstract;
virtual std::vector<Ignore *> GetIgnores() anope_abstract;
};
diff --git a/include/modules/nickserv/account.h b/include/modules/nickserv/account.h
index f0ba144f7..511b1220f 100644
--- a/include/modules/nickserv/account.h
+++ b/include/modules/nickserv/account.h
@@ -24,13 +24,13 @@ namespace NickServ
/* A registered account. Each account must have a Nick with the same nick as the
* account's display.
- * It matters that Base is here before Extensible (it is inherited by Serializable)
*/
class CoreExport Account : public Serialize::Object
{
public:
static constexpr const char *const NAME = "account";
+#warning "this gets lost"
/* Last time an email was sent to this user */
time_t lastmail = 0;
/* Users online now logged into this account */
@@ -53,6 +53,57 @@ class CoreExport Account : public Serialize::Object
virtual Oper *GetOper() anope_abstract;
virtual void SetOper(Oper *) anope_abstract;
+ virtual Anope::string GetGreet() anope_abstract;
+ virtual void SetGreet(const Anope::string &) anope_abstract;
+
+ virtual bool IsUnconfirmed() anope_abstract;
+ virtual void SetUnconfirmed(bool) anope_abstract;
+
+ virtual bool IsPrivate() anope_abstract;
+ virtual void SetPrivate(bool) anope_abstract;
+
+ virtual bool IsAutoOp() anope_abstract;
+ virtual void SetAutoOp(bool) anope_abstract;
+
+ virtual bool IsKeepModes() anope_abstract;
+ virtual void SetKeepModes(bool) anope_abstract;
+
+ virtual bool IsKillProtect() anope_abstract;
+ virtual void SetKillProtect(bool) anope_abstract;
+
+ virtual bool IsKillQuick() anope_abstract;
+ virtual void SetKillQuick(bool) anope_abstract;
+
+ virtual bool IsKillImmed() anope_abstract;
+ virtual void SetKillImmed(bool) anope_abstract;
+
+ virtual bool IsMsg() anope_abstract;
+ virtual void SetMsg(bool) anope_abstract;
+
+ virtual bool IsSecure() anope_abstract;
+ virtual void SetSecure(bool) anope_abstract;
+
+ virtual bool IsMemoSignon() anope_abstract;
+ virtual void SetMemoSignon(bool) anope_abstract;
+
+ virtual bool IsMemoReceive() anope_abstract;
+ virtual void SetMemoReceive(bool) anope_abstract;
+
+ virtual bool IsMemoMail() anope_abstract;
+ virtual void SetMemoMail(bool) anope_abstract;
+
+ virtual bool IsHideEmail() anope_abstract;
+ virtual void SetHideEmail(bool) anope_abstract;
+
+ virtual bool IsHideMask() anope_abstract;
+ virtual void SetHideMask(bool) anope_abstract;
+
+ virtual bool IsHideStatus() anope_abstract;
+ virtual void SetHideStatus(bool) anope_abstract;
+
+ virtual bool IsHideQuit() anope_abstract;
+ virtual void SetHideQuit(bool) anope_abstract;
+
/** Changes the display for this account
* @param na The new display, must be grouped to this account.
*/
diff --git a/include/modules/nickserv/ajoin.h b/include/modules/nickserv/ajoin.h
index c23eecbe9..9f060402c 100644
--- a/include/modules/nickserv/ajoin.h
+++ b/include/modules/nickserv/ajoin.h
@@ -25,8 +25,8 @@ class AutoJoin : public Serialize::Object
public:
static constexpr const char *const NAME = "autojoin";
- virtual NickServ::Account *GetOwner() anope_abstract;
- virtual void SetOwner(NickServ::Account *acc) anope_abstract;
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *acc) anope_abstract;
virtual Anope::string GetChannel() anope_abstract;
virtual void SetChannel(const Anope::string &c) anope_abstract;
diff --git a/include/modules/nickserv/nick.h b/include/modules/nickserv/nick.h
index 604bc02d6..3579e7d0d 100644
--- a/include/modules/nickserv/nick.h
+++ b/include/modules/nickserv/nick.h
@@ -55,6 +55,9 @@ class CoreExport Nick : public Serialize::Object
virtual Account *GetAccount() anope_abstract;
virtual void SetAccount(Account *acc) anope_abstract;
+
+ virtual bool IsNoExpire() anope_abstract;
+ virtual void SetNoExpire(bool) anope_abstract;
};
-} // namespace NickServ \ No newline at end of file
+} // namespace NickServ
diff --git a/modules/botserv/assign.cpp b/modules/botserv/assign.cpp
index 95691b6a9..eca103e9f 100644
--- a/modules/botserv/assign.cpp
+++ b/modules/botserv/assign.cpp
@@ -140,7 +140,7 @@ class CommandBSUnassign : public Command
return;
}
- if (ci->HasFieldS("PERSIST") && !ModeManager::FindChannelModeByName("PERM"))
+ if (ci->IsPersist() && !ModeManager::FindChannelModeByName("PERM"))
{
source.Reply(_("You cannot unassign bots while persist is set on the channel."));
return;
diff --git a/modules/botserv/badwords.cpp b/modules/botserv/badwords.cpp
index 1348c8aff..914e89ea9 100644
--- a/modules/botserv/badwords.cpp
+++ b/modules/botserv/badwords.cpp
@@ -50,7 +50,7 @@ class BadWordsType : public Serialize::Type<BadWordImpl>
Serialize::Field<BadWordImpl, BadWordType> type;
BadWordsType(Module *me) : Serialize::Type<BadWordImpl>(me)
- , channel(this, "ci", &BadWordImpl::channel, true)
+ , channel(this, "channel", &BadWordImpl::channel, true)
, word(this, "word", &BadWordImpl::word)
, type(this, "type", &BadWordImpl::type)
{
diff --git a/modules/botserv/main/botserv.cpp b/modules/botserv/main/botserv.cpp
index a297db153..c6e1c6413 100644
--- a/modules/botserv/main/botserv.cpp
+++ b/modules/botserv/main/botserv.cpp
@@ -127,7 +127,7 @@ class BotServCore : public Module, public BotServ::BotServService
void OnLeaveChannel(User *u, Channel *c) override
{
/* Channel is persistent, it shouldn't be deleted and the service bot should stay */
- if (c->ci && c->ci->HasFieldS("PERSIST"))
+ if (c->ci && c->ci->IsPersist())
return;
/* Channel is syncing from a netburst, don't destroy it as more users are probably wanting to join immediately
@@ -219,7 +219,7 @@ class BotServCore : public Module, public BotServ::BotServService
/* Set default bot flags */
spacesepstream sep(Config->GetModule(this)->Get<Anope::string>("defaults", "greet fantasy"));
for (Anope::string token; sep.GetToken(token);)
- ci->SetS<bool>("BS_" + token.upper(), true);
+ ci->SetS<bool>(token, true);
}
void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) override
diff --git a/modules/chanserv/akick.cpp b/modules/chanserv/akick.cpp
index d253d6fb5..1930cb20b 100644
--- a/modules/chanserv/akick.cpp
+++ b/modules/chanserv/akick.cpp
@@ -58,10 +58,10 @@ class AutoKickImpl : public AutoKick
class AutoKickType : public Serialize::Type<AutoKickImpl>
{
public:
- Serialize::ObjectField<AutoKickImpl, ChanServ::Channel *> ci;
+ Serialize::ObjectField<AutoKickImpl, ChanServ::Channel *> channel;
Serialize::Field<AutoKickImpl, Anope::string> mask;
- Serialize::ObjectField<AutoKickImpl, NickServ::Account *> nc;
+ Serialize::ObjectField<AutoKickImpl, NickServ::Account *> account;
Serialize::Field<AutoKickImpl, Anope::string> reason;
Serialize::Field<AutoKickImpl, Anope::string> creator;
@@ -70,9 +70,9 @@ class AutoKickType : public Serialize::Type<AutoKickImpl>
AutoKickType(Module *me)
: Serialize::Type<AutoKickImpl>(me)
- , ci(this, "ci", &AutoKickImpl::channel, true)
+ , channel(this, "channel", &AutoKickImpl::channel, true)
, mask(this, "mask", &AutoKickImpl::mask)
- , nc(this, "nc", &AutoKickImpl::account, true)
+ , account(this, "account", &AutoKickImpl::account, true)
, reason(this, "reason", &AutoKickImpl::reason)
, creator(this, "creator", &AutoKickImpl::creator)
, addtime(this, "addtime", &AutoKickImpl::addtime)
@@ -83,12 +83,12 @@ class AutoKickType : public Serialize::Type<AutoKickImpl>
ChanServ::Channel *AutoKickImpl::GetChannel()
{
- return Get(&AutoKickType::ci);
+ return Get(&AutoKickType::channel);
}
void AutoKickImpl::SetChannel(ChanServ::Channel *ci)
{
- Set(&AutoKickType::ci, ci);
+ Set(&AutoKickType::channel, ci);
}
Anope::string AutoKickImpl::GetMask()
@@ -103,12 +103,12 @@ void AutoKickImpl::SetMask(const Anope::string &mask)
NickServ::Account *AutoKickImpl::GetAccount()
{
- return Get(&AutoKickType::nc);
+ return Get(&AutoKickType::account);
}
void AutoKickImpl::SetAccount(NickServ::Account *nc)
{
- Set(&AutoKickType::nc, nc);
+ Set(&AutoKickType::account, nc);
}
Anope::string AutoKickImpl::GetReason()
@@ -170,7 +170,7 @@ class CommandCSAKick : public Command
{
/* Also don't try to complete the mask if this is a channel */
- if (mask.equals_ci(ci->GetName()) && ci->HasFieldS("PEACE"))
+ if (mask.equals_ci(ci->GetName()) && ci->IsPeace())
{
source.Reply(_("Access denied."));
return;
@@ -232,7 +232,7 @@ class CommandCSAKick : public Command
;
/* Check whether target nick has equal/higher access
* or whether the mask matches a user with higher/equal access - Viper */
- else if (ci->HasFieldS("PEACE") && nc)
+ else if (ci->IsPeace() && nc)
{
ChanServ::AccessGroup nc_access = ci->AccessFor(nc), u_access = source.AccessFor(ci);
if (nc == ci->GetFounder() || nc_access >= u_access)
@@ -241,7 +241,7 @@ class CommandCSAKick : public Command
return;
}
}
- else if (ci->HasFieldS("PEACE"))
+ else if (ci->IsPeace())
{
#warning "peace"
#if 0
diff --git a/modules/chanserv/ban.cpp b/modules/chanserv/ban.cpp
index 552ef03bf..44e2752a5 100644
--- a/modules/chanserv/ban.cpp
+++ b/modules/chanserv/ban.cpp
@@ -127,7 +127,7 @@ class CommandCSBan : public Command
{
ChanServ::AccessGroup u2_access = ci->AccessFor(u2);
- if (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
+ if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
{
source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->GetName());
return;
@@ -151,7 +151,7 @@ class CommandCSBan : public Command
Anope::string mask = ci->GetIdealBan(u2);
- bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access);
+ bool override = !u_access.HasPriv("BAN") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << mask;
if (!c->HasMode(mode, mask))
@@ -170,13 +170,15 @@ class CommandCSBan : public Command
if (block->Get<bool>("kick", "yes"))
{
- if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !source.AccessFor(ci).HasPriv("SIGNKICK")))
+ if (ci->IsSignKick() || (ci->IsSignKickLevel() && !source.AccessFor(ci).HasPriv("SIGNKICK")))
{
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str());
}
else
+ {
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
+ }
}
}
else
@@ -213,7 +215,7 @@ class CommandCSBan : public Command
if (matched > 1 && !founder)
continue;
- if (u != uc->user && ci->HasFieldS("PEACE") && u2_access >= u_access)
+ if (u != uc->user && ci->IsPeace() && u2_access >= u_access)
continue;
else if (ci->c->MatchesList(uc->user, "EXCEPT"))
continue;
@@ -224,14 +226,16 @@ class CommandCSBan : public Command
{
++kicked;
- if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
+ if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
{
reason += " (Matches " + mask + ")";
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str());
}
else
+ {
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str());
+ }
}
}
}
diff --git a/modules/chanserv/drop.cpp b/modules/chanserv/drop.cpp
index 1bc880ae9..77ab7e55e 100644
--- a/modules/chanserv/drop.cpp
+++ b/modules/chanserv/drop.cpp
@@ -52,7 +52,7 @@ class CommandCSDrop : public Command
return;
}
- if ((ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
+ if ((ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -62,7 +62,7 @@ class CommandCSDrop : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- bool override = (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
+ bool override = (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none") << ")";
Reference<Channel> c = ci->c;
diff --git a/modules/chanserv/enforce.cpp b/modules/chanserv/enforce.cpp
index 5a57d3cc2..c2a9fbe2d 100644
--- a/modules/chanserv/enforce.cpp
+++ b/modules/chanserv/enforce.cpp
@@ -32,8 +32,8 @@ class CommandCSEnforce : public Command
* part of the code. This way we can enforce SECUREOPS even
* if it's off.
*/
- bool hadsecureops = ci->HasFieldS("SECUREOPS");
- ci->SetS<bool>("SECUREOPS", true);
+ bool hadsecureops = ci->IsSecureOps();
+ ci->SetSecureOps(true);
for (Channel::ChanUserList::iterator it = ci->c->users.begin(), it_end = ci->c->users.end(); it != it_end; ++it)
{
@@ -43,7 +43,7 @@ class CommandCSEnforce : public Command
}
if (!hadsecureops)
- ci->UnsetS<bool>("SECUREOPS");
+ ci->SetSecureOps(false);
source.Reply(_("\002Secureops\002 enforced on \002{0}\002."), ci->GetName());
}
diff --git a/modules/chanserv/kick.cpp b/modules/chanserv/kick.cpp
index 4752d5940..a1ac7f62f 100644
--- a/modules/chanserv/kick.cpp
+++ b/modules/chanserv/kick.cpp
@@ -70,7 +70,7 @@ class CommandCSKick : public Command
if (u2)
{
ChanServ::AccessGroup u2_access = ci->AccessFor(u2);
- if (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
+ if (u != u2 && ci->IsPeace() && u2_access >= u_access && !source.HasPriv("chanserv/kick"))
source.Reply(_("Access denied. \002{0}\002 has the same or more privileges than you on \002{1}\002."), u2->nick, ci->GetName());
else if (u2->IsProtected())
source.Reply(_("Access denied. \002{0}\002 is protected and can not be kicked."), u2->nick);
@@ -78,16 +78,18 @@ class CommandCSKick : public Command
source.Reply(_("User \002{0}\002 is not on channel \002{1}\002."), u2->nick, c->name);
else
{
- bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->HasFieldS("PEACE") && u2_access >= u_access);
+ bool override = !u_access.HasPriv("KICK") || (u != u2 && ci->IsPeace() && u2_access >= u_access);
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << u2->nick;
- if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
+ if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
{
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), u2, "%s", signkickformat.c_str());
}
else
+ {
c->Kick(ci->WhoSends(), u2, "%s", reason.c_str());
+ }
}
}
else if (u_access.HasPriv("FOUNDER"))
@@ -108,21 +110,23 @@ class CommandCSKick : public Command
++matched;
ChanServ::AccessGroup u2_access = ci->AccessFor(uc->user);
- if (u != uc->user && ci->HasFieldS("PEACE") && u2_access >= u_access)
+ if (u != uc->user && ci->IsPeace() && u2_access >= u_access)
continue;
else if (uc->user->IsProtected())
continue;
++kicked;
- if (ci->HasFieldS("SIGNKICK") || (ci->HasFieldS("SIGNKICK_LEVEL") && !u_access.HasPriv("SIGNKICK")))
+ if (ci->IsSignKick() || (ci->IsSignKickLevel() && !u_access.HasPriv("SIGNKICK")))
{
reason += " (Matches " + mask + ")";
signkickformat = signkickformat.replace_all_cs("%m", reason);
c->Kick(ci->WhoSends(), uc->user, "%s", signkickformat.c_str());
}
else
+ {
c->Kick(ci->WhoSends(), uc->user, "%s (Matches %s)", reason.c_str(), mask.c_str());
+ }
}
}
diff --git a/modules/chanserv/list.cpp b/modules/chanserv/list.cpp
index c76d8661c..a60ae786c 100644
--- a/modules/chanserv/list.cpp
+++ b/modules/chanserv/list.cpp
@@ -85,7 +85,6 @@ class CommandCSList : public Command
ListFormatter list(source.GetAccount());
list.AddColumn(_("Name")).AddColumn(_("Description"));
- // XXX wtf
Anope::map<ChanServ::Channel *> ordered_map;
if (ChanServ::service)
for (auto& it : ChanServ::service->GetChannels())
@@ -97,7 +96,7 @@ class CommandCSList : public Command
if (!is_servadmin)
{
- if (ci->HasFieldS("CS_PRIVATE") || ci->HasFieldS("CS_SUSPENDED"))
+ if (ci->IsPrivate() || ci->HasFieldS("CS_SUSPENDED"))
continue;
if (ci->c && ci->c->HasMode("SECRET"))
continue;
@@ -113,7 +112,7 @@ class CommandCSList : public Command
if (suspended && !ci->HasFieldS("CS_SUSPENDED"))
continue;
- if (channoexpire && !ci->HasFieldS("CS_NO_EXPIRE"))
+ if (channoexpire && !ci->IsNoExpire())
continue;
if (pattern.equals_ci(ci->GetName()) || ci->GetName().equals_ci(spattern) || Anope::Match(ci->GetName(), pattern, false, true) || Anope::Match(ci->GetName(), spattern, false, true) || Anope::Match(ci->GetDesc(), pattern, false, true) || Anope::Match(ci->GetLastTopic(), pattern, false, true))
@@ -121,7 +120,7 @@ class CommandCSList : public Command
if (((count + 1 >= from && count + 1 <= to) || (!from && !to)) && ++nchans <= listmax)
{
bool isnoexpire = false;
- if (is_servadmin && (ci->HasFieldS("CS_NO_EXPIRE")))
+ if (is_servadmin && ci->IsNoExpire())
isnoexpire = true;
ListFormatter::ListEntry entry;
@@ -217,13 +216,13 @@ class CommandCSSetPrivate : public Command
if (params[1].equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable private";
- ci->SetS<bool>("CS_PRIVATE", true);
+ ci->SetPrivate(true);
source.Reply(_("Private option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable private";
- ci->UnsetS<bool>("CS_PRIVATE");
+ ci->SetPrivate(false);
source.Reply(_("Private option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -252,14 +251,11 @@ class CSList : public Module
CommandCSList commandcslist;
CommandCSSetPrivate commandcssetprivate;
- Serialize::Field<ChanServ::Channel, bool> priv;
-
public:
CSList(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, EventHook<Event::ChanInfo>(this)
, commandcslist(this)
, commandcssetprivate(this)
- , priv(this, "CS_PRIVATE")
{
}
@@ -268,7 +264,7 @@ class CSList : public Module
if (!show_all)
return;
- if (priv.HasExt(ci))
+ if (ci->IsPrivate())
info.AddOption(_("Private"));
}
};
diff --git a/modules/chanserv/log.cpp b/modules/chanserv/log.cpp
index 32025e6b0..b62e03d0e 100644
--- a/modules/chanserv/log.cpp
+++ b/modules/chanserv/log.cpp
@@ -61,12 +61,12 @@ class LogSettingImpl : public LogSetting
class LogSettingType : public Serialize::Type<LogSettingImpl>
{
public:
- Serialize::ObjectField<LogSettingImpl, ChanServ::Channel *> ci;
+ Serialize::ObjectField<LogSettingImpl, ChanServ::Channel *> channel;
Serialize::Field<LogSettingImpl, Anope::string> service_name, command_service, command_name, method, extra, creator;
Serialize::Field<LogSettingImpl, time_t> created;
LogSettingType(Module *me) : Serialize::Type<LogSettingImpl>(me)
- , ci(this, "ci", &LogSettingImpl::channel, true)
+ , channel(this, "channel", &LogSettingImpl::channel, true)
, service_name(this, "service_name", &LogSettingImpl::service_name)
, command_service(this, "command_service", &LogSettingImpl::command_service)
, command_name(this, "command_name", &LogSettingImpl::command_name)
@@ -80,12 +80,12 @@ class LogSettingType : public Serialize::Type<LogSettingImpl>
ChanServ::Channel *LogSettingImpl::GetChannel()
{
- return Get(&LogSettingType::ci);
+ return Get(&LogSettingType::channel);
}
void LogSettingImpl::SetChannel(ChanServ::Channel *ci)
{
- Set(&LogSettingType::ci, ci);
+ Set(&LogSettingType::channel, ci);
}
Anope::string LogSettingImpl::GetServiceName()
diff --git a/modules/chanserv/main/chanaccess.cpp b/modules/chanserv/main/chanaccess.cpp
index bf05cdf8b..75c70ed9c 100644
--- a/modules/chanserv/main/chanaccess.cpp
+++ b/modules/chanserv/main/chanaccess.cpp
@@ -23,12 +23,12 @@
ChanServ::Channel *ChanAccessImpl::GetChannel()
{
- return Get(&ChanAccessType<ChanServ::ChanAccess>::ci);
+ return Get(&ChanAccessType<ChanServ::ChanAccess>::channel);
}
-void ChanAccessImpl::SetChannel(ChanServ::Channel *ci)
+void ChanAccessImpl::SetChannel(ChanServ::Channel *channel)
{
- Object::Set(&ChanAccessType<ChanServ::ChanAccess>::ci, ci);
+ Object::Set(&ChanAccessType<ChanServ::ChanAccess>::channel, channel);
}
Anope::string ChanAccessImpl::GetCreator()
diff --git a/modules/chanserv/main/chanaccesstype.h b/modules/chanserv/main/chanaccesstype.h
index c755a7df5..b93747be7 100644
--- a/modules/chanserv/main/chanaccesstype.h
+++ b/modules/chanserv/main/chanaccesstype.h
@@ -23,7 +23,7 @@ class ChanAccessType : public Serialize::Type<T>
static_assert(std::is_base_of<ChanServ::ChanAccess, T>::value, "");
public:
- Serialize::ObjectField<ChanServ::ChanAccess, ChanServ::Channel *> ci;
+ Serialize::ObjectField<ChanServ::ChanAccess, ChanServ::Channel *> channel;
Serialize::Field<ChanServ::ChanAccess, Anope::string> mask;
Serialize::ObjectField<ChanServ::ChanAccess, Serialize::Object *> obj;
Serialize::Field<ChanServ::ChanAccess, Anope::string> creator;
@@ -31,7 +31,7 @@ class ChanAccessType : public Serialize::Type<T>
Serialize::Field<ChanServ::ChanAccess, time_t> created;
ChanAccessType(Module *me) : Serialize::Type<T>(me)
- , ci(this, "ci", &ChanServ::ChanAccess::channel, true)
+ , channel(this, "channel", &ChanServ::ChanAccess::channel, true)
, mask(this, "mask", &ChanServ::ChanAccess::mask)
, obj(this, "obj", &ChanServ::ChanAccess::object, true)
, creator(this, "creator", &ChanServ::ChanAccess::creator)
diff --git a/modules/chanserv/main/channel.cpp b/modules/chanserv/main/channel.cpp
index 67a4c94ec..a35c80901 100644
--- a/modules/chanserv/main/channel.cpp
+++ b/modules/chanserv/main/channel.cpp
@@ -76,7 +76,7 @@ time_t ChannelImpl::GetTimeRegistered()
return Get(&ChannelType::time_registered);
}
-void ChannelImpl::SetTimeRegistered(const time_t &t)
+void ChannelImpl::SetTimeRegistered(time_t t)
{
Set(&ChannelType::time_registered, t);
}
@@ -86,7 +86,7 @@ time_t ChannelImpl::GetLastUsed()
return Get(&ChannelType::last_used);
}
-void ChannelImpl::SetLastUsed(const time_t &t)
+void ChannelImpl::SetLastUsed(time_t t)
{
Set(&ChannelType::last_used, t);
}
@@ -116,7 +116,7 @@ time_t ChannelImpl::GetLastTopicTime()
return Get(&ChannelType::last_topic_time);
}
-void ChannelImpl::SetLastTopicTime(const time_t &t)
+void ChannelImpl::SetLastTopicTime(time_t t)
{
Set(&ChannelType::last_topic_time, t);
}
@@ -126,7 +126,7 @@ int16_t ChannelImpl::GetBanType()
return Get(&ChannelType::bantype);
}
-void ChannelImpl::SetBanType(const int16_t &i)
+void ChannelImpl::SetBanType(int16_t i)
{
Set(&ChannelType::bantype, i);
}
@@ -136,19 +136,19 @@ time_t ChannelImpl::GetBanExpire()
return Get(&ChannelType::banexpire);
}
-void ChannelImpl::SetBanExpire(const time_t &t)
+void ChannelImpl::SetBanExpire(time_t t)
{
Set(&ChannelType::banexpire, t);
}
BotInfo *ChannelImpl::GetBI()
{
- return Get(&ChannelType::bi);
+ return Get(&ChannelType::servicebot);
}
void ChannelImpl::SetBI(BotInfo *bi)
{
- Set(&ChannelType::bi, bi);
+ Set(&ChannelType::servicebot, bi);
}
ServiceBot *ChannelImpl::GetBot()
@@ -187,6 +187,166 @@ NickServ::Account *ChannelImpl::GetSuccessor()
return Get(&ChannelType::successor);
}
+bool ChannelImpl::IsGreet()
+{
+ return Get(&ChannelType::greet);
+}
+
+void ChannelImpl::SetGreet(bool greet)
+{
+ Set(&ChannelType::greet, greet);
+}
+
+bool ChannelImpl::IsFantasy()
+{
+ return Get(&ChannelType::fantasy);
+}
+
+void ChannelImpl::SetFantasy(bool fantasy)
+{
+ Set(&ChannelType::fantasy, fantasy);
+}
+
+bool ChannelImpl::IsNoAutoop()
+{
+ return Get(&ChannelType::noautoop);
+}
+
+void ChannelImpl::SetNoAutoop(bool noautoop)
+{
+ Set(&ChannelType::noautoop, noautoop);
+}
+
+bool ChannelImpl::IsPeace()
+{
+ return Get(&ChannelType::peace);
+}
+
+void ChannelImpl::SetPeace(bool peace)
+{
+ Set(&ChannelType::peace, peace);
+}
+
+bool ChannelImpl::IsSecureFounder()
+{
+ return Get(&ChannelType::securefounder);
+}
+
+void ChannelImpl::SetSecureFounder(bool securefounder)
+{
+ Set(&ChannelType::securefounder, securefounder);
+}
+
+bool ChannelImpl::IsRestricted()
+{
+ return Get(&ChannelType::restricted);
+}
+
+void ChannelImpl::SetRestricted(bool restricted)
+{
+ Set(&ChannelType::restricted, restricted);
+}
+
+bool ChannelImpl::IsSecure()
+{
+ return Get(&ChannelType::secure);
+}
+
+void ChannelImpl::SetSecure(bool secure)
+{
+ Set(&ChannelType::secure, secure);
+}
+
+bool ChannelImpl::IsSecureOps()
+{
+ return Get(&ChannelType::secureops);
+}
+
+void ChannelImpl::SetSecureOps(bool secureops)
+{
+ Set(&ChannelType::secureops, secureops);
+}
+
+bool ChannelImpl::IsSignKick()
+{
+ return Get(&ChannelType::signkick);
+}
+
+void ChannelImpl::SetSignKick(bool signkick)
+{
+ Set(&ChannelType::signkick, signkick);
+}
+
+bool ChannelImpl::IsSignKickLevel()
+{
+ return Get(&ChannelType::signkicklevel);
+}
+
+void ChannelImpl::SetSignKickLevel(bool signkicklevel)
+{
+ Set(&ChannelType::signkicklevel, signkicklevel);
+}
+
+bool ChannelImpl::IsNoExpire()
+{
+ return Get(&ChannelType::noexpire);
+}
+
+void ChannelImpl::SetNoExpire(bool noexpire)
+{
+ Set(&ChannelType::noexpire, noexpire);
+}
+
+bool ChannelImpl::IsKeepModes()
+{
+ return Get(&ChannelType::keepmodes);
+}
+
+void ChannelImpl::SetKeepModes(bool keepmodes)
+{
+ Set(&ChannelType::keepmodes, keepmodes);
+}
+
+bool ChannelImpl::IsPersist()
+{
+ return Get(&ChannelType::persist);
+}
+
+void ChannelImpl::SetPersist(bool persist)
+{
+ Set(&ChannelType::persist, persist);
+}
+
+bool ChannelImpl::IsTopicLock()
+{
+ return Get(&ChannelType::topiclock);
+}
+
+void ChannelImpl::SetTopicLock(bool topiclock)
+{
+ Set(&ChannelType::topiclock, topiclock);
+}
+
+bool ChannelImpl::IsKeepTopic()
+{
+ return Get(&ChannelType::keeptopic);
+}
+
+void ChannelImpl::SetKeepTopic(bool keeptopic)
+{
+ Set(&ChannelType::keeptopic, keeptopic);
+}
+
+bool ChannelImpl::IsPrivate()
+{
+ return Get(&ChannelType::_private);
+}
+
+void ChannelImpl::SetPrivate(bool _private)
+{
+ Set(&ChannelType::_private, _private);
+}
+
ChanServ::ChanAccess *ChannelImpl::GetAccess(unsigned index)
{
std::vector<ChanServ::ChanAccess *> a = GetRefs<ChanServ::ChanAccess *>();
@@ -200,8 +360,8 @@ ChanServ::AccessGroup ChannelImpl::AccessFor(const User *u, bool updateLastUsed)
if (u == NULL)
return group;
- const NickServ::Account *nc = u->Account();
- if (nc == NULL && !this->HasFieldS("NS_SECURE") && u->IsRecognized())
+ NickServ::Account *nc = u->Account();
+ if (nc == NULL && !nc->IsSecure() && u->IsRecognized())
{
NickServ::Nick *na = NickServ::FindNick(u->nick);
if (na != NULL)
diff --git a/modules/chanserv/main/channel.h b/modules/chanserv/main/channel.h
index 94f56ddd4..fd9a357eb 100644
--- a/modules/chanserv/main/channel.h
+++ b/modules/chanserv/main/channel.h
@@ -29,6 +29,22 @@ class ChannelImpl : public ChanServ::Channel
int16_t bantype = 0;
time_t banexpire = 0;
BotInfo *bi = nullptr;
+ bool greet = false;
+ bool fantasy = false;
+ bool noautoop = false;
+ bool peace = false;
+ bool securefounder = false;
+ bool restricted = false;
+ bool secure = false;
+ bool secureops = false;
+ bool signkick = false;
+ bool signkicklevel = false;
+ bool noexpire = false;
+ bool keepmodes = false;
+ bool persist = false;
+ bool topiclock = false;
+ bool keeptopic = false;
+ bool _private = false;
public:
ChannelImpl(Serialize::TypeBase *type) : ChanServ::Channel(type) { }
@@ -43,10 +59,10 @@ class ChannelImpl : public ChanServ::Channel
void SetDesc(const Anope::string &) override;
time_t GetTimeRegistered() override;
- void SetTimeRegistered(const time_t &) override;
+ void SetTimeRegistered(time_t) override;
time_t GetLastUsed() override;
- void SetLastUsed(const time_t &) override;
+ void SetLastUsed(time_t) override;
Anope::string GetLastTopic() override;
void SetLastTopic(const Anope::string &) override;
@@ -55,13 +71,13 @@ class ChannelImpl : public ChanServ::Channel
void SetLastTopicSetter(const Anope::string &) override;
time_t GetLastTopicTime() override;
- void SetLastTopicTime(const time_t &) override;
+ void SetLastTopicTime(time_t) override;
int16_t GetBanType() override;
- void SetBanType(const int16_t &) override;
+ void SetBanType(int16_t) override;
time_t GetBanExpire() override;
- void SetBanExpire(const time_t &) override;
+ void SetBanExpire(time_t) override;
BotInfo *GetBI() override;
void SetBI(BotInfo *) override;
@@ -77,11 +93,59 @@ class ChannelImpl : public ChanServ::Channel
void SetSuccessor(NickServ::Account *nc) override;
NickServ::Account *GetSuccessor() override;
+ bool IsGreet() override;
+ void SetGreet(bool) override;
+
+ bool IsFantasy() override;
+ void SetFantasy(bool) override;
+
+ bool IsNoAutoop() override;
+ void SetNoAutoop(bool) override;
+
+ bool IsPeace() override;
+ void SetPeace(bool) override;
+
+ bool IsSecureFounder() override;
+ void SetSecureFounder(bool) override;
+
+ bool IsRestricted() override;
+ void SetRestricted(bool) override;
+
+ bool IsSecure() override;
+ void SetSecure(bool) override;
+
+ bool IsSecureOps() override;
+ void SetSecureOps(bool) override;
+
+ bool IsSignKick() override;
+ void SetSignKick(bool) override;
+
+ bool IsSignKickLevel() override;
+ void SetSignKickLevel(bool) override;
+
+ bool IsNoExpire() override;
+ void SetNoExpire(bool) override;
+
+ bool IsKeepModes() override;
+ void SetKeepModes(bool) override;
+
+ bool IsPersist() override;
+ void SetPersist(bool) override;
+
+ bool IsTopicLock() override;
+ void SetTopicLock(bool) override;
+
+ bool IsKeepTopic() override;
+ void SetKeepTopic(bool) override;
+
+ bool IsPrivate() override;
+ void SetPrivate(bool) override;
+
bool IsFounder(const User *user) override;
- ChanServ::ChanAccess *GetAccess(unsigned index) /*const*/ override;
+ ChanServ::ChanAccess *GetAccess(unsigned index) override;
ChanServ::AccessGroup AccessFor(const User *u, bool = true) override;
ChanServ::AccessGroup AccessFor(NickServ::Account *nc, bool = true) override;
- unsigned GetAccessCount()/* const*/ override;
+ unsigned GetAccessCount() override;
void ClearAccess() override;
AutoKick* AddAkick(const Anope::string &user, NickServ::Account *akicknc, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) override;
AutoKick* AddAkick(const Anope::string &user, const Anope::string &mask, const Anope::string &reason, time_t t = Anope::CurTime, time_t lu = 0) override;
diff --git a/modules/chanserv/main/channeltype.cpp b/modules/chanserv/main/channeltype.cpp
index 37c290ef1..3f72cbb6b 100644
--- a/modules/chanserv/main/channeltype.cpp
+++ b/modules/chanserv/main/channeltype.cpp
@@ -32,7 +32,23 @@ ChannelType::ChannelType(Module *me) : Serialize::Type<ChannelImpl>(me)
, banexpire(this, "banexpire", &ChannelImpl::banexpire)
, founder(this, "founder", &ChannelImpl::founder)
, successor(this, "successor", &ChannelImpl::successor)
- , bi(this, "bi", &ChannelImpl::bi)
+ , servicebot(this, "servicebot", &ChannelImpl::bi)
+ , greet(this, "greet", &ChannelImpl::greet)
+ , fantasy(this, "fantasy", &ChannelImpl::fantasy)
+ , noautoop(this, "noautoop", &ChannelImpl::noautoop)
+ , peace(this, "peace", &ChannelImpl::peace)
+ , securefounder(this, "securefounder", &ChannelImpl::securefounder)
+ , restricted(this, "restricted", &ChannelImpl::restricted)
+ , secure(this, "secure", &ChannelImpl::secure)
+ , secureops(this, "secureops", &ChannelImpl::secureops)
+ , signkick(this, "signkick", &ChannelImpl::signkick)
+ , signkicklevel(this, "signkicklevel", &ChannelImpl::signkicklevel)
+ , noexpire(this, "noexpire", &ChannelImpl::noexpire)
+ , keepmodes(this, "keepmodes", &ChannelImpl::keepmodes)
+ , persist(this, "persist", &ChannelImpl::persist)
+ , topiclock(this, "topiclock", &ChannelImpl::topiclock)
+ , keeptopic(this, "keeptopic", &ChannelImpl::keeptopic)
+ , _private(this, "private", &ChannelImpl::_private)
{
}
diff --git a/modules/chanserv/main/channeltype.h b/modules/chanserv/main/channeltype.h
index 1f1c92201..4f833c82b 100644
--- a/modules/chanserv/main/channeltype.h
+++ b/modules/chanserv/main/channeltype.h
@@ -45,7 +45,11 @@ class ChannelType : public Serialize::Type<ChannelImpl>
/* Who gets the channel if the founder nick is dropped or expires */
Serialize::ObjectField<ChannelImpl, NickServ::Account *> successor;
- Serialize::ObjectField<ChannelImpl, BotInfo *> bi;
+ Serialize::ObjectField<ChannelImpl, BotInfo *> servicebot;
+
+ Serialize::Field<ChannelImpl, bool> greet, fantasy, noautoop, peace, securefounder,
+ restricted, secure, secureops, signkick, signkicklevel, noexpire, keepmodes,
+ persist, topiclock, keeptopic, _private;
ChannelType(Module *);
diff --git a/modules/chanserv/main/chanserv.cpp b/modules/chanserv/main/chanserv.cpp
index c6b30c2df..b6aedb0dd 100644
--- a/modules/chanserv/main/chanserv.cpp
+++ b/modules/chanserv/main/chanserv.cpp
@@ -249,16 +249,9 @@ class ChanServCore : public Module
spacesepstream(conf->GetModule(this)->Get<Anope::string>("defaults", "greet fantasy")).GetTokens(defaults);
if (defaults.empty())
- {
- defaults.push_back("KEEPTOPIC");
- defaults.push_back("CS_SECURE");
- defaults.push_back("SECUREFOUNDER");
- defaults.push_back("SIGNKICK");
- }
+ defaults = { "keeptopic", "secure", "securefounder", "signkick" };
else if (defaults[0].equals_ci("none"))
- {
defaults.clear();
- }
always_lower = conf->GetModule(this)->Get<bool>("always_lower_ts");
}
@@ -408,7 +401,7 @@ class ChanServCore : public Module
void OnChannelSync(Channel *c) override
{
- bool perm = c->HasMode("PERM") || (c->ci && c->ci->HasFieldS("PERSIST"));
+ bool perm = c->HasMode("PERM") || (c->ci && c->ci->IsPersist());
if (!perm && !c->botchannel && (c->users.empty() || (c->users.size() == 1 && c->users.begin()->second->user->server == Me)))
{
this->Hold(c);
@@ -470,7 +463,7 @@ class ChanServCore : public Module
/* Find all persistent channels and create them, as we are about to finish burst to our uplink */
for (ChanServ::Channel *ci : Serialize::GetObjects<ChanServ::Channel *>())
{
- if (ci->HasFieldS("PERSIST"))
+ if (ci->IsPersist())
{
bool c;
ci->c = Channel::FindOrCreate(ci->GetName(), c, ci->GetTimeRegistered());
@@ -508,9 +501,9 @@ class ChanServCore : public Module
return;
/* Mark the channel as persistent */
if (ci->c->HasMode("PERM"))
- ci->SetS("PERSIST", true);
+ ci->SetPersist(true);
/* Persist may be in def cflags, set it here */
- else if (ci->HasFieldS("PERSIST"))
+ else if (ci->IsPersist())
ci->c->SetMode(NULL, "PERM");
}
@@ -550,7 +543,7 @@ class ChanServCore : public Module
return;
time_t chanserv_expire = Config->GetModule(this)->Get<time_t>("expire", "14d");
- if (!ci->HasFieldS("CS_NO_EXPIRE") && chanserv_expire && !Anope::NoExpire && ci->GetLastUsed() != Anope::CurTime)
+ if (!ci->IsNoExpire() && chanserv_expire && !Anope::NoExpire && ci->GetLastUsed() != Anope::CurTime)
info[_("Expires")] = Anope::strftime(ci->GetLastUsed() + chanserv_expire, source.GetAccount());
}
diff --git a/modules/chanserv/mode.cpp b/modules/chanserv/mode.cpp
index 7a9fd38d6..b20558bc0 100644
--- a/modules/chanserv/mode.cpp
+++ b/modules/chanserv/mode.cpp
@@ -56,13 +56,13 @@ class ModeLockImpl : public ModeLock
class ModeLockType : public Serialize::Type<ModeLockImpl>
{
public:
- Serialize::ObjectField<ModeLockImpl, ChanServ::Channel *> ci;
+ Serialize::ObjectField<ModeLockImpl, ChanServ::Channel *> channel;
Serialize::Field<ModeLockImpl, bool> set;
Serialize::Field<ModeLockImpl, Anope::string> name, param, setter;
Serialize::Field<ModeLockImpl, time_t> created;
ModeLockType(Module *me) : Serialize::Type<ModeLockImpl>(me)
- , ci(this, "ci", &ModeLockImpl::channel, true)
+ , channel(this, "channel", &ModeLockImpl::channel, true)
, set(this, "set", &ModeLockImpl::set)
, name(this, "name", &ModeLockImpl::name)
, param(this, "param", &ModeLockImpl::param)
@@ -74,12 +74,12 @@ class ModeLockType : public Serialize::Type<ModeLockImpl>
ChanServ::Channel *ModeLockImpl::GetChannel()
{
- return Get(&ModeLockType::ci);
+ return Get(&ModeLockType::channel);
}
void ModeLockImpl::SetChannel(ChanServ::Channel *ci)
{
- Set(&ModeLockType::ci, ci);
+ Set(&ModeLockType::channel, ci);
}
bool ModeLockImpl::GetSet()
@@ -574,7 +574,7 @@ class CommandCSMode : public Command
ChanServ::AccessGroup targ_access = ci->AccessFor(uc->user);
- if (uc->user->IsProtected() || (ci->HasFieldS("PEACE") && targ_access >= u_access && !can_override))
+ if (uc->user->IsProtected() || (ci->IsPeace() && targ_access >= u_access && !can_override))
{
source.Reply(_("You do not have the access to change the modes of \002{0}\002."), uc->user->nick.c_str());
continue;
@@ -607,7 +607,7 @@ class CommandCSMode : public Command
if (source.GetUser() != target)
{
ChanServ::AccessGroup targ_access = ci->AccessFor(target);
- if (ci->HasFieldS("PEACE") && targ_access >= u_access && !can_override)
+ if (ci->IsPeace() && targ_access >= u_access && !can_override)
{
source.Reply(_("You do not have the access to change the modes of \002{0}\002"), target->nick);
break;
@@ -827,7 +827,7 @@ class CommandCSModes : public Command
}
}
- if (!override && !m.first && u != targ && (targ->IsProtected() || (ci->HasFieldS("PEACE") && targ_access >= u_access)))
+ if (!override && !m.first && u != targ && (targ->IsProtected() || (ci->IsPeace() && targ_access >= u_access)))
{
if (!can_override)
{
diff --git a/modules/chanserv/register.cpp b/modules/chanserv/register.cpp
index 0c7d77a8f..1e2a6a2bd 100644
--- a/modules/chanserv/register.cpp
+++ b/modules/chanserv/register.cpp
@@ -42,7 +42,7 @@ class CommandCSRegister : public Command
return;
}
- if (nc->HasFieldS("UNCONFIRMED"))
+ if (nc->IsUnconfirmed())
{
source.Reply(_("You must confirm your account before you can register a channel."));
return;
diff --git a/modules/chanserv/seen.cpp b/modules/chanserv/seen.cpp
index 5a2237d8a..113691343 100644
--- a/modules/chanserv/seen.cpp
+++ b/modules/chanserv/seen.cpp
@@ -114,7 +114,7 @@ static bool ShouldHide(const Anope::string &channel, User *u)
if (targetchan && targetchan->HasMode("SECRET"))
return true;
- else if (targetchan_ci && targetchan_ci->HasExt("CS_PRIVATE"))
+ else if (targetchan_ci && targetchan_ci->IsPrivate())
return true;
else if (u && u->HasMode("PRIV"))
return true;
diff --git a/modules/chanserv/set.cpp b/modules/chanserv/set.cpp
index 1d49629db..89eb4985a 100644
--- a/modules/chanserv/set.cpp
+++ b/modules/chanserv/set.cpp
@@ -118,13 +118,13 @@ class CommandCSSetAutoOp : public Command
if (params[1].equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable autoop";
- ci->UnsetS<bool>("NOAUTOOP");
+ ci->SetNoAutoop(false);
source.Reply(_("Services will now automatically give modes to users in \002{0}\002."), ci->GetName());
}
else if (params[1].equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable autoop";
- ci->SetS<bool>("NOAUTOOP", true);
+ ci->SetNoAutoop(true);
source.Reply(_("Services will no longer automatically give modes to users in \002{0}\002."), ci->GetName());
}
else
@@ -296,7 +296,7 @@ class CommandCSSetFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -374,7 +374,7 @@ class CommandCSSetKeepModes : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keep modes";
- ci->SetS<bool>("CS_KEEP_MODES", true);
+ ci->SetKeepModes(true);
source.Reply(_("Keep modes for \002{0}\002 is now \002on\002."), ci->GetName());
if (ci->c)
for (const std::pair<Anope::string, Anope::string> &p : ci->c->GetModes())
@@ -388,7 +388,7 @@ class CommandCSSetKeepModes : public Command
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keep modes";
- ci->UnsetS<bool>("CS_KEEP_MODES");
+ ci->SetKeepModes(false);
source.Reply(_("Keep modes for \002{0}\002 is now \002off\002."), ci->GetName());
for (ChanServ::Mode *m : ci->GetRefs<ChanServ::Mode *>())
m->Delete();
@@ -447,13 +447,13 @@ class CommandCSSetPeace : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable peace";
- ci->SetS<bool>("PEACE", true);
+ ci->SetPeace(true);
source.Reply(_("Peace option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable peace";
- ci->UnsetS<bool>("PEACE");
+ ci->SetPeace(false);
source.Reply(_("Peace option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -522,9 +522,9 @@ class CommandCSSetPersist : public Command
if (params[1].equals_ci("ON"))
{
- if (!ci->HasFieldS("PERSIST"))
+ if (!ci->IsPersist())
{
- ci->SetS<bool>("PERSIST", true);
+ ci->SetPersist(true);
/* Channel doesn't exist, create it */
if (!ci->c)
@@ -575,9 +575,9 @@ class CommandCSSetPersist : public Command
}
else if (params[1].equals_ci("OFF"))
{
- if (ci->HasFieldS("PERSIST"))
+ if (ci->IsPersist())
{
- ci->UnsetS<bool>("PERSIST");
+ ci->SetPersist(false);
ServiceBot *ChanServ = Config->GetClient("ChanServ"),
*BotServ = Config->GetClient("BotServ");
@@ -665,13 +665,13 @@ class CommandCSSetRestricted : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable restricted";
- ci->SetS<bool>("RESTRICTED", true);
+ ci->SetRestricted(true);
source.Reply(_("Restricted access option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable restricted";
- ci->UnsetS<bool>("RESTRICTED");
+ ci->SetRestricted(false);
source.Reply(_("Restricted access option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -728,13 +728,13 @@ class CommandCSSetSecure : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure";
- ci->SetS<bool>("CS_SECURE", true);
+ ci->SetSecure(true);
source.Reply(_("Secure option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure";
- ci->UnsetS<bool>("CS_SECURE");
+ ci->SetSecure(false);
source.Reply(_("Secure option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -784,7 +784,7 @@ class CommandCSSetSecureFounder : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -793,13 +793,13 @@ class CommandCSSetSecureFounder : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure founder";
- ci->SetS<bool>("SECUREFOUNDER", true);
+ ci->SetSecureFounder(true);
source.Reply(_("Secure founder option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure founder";
- ci->UnsetS<bool>("SECUREFOUNDER");
+ ci->SetSecureFounder(false);
source.Reply(_("Secure founder option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -861,13 +861,13 @@ class CommandCSSetSecureOps : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable secure ops";
- ci->SetS<bool>("SECUREOPS", true);
+ ci->SetSecureOps(true);
source.Reply(_("Secure ops option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable secure ops";
- ci->UnsetS<bool>("SECUREOPS");
+ ci->SetSecureOps(false);
source.Reply(_("Secure ops option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -924,22 +924,22 @@ class CommandCSSetSignKick : public Command
if (param.equals_ci("ON"))
{
- ci->SetS<bool>("SIGNKICK", true);
- ci->UnsetS<bool>("SIGNKICK_LEVEL");
+ ci->SetSignKick(true);
+ ci->SetSignKickLevel(false);
source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002."), ci->GetName());
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick";
}
else if (param.equals_ci("LEVEL"))
{
- ci->SetS<bool>("SIGNKICK_LEVEL", true);
- ci->UnsetS<bool>("SIGNKICK");
+ ci->SetSignKick(false);
+ ci->SetSignKickLevel(true);
source.Reply(_("Signed kick option for \002{0}\002 is now \002on\002, but depends of the privileges of the user that is using the command."), ci->GetName());
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable sign kick level";
}
else if (param.equals_ci("OFF"))
{
- ci->UnsetS<bool>("SIGNKICK");
- ci->UnsetS<bool>("SIGNKICK_LEVEL");
+ ci->SetSignKick(false);
+ ci->SetSignKickLevel(false);
source.Reply(_("Signed kick option for \002{0}\002 is now \002off\002."), ci->GetName());
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable sign kick";
}
@@ -991,7 +991,7 @@ class CommandCSSetSuccessor : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- if (MOD_RESULT != EVENT_ALLOW && (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
+ if (MOD_RESULT != EVENT_ALLOW && (ci->IsSecureFounder() ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && source.permission.empty() && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
@@ -1073,13 +1073,13 @@ class CommandCSSetNoexpire : public Command
if (param.equals_ci("ON"))
{
Log(LOG_ADMIN, source, this, ci) << "to enable noexpire";
- ci->SetS<bool>("CS_NO_EXPIRE", true);
+ ci->SetNoExpire(true);
source.Reply(_("Channel \002{0} will not\002 expire."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(LOG_ADMIN, source, this, ci) << "to disable noexpire";
- ci->UnsetS<bool>("CS_NO_EXPIRE");
+ ci->SetNoExpire(false);
source.Reply(_("Channel \002{0} will\002 expire."), ci->GetName());
}
else
@@ -1107,9 +1107,6 @@ class CSSet : public Module
, public EventHook<ChanServ::Event::PreChanExpire>
, public EventHook<Event::ChanInfo>
{
- Serialize::Field<ChanServ::Channel, bool> noautoop, peace, securefounder,
- restricted, secure, secureops, signkick, signkick_level, noexpire, keep_modes, persist;
-
CommandCSSet commandcsset;
CommandCSSetAutoOp commandcssetautoop;
CommandCSSetBanType commandcssetbantype;
@@ -1143,18 +1140,6 @@ class CSSet : public Module
, EventHook<ChanServ::Event::PreChanExpire>(this)
, EventHook<Event::ChanInfo>(this)
- , noautoop(this, "NOAUTOOP")
- , peace(this, "PEACE")
- , securefounder(this, "SECUREFOUNDER")
- , restricted(this, "RESTRICTED")
- , secure(this, "CS_SECURE")
- , secureops(this, "SECUREOPS")
- , signkick(this, "SIGNKICK")
- , signkick_level(this, "SIGNKICK_LEVEL")
- , noexpire(this, "CS_NO_EXPIRE")
- , keep_modes(this, "CS_KEEP_MODES")
- , persist(this, "PERSIST")
-
, commandcsset(this)
, commandcssetautoop(this)
, commandcssetbantype(this)
@@ -1187,14 +1172,14 @@ class CSSet : public Module
void OnChannelSync(Channel *c) override
{
- if (c->ci && keep_modes.HasExt(c->ci))
+ if (c->ci && c->ci->IsKeepModes())
for (ChanServ::Mode *m : c->ci->GetRefs<ChanServ::Mode *>())
c->SetMode(c->ci->WhoSends(), m->GetMode(), m->GetParam());
}
EventReturn OnCheckKick(User *u, Channel *c, Anope::string &mask, Anope::string &reason) override
{
- if (!c->ci || !restricted.HasExt(c->ci) || c->MatchesList(u, "EXCEPT"))
+ if (!c->ci || !c->ci->IsRestricted() || c->MatchesList(u, "EXCEPT"))
return EVENT_CONTINUE;
if (c->ci->AccessFor(u).empty() && (!c->ci->GetFounder() || u->Account() != c->ci->GetFounder()))
@@ -1205,9 +1190,11 @@ class CSSet : public Module
void OnDelChan(ChanServ::Channel *ci) override
{
- if (ci->c && persist.HasExt(ci))
+ if (ci->c && ci->IsPersist())
+ {
ci->c->RemoveMode(ci->WhoSends(), "PERM", "", false);
- persist.Unset(ci);
+ ci->SetPersist(false);
+ }
}
EventReturn OnChannelModeSet(Channel *c, const MessageSource &setter, ChannelMode *mode, const Anope::string &param) override
@@ -1216,7 +1203,7 @@ class CSSet : public Module
{
/* Channel mode +P or so was set, mark this channel as persistent */
if (mode->name == "PERM")
- persist.Set(c->ci, true);
+ c->ci->SetPersist(true);
if (mode->type != MODE_STATUS && !c->syncing && Me->IsSynced() && (!inhabit || !inhabit->HasExt(c)))
{
@@ -1238,7 +1225,7 @@ class CSSet : public Module
if (mode->name == "PERM")
{
if (c->ci)
- persist.Unset(c->ci);
+ c->ci->SetPersist(false);
}
if (c->ci && mode->type != MODE_STATUS && !c->syncing && Me->IsSynced() && (!inhabit || !inhabit->HasExt(c)))
@@ -1251,7 +1238,7 @@ class CSSet : public Module
void OnJoinChannel(User *u, Channel *c) override
{
- if (persist_lower_ts && c->ci && persist.HasExt(c->ci) && c->creation_time > c->ci->GetTimeRegistered())
+ if (persist_lower_ts && c->ci && c->ci->IsPersist() && c->creation_time > c->ci->GetTimeRegistered())
{
Log(LOG_DEBUG) << "Changing TS of " << c->name << " from " << c->creation_time << " to " << c->ci->GetTimeRegistered();
c->creation_time = c->ci->GetTimeRegistered();
@@ -1264,9 +1251,9 @@ class CSSet : public Module
{
if (chan->ci)
{
- if (noautoop.HasExt(chan->ci))
+ if (chan->ci->IsNoAutoop())
give_modes = false;
- if (secureops.HasExt(chan->ci))
+ if (chan->ci->IsSecureOps())
// This overrides what chanserv does because it is loaded after chanserv
take_modes = true;
}
@@ -1274,7 +1261,7 @@ class CSSet : public Module
void OnPreChanExpire(ChanServ::Channel *ci, bool &expire) override
{
- if (noexpire.HasExt(ci))
+ if (ci->IsNoExpire())
expire = false;
}
@@ -1283,25 +1270,25 @@ class CSSet : public Module
if (!show_all)
return;
- if (peace.HasExt(ci))
+ if (ci->IsPeace())
info.AddOption(_("Peace"));
- if (restricted.HasExt(ci))
+ if (ci->IsRestricted())
info.AddOption(_("Restricted access"));
- if (secure.HasExt(ci))
+ if (ci->IsSecure())
info.AddOption(_("Security"));
- if (securefounder.HasExt(ci))
+ if (ci->IsSecureFounder())
info.AddOption(_("Secure founder"));
- if (secureops.HasExt(ci))
+ if (ci->IsSecureOps())
info.AddOption(_("Secure ops"));
- if (signkick.HasExt(ci) || signkick_level.HasExt(ci))
+ if (ci->IsSignKick() || ci->IsSignKickLevel())
info.AddOption(_("Signed kicks"));
- if (persist.HasExt(ci))
+ if (ci->IsPersist())
info.AddOption(_("Persistent"));
- if (noexpire.HasExt(ci))
+ if (ci->IsNoExpire())
info.AddOption(_("No expire"));
- if (keep_modes.HasExt(ci))
+ if (ci->IsKeepModes())
info.AddOption(_("Keep modes"));
- if (noautoop.HasExt(ci))
+ if (ci->IsNoAutoop())
info.AddOption(_("No auto-op"));
}
};
diff --git a/modules/chanserv/set_misc.cpp b/modules/chanserv/set_misc.cpp
index b2c0dc50c..ade42675d 100644
--- a/modules/chanserv/set_misc.cpp
+++ b/modules/chanserv/set_misc.cpp
@@ -53,7 +53,7 @@ class CSMiscDataType : public Serialize::Type<CSMiscDataImpl>
Serialize::Field<CSMiscDataImpl, Anope::string> name, data;
CSMiscDataType(Module *me) : Serialize::Type<CSMiscDataImpl>(me)
- , owner(this, "owner", &CSMiscDataImpl::channel, true)
+ , owner(this, "channel", &CSMiscDataImpl::channel, true)
, name(this, "name", &CSMiscDataImpl::name)
, data(this, "data", &CSMiscDataImpl::data)
{
diff --git a/modules/chanserv/topic.cpp b/modules/chanserv/topic.cpp
index 76a816c13..db4d25dbd 100644
--- a/modules/chanserv/topic.cpp
+++ b/modules/chanserv/topic.cpp
@@ -63,13 +63,13 @@ class CommandCSSetKeepTopic : public Command
if (param.equals_ci("ON"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to enable keeptopic";
- ci->SetS<bool>("KEEPTOPIC", true);
+ ci->SetKeepTopic(true);
source.Reply(_("Topic retention option for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (param.equals_ci("OFF"))
{
Log(source.AccessFor(ci).HasPriv("SET") ? LOG_COMMAND : LOG_OVERRIDE, source, this, ci) << "to disable keeptopic";
- ci->UnsetS<bool>("KEEPTOPIC");
+ ci->SetKeepTopic(false);
source.Reply(_("Topic retention option for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -89,8 +89,6 @@ class CommandCSSetKeepTopic : public Command
class CommandCSTopic : public Command
{
- ExtensibleRef<bool> topiclock;
-
void Lock(CommandSource &source, ChanServ::Channel *ci, const std::vector<Anope::string> &params)
{
if (Anope::ReadOnly)
@@ -104,7 +102,7 @@ class CommandCSTopic : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- topiclock->Set(ci, true);
+ ci->SetTopicLock(true);
source.Reply(_("Topic lock option for \002{0}\002 is now \002on\002."), ci->GetName());
}
@@ -121,17 +119,17 @@ class CommandCSTopic : public Command
if (MOD_RESULT == EVENT_STOP)
return;
- topiclock->Unset(ci);
+ ci->SetTopicLock(false);
source.Reply(_("Topic lock option for \002{0}\002 is now \002off\002."), ci->GetName());
}
void Set(CommandSource &source, ChanServ::Channel *ci, const Anope::string &topic)
{
- bool has_topiclock = topiclock->HasExt(ci);
- topiclock->Unset(ci);
+ bool has_topiclock = ci->IsTopicLock();
+ ci->SetTopicLock(false);
ci->c->ChangeTopic(source.GetNick(), topic, Anope::CurTime);
if (has_topiclock)
- topiclock->Set(ci, true);
+ ci->SetTopicLock(true);
bool override = !source.AccessFor(ci).HasPriv("TOPIC");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << (!topic.empty() ? "to change the topic to: " : "to unset the topic") << (!topic.empty() ? topic : "");
@@ -156,8 +154,7 @@ class CommandCSTopic : public Command
}
public:
- CommandCSTopic(Module *creator) : Command(creator, "chanserv/topic", 2, 3),
- topiclock("TOPICLOCK")
+ CommandCSTopic(Module *creator) : Command(creator, "chanserv/topic", 2, 3)
{
this->SetDesc(_("Manipulate the topic of the specified channel"));
this->SetSyntax(_("\037channel\037 [SET] [\037topic\037]"));
@@ -240,8 +237,6 @@ class CSTopic : public Module
CommandCSTopic commandcstopic;
CommandCSSetKeepTopic commandcssetkeeptopic;
- Serialize::Field<ChanServ::Channel, bool> topiclock, keeptopic;
-
ServiceReference<ModeLocks> mlocks;
public:
@@ -251,8 +246,6 @@ class CSTopic : public Module
, EventHook<Event::ChanInfo>(this)
, commandcstopic(this)
, commandcssetkeeptopic(this)
- , topiclock(this, "TOPICLOCK")
- , keeptopic(this, "KEEPTOPIC")
{
}
@@ -262,7 +255,7 @@ class CSTopic : public Module
if (c->ci)
{
/* Update channel topic */
- if ((topiclock.HasExt(c->ci) || keeptopic.HasExt(c->ci)) && c->ci->GetLastTopic() != c->topic)
+ if ((c->ci->IsTopicLock() || c->ci->IsKeepTopic()) && c->ci->GetLastTopic() != c->topic)
{
c->ChangeTopic(!c->ci->GetLastTopicSetter().empty() ? c->ci->GetLastTopicSetter() : c->ci->WhoSends()->nick, c->ci->GetLastTopic(), c->ci->GetLastTopicTime() ? c->ci->GetLastTopicTime() : Anope::CurTime);
}
@@ -279,7 +272,7 @@ class CSTopic : public Module
* This desyncs what is really set with what we have stored, and we end up resetting the topic often when
* it is not required
*/
- if (topiclock.HasExt(c->ci) && c->ci->GetLastTopic() != c->topic && (!source || !c->ci->AccessFor(source).HasPriv("TOPIC")))
+ if (c->ci->IsTopicLock() && c->ci->GetLastTopic() != c->topic && (!source || !c->ci->AccessFor(source).HasPriv("TOPIC")))
{
c->ChangeTopic(c->ci->GetLastTopicSetter(), c->ci->GetLastTopic(), c->ci->GetLastTopicTime());
}
@@ -293,9 +286,9 @@ class CSTopic : public Module
void OnChanInfo(CommandSource &source, ChanServ::Channel *ci, InfoFormatter &info, bool show_all) override
{
- if (keeptopic.HasExt(ci))
+ if (ci->IsKeepTopic())
info.AddOption(_("Topic retention"));
- if (topiclock.HasExt(ci))
+ if (ci->IsTopicLock())
info.AddOption(_("Topic lock"));
ModeLock *secret = mlocks ? mlocks->GetMLock(ci, "SECRET") : nullptr;
diff --git a/modules/chanserv/updown.cpp b/modules/chanserv/updown.cpp
index 8df6be26b..38ed65776 100644
--- a/modules/chanserv/updown.cpp
+++ b/modules/chanserv/updown.cpp
@@ -117,7 +117,7 @@ class CommandCSUp : public Command
return;
}
- if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ if (source.GetUser() && u != source.GetUser() && c->ci->IsPeace())
{
if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
@@ -222,7 +222,7 @@ class CommandCSDown : public Command
return;
}
- if (source.GetUser() && u != source.GetUser() && c->ci->HasFieldS("PEACE"))
+ if (source.GetUser() && u != source.GetUser() && c->ci->IsPeace())
{
if (c->ci->AccessFor(u) >= c->ci->AccessFor(source.GetUser()))
{
diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp
index 7483b2d34..2f9d0f209 100644
--- a/modules/database/flatfile.cpp
+++ b/modules/database/flatfile.cpp
@@ -179,7 +179,7 @@ class DBFlatFile : public Module
if (entry == nullptr)
return;
- entry->SetOwner(nick->GetAccount());
+ entry->SetAccount(nick->GetAccount());
entry->SetChannel(data["channel"]);
entry->SetKey(data["key"]);
}
diff --git a/modules/database/old.cpp b/modules/database/old.cpp
index 61be22e9d..ef93aec66 100644
--- a/modules/database/old.cpp
+++ b/modules/database/old.cpp
@@ -479,10 +479,10 @@ static void LoadNicks()
NickServ::Account *nc = Serialize::New<NickServ::Account *>();
nc->SetDisplay(buffer);
- const Anope::string settings[] = { "killprotect", "kill_quick", "ns_secure", "ns_private", "hide_email",
- "hide_mask", "hide_quit", "memo_signon", "memo_receive", "autoop", "msg", "ns_keepmodes" };
+ const Anope::string settings[] = { "killprotect", "kill_quick", "secure", "private", "hide_email",
+ "hide_mask", "hide_quit", "memo_signon", "memo_receive", "autoop", "msg", "keepmodes" };
for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
- nc->UnsetS<bool>(settings[j].upper());
+ nc->UnsetS<bool>(settings[j]);
char pwbuf[32];
READ(read_buffer(pwbuf, f));
@@ -505,7 +505,7 @@ static void LoadNicks()
READ(read_string(buffer, f));
if (!buffer.empty())
- nc->Extend<Anope::string>("greet", buffer);
+ nc->SetGreet(buffer);
uint32_t u32;
READ(read_uint32(&u32, f));
@@ -516,33 +516,34 @@ static void LoadNicks()
READ(read_uint32(&u32, f));
if (u32 & OLD_NI_KILLPROTECT)
- nc->SetS<bool>("KILLPROTECT", true);
+ nc->SetKillProtect(true);
if (u32 & OLD_NI_SECURE)
- nc->SetS<bool>("NS_SECURE", true);
+ nc->SetSecure(true);
if (u32 & OLD_NI_MSG)
- nc->SetS<bool>("MSG", true);
+ nc->SetMsg(true);
if (u32 & OLD_NI_MEMO_HARDMAX)
- nc->SetS<bool>("MEMO_HARDMAX", true);
+ if (MemoServ::MemoInfo *mi = nc->GetMemos())
+ mi->SetHardMax(true);
if (u32 & OLD_NI_MEMO_SIGNON)
- nc->SetS<bool>("MEMO_SIGNON", true);
+ nc->SetMemoSignon(true);
if (u32 & OLD_NI_MEMO_RECEIVE)
- nc->SetS<bool>("MEMO_RECEIVE", true);
+ nc->SetMemoReceive(true);
if (u32 & OLD_NI_PRIVATE)
- nc->SetS<bool>("NS_PRIVATE", true);
+ nc->SetPrivate(true);
if (u32 & OLD_NI_HIDE_EMAIL)
- nc->SetS<bool>("HIDE_EMAIL", true);
+ nc->SetHideEmail(true);
if (u32 & OLD_NI_HIDE_MASK)
- nc->SetS<bool>("HIDE_MASK", true);
+ nc->SetHideMask(true);
if (u32 & OLD_NI_HIDE_QUIT)
- nc->SetS<bool>("HIDE_QUIT", true);
+ nc->SetHideQuit(true);
if (u32 & OLD_NI_KILL_QUICK)
- nc->SetS<bool>("KILL_QUICK", true);
+ nc->SetKillQuick(true);
if (u32 & OLD_NI_KILL_IMMED)
- nc->SetS<bool>("KILL_IMMED", true);
+ nc->SetKillImmed(true);
if (u32 & OLD_NI_MEMO_MAIL)
- nc->SetS<bool>("MEMO_MAIL", true);
+ nc->SetMemoMail(true);
if (u32 & OLD_NI_HIDE_STATUS)
- nc->SetS<bool>("HIDE_STATUS", true);
+ nc->SetHideStatus(true);
if (u32 & OLD_NI_SUSPENDED)
{
NSSuspendInfo *si = Serialize::New<NSSuspendInfo *>();
@@ -552,7 +553,7 @@ static void LoadNicks()
}
}
if (!(u32 & OLD_NI_AUTOOP))
- nc->SetS<bool>("AUTOOP", true);
+ nc->SetAutoOp(true);
uint16_t u16;
READ(read_uint16(&u16, f));
@@ -706,7 +707,7 @@ static void LoadNicks()
na->SetLastSeen(last_seen);
if (tmpu16 & OLD_NS_NO_EXPIRE)
- na->SetS<bool>("NS_NO_EXPIRE", true);
+ na->SetNoExpire(true);
Log(LOG_DEBUG) << "Loaded NickServ::Nick " << na->GetNick();
}
@@ -814,10 +815,10 @@ static void LoadChannels()
ChanServ::Channel *ci = Serialize::New<ChanServ::Channel *>();
ci->SetName(namebuf);
- const Anope::string settings[] = { "keeptopic", "peace", "cs_private", "restricted", "cs_secure", "secureops", "securefounder",
- "signkick", "signkick_level", "topiclock", "persist", "noautoop", "cs_keepmodes" };
+ const Anope::string settings[] = { "keeptopic", "peace", "private", "restricted", "secure", "secureops", "securefounder",
+ "signkick", "signkick_level", "topiclock", "persist", "noautoop", "keepmodes" };
for (unsigned j = 0; j < sizeof(settings) / sizeof(Anope::string); ++j)
- ci->UnsetS<bool>(settings[j].upper());
+ ci->UnsetS<bool>(settings[j]);
READ(read_string(buffer, f));
ci->SetFounder(NickServ::FindAccount(buffer));
@@ -856,29 +857,30 @@ static void LoadChannels()
// Temporary flags cleanup
tmpu32 &= ~0x80000000;
if (tmpu32 & OLD_CI_KEEPTOPIC)
- ci->SetS<bool>("KEEPTOPIC", true);
+ ci->SetKeepTopic(true);
if (tmpu32 & OLD_CI_SECUREOPS)
- ci->SetS<bool>("SECUREOPS", true);
+ ci->SetSecureOps(true);
if (tmpu32 & OLD_CI_PRIVATE)
- ci->SetS<bool>("CS_PRIVATE", true);
+ ci->SetPrivate(true);
if (tmpu32 & OLD_CI_TOPICLOCK)
- ci->SetS<bool>("TOPICLOCK", true);
+ ci->SetTopicLock(true);
if (tmpu32 & OLD_CI_RESTRICTED)
- ci->SetS<bool>("RESTRICTED", true);
+ ci->SetRestricted(true);
if (tmpu32 & OLD_CI_PEACE)
- ci->SetS<bool>("PEACE", true);
+ ci->SetPeace(true);
if (tmpu32 & OLD_CI_SECURE)
- ci->SetS<bool>("CS_SECURE", true);
+ ci->SetSecure(true);
if (tmpu32 & OLD_CI_NO_EXPIRE)
- ci->SetS<bool>("CS_NO_EXPIRE", true);
+ ci->SetNoExpire(true);
if (tmpu32 & OLD_CI_MEMO_HARDMAX)
- ci->SetS<bool>("MEMO_HARDMAX", true);
+ if (MemoServ::MemoInfo *mi = ci->GetMemos())
+ mi->SetHardMax(true);
if (tmpu32 & OLD_CI_SECUREFOUNDER)
- ci->SetS<bool>("SECUREFOUNDER", true);
+ ci->SetSecureFounder(true);
if (tmpu32 & OLD_CI_SIGNKICK)
- ci->SetS<bool>("SIGNKICK", true);
+ ci->SetSignKick(true);
if (tmpu32 & OLD_CI_SIGNKICK_LEVEL)
- ci->SetS<bool>("SIGNKICK_LEVEL", true);
+ ci->SetSignKickLevel(true);
Anope::string forbidby, forbidreason;
READ(read_string(forbidby, f));
@@ -910,7 +912,7 @@ static void LoadChannels()
level = ChanServ::ACCESS_FOUNDER;
if (j == 10 && level < 0) // NOJOIN
- ci->UnsetS<bool>("RESTRICTED"); // If CSDefRestricted was enabled this can happen
+ ci->SetRestricted(false);
ci->SetLevel(GetLevelName(j), level);
}
@@ -1057,9 +1059,9 @@ static void LoadChannels()
if (tmp32 & OLD_BS_DONTKICKVOICES)
ci->SetS<bool>("BS_DONTKICKVOICES", true);
if (tmp32 & OLD_BS_FANTASY)
- ci->SetS<bool>("BS_FANTASY", true);
+ ci->SetFantasy(true);
if (tmp32 & OLD_BS_GREET)
- ci->SetS<bool>("BS_GREET", true);
+ ci->SetGreet(true);
if (tmp32 & OLD_BS_NOBOT)
ci->SetS<bool>("BS_NOBOT", true);
diff --git a/modules/fantasy.cpp b/modules/fantasy.cpp
index 20585f527..63fa7c5c5 100644
--- a/modules/fantasy.cpp
+++ b/modules/fantasy.cpp
@@ -58,7 +58,7 @@ class CommandBSSetFantasy : public Command
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable fantasy";
- ci->SetS<bool>("BS_FANTASY", true);
+ ci->SetFantasy(true);
source.Reply(_("Fantasy mode is now \002on\002 on channel \002{0}\002."), ci->GetName());
}
else if (value.equals_ci("OFF"))
@@ -66,7 +66,7 @@ class CommandBSSetFantasy : public Command
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable fantasy";
- ci->UnsetS<bool>("BS_FANTASY");
+ ci->SetFantasy(false);
source.Reply(_("Fantasy mode is now \002off\002 on channel \002{0}\002."), ci->GetName());
}
else
@@ -94,15 +94,12 @@ class Fantasy : public Module
, public EventHook<Event::Privmsg>
, public EventHook<Event::ServiceBotEvent>
{
- Serialize::Field<ChanServ::Channel, bool> fantasy;
-
CommandBSSetFantasy commandbssetfantasy;
public:
Fantasy(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, EventHook<Event::Privmsg>(this)
, EventHook<Event::ServiceBotEvent>(this)
- , fantasy(this, "BS_FANTASY")
, commandbssetfantasy(this)
{
}
@@ -112,7 +109,7 @@ class Fantasy : public Module
if (!u || !c || !c->ci || !c->ci->GetBot() || msg.empty() || msg[0] == '\1')
return;
- if (Config->GetClient("BotServ") && !fantasy.HasExt(c->ci))
+ if (Config->GetClient("BotServ") && !c->ci->IsFantasy())
return;
std::vector<Anope::string> params;
@@ -225,7 +222,7 @@ class Fantasy : public Module
void OnServiceBot(CommandSource &source, ServiceBot *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
- if (fantasy.HasExt(ci))
+ if (ci->IsFantasy())
info.AddOption(_("Fantasy"));
}
};
diff --git a/modules/greet.cpp b/modules/greet.cpp
index d43becd16..462824e19 100644
--- a/modules/greet.cpp
+++ b/modules/greet.cpp
@@ -60,7 +60,7 @@ class CommandBSSetGreet : public Command
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to enable greets";
- ci->SetS<bool>("BS_GREET", true);
+ ci->SetGreet(true);
source.Reply(_("Greet mode for \002{0}\002 is now \002on\002."), ci->GetName());
}
else if (value.equals_ci("OFF"))
@@ -68,7 +68,7 @@ class CommandBSSetGreet : public Command
bool override = !source.AccessFor(ci).HasPriv("SET");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "to disable greets";
- ci->UnsetS<bool>("BS_GREET");
+ ci->SetGreet(false);
source.Reply(_("Greet mode for \002{0}\002 is now \002off\002."), ci->GetName());
}
else
@@ -116,13 +116,13 @@ class CommandNSSetGreet : public Command
if (!param.empty())
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to change the greet of " << nc->GetDisplay();
- nc->SetS<Anope::string>("greet", param);
+ nc->SetGreet(param);
source.Reply(_("Greet message for \002{0}\002 changed to \002{1}\002."), nc->GetDisplay(), param);
}
else
{
Log(nc == source.GetAccount() ? LOG_COMMAND : LOG_ADMIN, source, this) << "to unset the greet of " << nc->GetDisplay();
- nc->UnsetS<Anope::string>("greet");
+ nc->SetGreet("");
source.Reply(_("Greet message for \002{0}\002 unset."), nc->GetDisplay());
}
}
@@ -167,11 +167,6 @@ class Greet : public Module
, public EventHook<Event::NickInfo>
, public EventHook<Event::ServiceBotEvent>
{
- /* channel setting for whether or not greet should be shown */
- Serialize::Field<ChanServ::Channel, bool> bs_greet;
- /* user greets */
- Serialize::Field<NickServ::Account, Anope::string> ns_greet;
-
CommandBSSetGreet commandbssetgreet;
CommandNSSetGreet commandnssetgreet;
CommandNSSASetGreet commandnssasetgreet;
@@ -181,8 +176,6 @@ class Greet : public Module
, EventHook<Event::JoinChannel>(this)
, EventHook<Event::NickInfo>(this)
, EventHook<Event::ServiceBotEvent>(this)
- , bs_greet(this, "BS_GREET")
- , ns_greet(this, "greet")
, commandbssetgreet(this)
, commandnssetgreet(this)
, commandnssasetgreet(this)
@@ -198,8 +191,8 @@ class Greet : public Module
if (!c->ci || !c->ci->GetBot() || !user->server->IsSynced() || !user->Account())
return;
- Anope::string greet = ns_greet.Get(user->Account());
- if (bs_greet.HasExt(c->ci) && !greet.empty() && c->FindUser(c->ci->GetBot()) && c->ci->AccessFor(user).HasPriv("GREET"))
+ Anope::string greet = user->Account()->GetGreet();
+ if (c->ci->IsGreet() && !greet.empty() && c->FindUser(c->ci->GetBot()) && c->ci->AccessFor(user).HasPriv("GREET"))
{
IRCD->SendPrivmsg(c->ci->GetBot(), c->name, "[%s] %s", user->Account()->GetDisplay().c_str(), greet.c_str());
c->ci->GetBot()->lastmsg = Anope::CurTime;
@@ -208,14 +201,14 @@ class Greet : public Module
void OnNickInfo(CommandSource &source, NickServ::Nick *na, InfoFormatter &info, bool show_hidden) override
{
- Anope::string greet = ns_greet.Get(na->GetAccount());
+ Anope::string greet = na->GetAccount()->GetGreet();
if (!greet.empty())
info[_("Greet")] = greet;
}
void OnServiceBot(CommandSource &source, ServiceBot *bi, ChanServ::Channel *ci, InfoFormatter &info) override
{
- if (bs_greet.HasExt(ci))
+ if (ci->IsGreet())
info.AddOption(_("Greet"));
}
};
diff --git a/modules/hostserv/request.cpp b/modules/hostserv/request.cpp
index 3cae04b8a..7b66eb59c 100644
--- a/modules/hostserv/request.cpp
+++ b/modules/hostserv/request.cpp
@@ -146,7 +146,7 @@ class CommandHSRequest : public Command
User *u = source.GetUser();
- if (source.GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (source.GetAccount()->IsUnconfirmed())
{
source.Reply(_("You must confirm your account before you may request a vhost."));
return;
diff --git a/modules/memoserv/info.cpp b/modules/memoserv/info.cpp
index 05ca0c213..045e4cb6d 100644
--- a/modules/memoserv/info.cpp
+++ b/modules/memoserv/info.cpp
@@ -47,7 +47,7 @@ class CommandMSInfo : public Command
}
mi = na->GetAccount()->GetMemos();
- hardmax = na->GetAccount()->HasFieldS("MEMO_HARDMAX");
+ hardmax = mi->IsHardMax();
}
else if (!nname.empty() && nname[0] == '#')
{
@@ -65,7 +65,7 @@ class CommandMSInfo : public Command
}
mi = ci->GetMemos();
- hardmax = ci->HasFieldS("MEMO_HARDMAX");
+ hardmax = mi->IsHardMax();
}
else if (!nname.empty()) /* It's not a chan and we aren't an oper */
{
@@ -75,7 +75,7 @@ class CommandMSInfo : public Command
else
{
mi = nc->GetMemos();
- hardmax = nc->HasFieldS("MEMO_HARDMAX");
+ hardmax = mi->IsHardMax();
}
if (!mi)
@@ -123,11 +123,11 @@ class CommandMSInfo : public Command
if (na)
{
- if (na->GetAccount()->HasFieldS("MEMO_RECEIVE") && na->GetAccount()->HasFieldS("MEMO_SIGNON"))
+ if (na->GetAccount()->IsMemoReceive() && na->GetAccount()->IsMemoSignon())
source.Reply(_("\002{0}\002 is notified of new memos at logon and when they arrive."), nname);
- else if (na->GetAccount()->HasFieldS("MEMO_RECEIVE"))
+ else if (na->GetAccount()->IsMemoReceive())
source.Reply(_("\002{0}\002 is notified when new memos arrive."), nname);
- else if (na->GetAccount()->HasFieldS("MEMO_SIGNON"))
+ else if (na->GetAccount()->IsMemoSignon())
source.Reply(_("\002{0}\002 is notified of news memos at logon."), nname);
else
source.Reply(_("\002{0}\002 is not notified of new memos."), nname);
@@ -179,22 +179,22 @@ class CommandMSInfo : public Command
else
source.Reply(_("You have no limit on the number of memos you may keep."));
- bool memo_mail = nc->HasFieldS("MEMO_MAIL");
- if (nc->HasFieldS("MEMO_RECEIVE") && nc->HasFieldS("MEMO_SIGNON"))
+ bool memo_mail = nc->IsMemoMail();
+ if (nc->IsMemoReceive() && nc->IsMemoSignon())
{
if (memo_mail)
source.Reply(_("You will be notified of new memos at logon and when they arrive, and by mail when they arrive."));
else
source.Reply(_("You will be notified of new memos at logon and when they arrive."));
}
- else if (nc->HasFieldS("MEMO_RECEIVE"))
+ else if (nc->IsMemoReceive())
{
if (memo_mail)
source.Reply(_("You will be notified by message and by mail when new memos arrive."));
else
source.Reply(_("You will be notified when new memos arrive."));
}
- else if (nc->HasFieldS("MEMO_SIGNON"))
+ else if (nc->IsMemoSignon())
{
if (memo_mail)
source.Reply(_("You will be notified of new memos at logon, and by mail when they arrive."));
diff --git a/modules/memoserv/main/memoinfo.cpp b/modules/memoserv/main/memoinfo.cpp
index 6fa8df8b1..aa5ca71e4 100644
--- a/modules/memoserv/main/memoinfo.cpp
+++ b/modules/memoserv/main/memoinfo.cpp
@@ -31,6 +31,7 @@ unsigned MemoInfoImpl::GetIndex(MemoServ::Memo *m)
for (unsigned i = 0; i < memos.size(); ++i)
if (this->GetMemo(i) == m)
return i;
+#warning "-1 unsigned?"
return -1; // XXX wtf?
}
@@ -70,6 +71,16 @@ void MemoInfoImpl::SetMemoMax(const int16_t &i)
Set(&MemoInfoType::memomax, i);
}
+bool MemoInfoImpl::IsHardMax()
+{
+ return Get(&MemoInfoType::hardmax);
+}
+
+void MemoInfoImpl::SetHardMax(bool hardmax)
+{
+ Set(&MemoInfoType::hardmax, hardmax);
+}
+
std::vector<MemoServ::Memo *> MemoInfoImpl::GetMemos()
{
return GetRefs<MemoServ::Memo *>();
diff --git a/modules/memoserv/main/memoinfo.h b/modules/memoserv/main/memoinfo.h
index 79deb496b..3232262a3 100644
--- a/modules/memoserv/main/memoinfo.h
+++ b/modules/memoserv/main/memoinfo.h
@@ -25,6 +25,7 @@ class MemoInfoImpl : public MemoServ::MemoInfo
Serialize::Object *owner = nullptr;
int16_t memomax = 0;
+ bool hardmax = false;
public:
MemoInfoImpl(Serialize::TypeBase *type) : MemoServ::MemoInfo(type) { }
@@ -41,6 +42,9 @@ class MemoInfoImpl : public MemoServ::MemoInfo
int16_t GetMemoMax() override;
void SetMemoMax(const int16_t &) override;
+ bool IsHardMax() override;
+ void SetHardMax(bool) override;
+
std::vector<MemoServ::Memo *> GetMemos() override;
std::vector<MemoServ::Ignore *> GetIgnores() override;
};
diff --git a/modules/memoserv/main/memoinfotype.cpp b/modules/memoserv/main/memoinfotype.cpp
index 3447de5c8..27e3bba75 100644
--- a/modules/memoserv/main/memoinfotype.cpp
+++ b/modules/memoserv/main/memoinfotype.cpp
@@ -23,6 +23,7 @@
MemoInfoType::MemoInfoType(Module *me) : Serialize::Type<MemoInfoImpl>(me)
, owner(this, "owner", &MemoInfoImpl::owner, true)
, memomax(this, "memomax", &MemoInfoImpl::memomax)
+ , hardmax(this, "hardmax", &MemoInfoImpl::hardmax)
{
}
diff --git a/modules/memoserv/main/memoinfotype.h b/modules/memoserv/main/memoinfotype.h
index 97af31917..1a45b361a 100644
--- a/modules/memoserv/main/memoinfotype.h
+++ b/modules/memoserv/main/memoinfotype.h
@@ -24,6 +24,7 @@ class MemoInfoType : public Serialize::Type<MemoInfoImpl>
public:
Serialize::ObjectField<MemoInfoImpl, Serialize::Object *> owner;
Serialize::Field<MemoInfoImpl, int16_t> memomax;
+ Serialize::Field<MemoInfoImpl, bool> hardmax;
MemoInfoType(Module *);
};
diff --git a/modules/memoserv/main/memoserv.cpp b/modules/memoserv/main/memoserv.cpp
index 4fe747472..3b2b7cd17 100644
--- a/modules/memoserv/main/memoserv.cpp
+++ b/modules/memoserv/main/memoserv.cpp
@@ -133,7 +133,7 @@ class MemoServCore : public Module, public MemoServ::MemoServService
if (ci->AccessFor(cu->user).HasPriv("MEMO"))
{
- if (cu->user->Account() && cu->user->Account()->HasFieldS("MEMO_RECEIVE"))
+ if (cu->user->Account() && cu->user->Account()->IsMemoReceive())
cu->user->SendMessage(*MemoServ, _("There is a new memo on channel \002{0}\002. Type \002{1}{2} READ {3} {4}\002 to read it."), ci->GetName(), Config->StrictPrivmsg, MemoServ->nick, ci->GetName(), mi->GetMemos().size()); // XXX
}
}
@@ -143,12 +143,12 @@ class MemoServCore : public Module, public MemoServ::MemoServService
{
NickServ::Account *nc = NickServ::FindNick(target)->GetAccount();
- if (nc->HasFieldS("MEMO_RECEIVE"))
+ if (nc->IsMemoReceive())
for (User *u : nc->users)
u->SendMessage(*MemoServ, _("You have a new memo from \002{0}\002. Type \002{1}{2} READ {3}\002 to read it."), source, Config->StrictPrivmsg, MemoServ->nick, mi->GetMemos().size());//XXX
/* let's get out the mail if set in the nickcore - certus */
- if (nc->HasFieldS("MEMO_MAIL"))
+ if (nc->IsMemoMail())
SendMemoMail(nc, mi, m);
}
diff --git a/modules/memoserv/send.cpp b/modules/memoserv/send.cpp
index 418a82c21..4cdbc0eb3 100644
--- a/modules/memoserv/send.cpp
+++ b/modules/memoserv/send.cpp
@@ -43,7 +43,7 @@ class CommandMSSend : public Command
return;
}
- if (source.GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (source.GetAccount()->IsUnconfirmed())
{
source.Reply(_("You must confirm your account before you may send a memo."));
return;
diff --git a/modules/memoserv/set.cpp b/modules/memoserv/set.cpp
index 13d24bd98..12f5e5b8d 100644
--- a/modules/memoserv/set.cpp
+++ b/modules/memoserv/set.cpp
@@ -33,27 +33,27 @@ class CommandMSSet : public Command
if (param.equals_ci("ON"))
{
- nc->SetS<bool>("MEMO_SIGNON", true);
- nc->SetS<bool>("MEMO_RECEIVE", true);
+ nc->SetMemoSignon(true);
+ nc->SetMemoReceive(true);
source.Reply(_("\002{0}\002 will now notify you of memos when you log on and when they are sent to you."), MemoServ->nick);
}
else if (param.equals_ci("LOGON"))
{
- nc->SetS<bool>("MEMO_SIGNON", true);
- nc->UnsetS<bool>("MEMO_RECEIVE");
+ nc->SetMemoSignon(true);
+ nc->SetMemoReceive(false);
source.Reply(_("\002{0}\002 will now notify you of memos when you log on or unset /AWAY."), MemoServ->nick);
}
else if (param.equals_ci("NEW"))
{
- nc->UnsetS<bool>("MEMO_SIGNON");
- nc->SetS<bool>("MEMO_RECEIVE", true);
+ nc->SetMemoSignon(false);
+ nc->SetMemoReceive(true);
source.Reply(_("\002{0}\002 will now notify you of memos when they are sent to you."), MemoServ->nick);
}
else if (param.equals_ci("MAIL"))
{
if (!nc->GetEmail().empty())
{
- nc->SetS<bool>("MEMO_MAIL", true);
+ nc->SetMemoMail(true);
source.Reply(_("You will now be informed about new memos via email."));
}
else
@@ -63,14 +63,14 @@ class CommandMSSet : public Command
}
else if (param.equals_ci("NOMAIL"))
{
- nc->UnsetS<bool>("MEMO_MAIL");
+ nc->SetMemoMail(false);
source.Reply(_("You will no longer be informed via email."));
}
else if (param.equals_ci("OFF"))
{
- nc->UnsetS<bool>("MEMO_SIGNON");
- nc->UnsetS<bool>("MEMO_RECEIVE");
- nc->UnsetS<bool>("MEMO_MAIL");
+ nc->SetMemoSignon(false);
+ nc->SetMemoReceive(false);
+ nc->SetMemoMail(false);
source.Reply(_("\002{0}\002 will not send you any notification of memos."), MemoServ->nick);
}
else
@@ -138,16 +138,16 @@ class CommandMSSet : public Command
if (!chan.empty())
{
if (!p2.empty())
- ci->SetS<bool>("MEMO_HARDMAX", true);
+ mi->SetHardMax(true);
else
- ci->UnsetS<bool>("MEMO_HARDMAX");
+ mi->SetHardMax(false);
}
else
{
if (!p2.empty())
- nc->SetS<bool>("MEMO_HARDMAX", true);
+ mi->SetHardMax(true);
else
- nc->UnsetS<bool>("MEMO_HARDMAX");
+ mi->SetHardMax(false);
}
limit = -1;
try
@@ -163,12 +163,12 @@ class CommandMSSet : public Command
this->OnSyntaxError(source, "");
return;
}
- if (!chan.empty() && ci->HasFieldS("MEMO_HARDMAX"))
+ if (!chan.empty() && mi->IsHardMax())
{
source.Reply(_("The memo limit for \002{0}\002 may not be changed."), chan);
return;
}
- if (chan.empty() && nc->HasFieldS("MEMO_HARDMAX"))
+ if (chan.empty() && mi->IsHardMax())
{
source.Reply(_("You are not permitted to change your memo limit."));
return;
@@ -315,17 +315,10 @@ class CommandMSSet : public Command
class MSSet : public Module
{
CommandMSSet commandmsset;
- Serialize::Field<NickServ::Account, bool> memo_signon, memo_receive, memo_mail, memo_hardmax_nick;
- Serialize::Field<ChanServ::Channel, bool> memo_hardmax_channel;
public:
MSSet(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, VENDOR)
, commandmsset(this)
- , memo_signon(this, "MEMO_SIGNON")
- , memo_receive(this, "MEMO_RECEIVE")
- , memo_mail(this, "MEMO_MAIL")
- , memo_hardmax_nick(this, "MEMO_HARDMAX")
- , memo_hardmax_channel(this, "MEMO_HARDMAX")
{
}
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)
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index a0f0e067f..cdba96abe 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -388,7 +388,7 @@ class InspIRCd20Proto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
/* InspIRCd uses an account to bypass chmode +R, not umode +r, so we can't send this here */
- if (na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (na->GetAccount()->IsUnconfirmed())
return;
Uplink::Send(Me, "METADATA", u->GetUID(), "accountname", na->GetAccount()->GetDisplay());
@@ -1054,7 +1054,7 @@ struct IRCDMessageMetadata : IRCDMessage
}
else if ((do_topiclock) && (params[1] == "topiclock"))
{
- bool mystate = c->ci->GetExt<bool>("TOPICLOCK");
+ bool mystate = c->ci->IsTopicLock();
bool serverstate = (params[2] == "1");
if (mystate != serverstate)
Uplink::Send(Me, "METADATA", c->name, "topiclock", mystate ? "1" : "");
@@ -1499,7 +1499,7 @@ class ProtoInspIRCd20 : public Module
if (use_server_side_topiclock && Servers::Capab.count("TOPICLOCK") && ci->c)
{
- if (ci->HasFieldS("TOPICLOCK"))
+ if (ci->IsTopicLock())
SendChannelMetadata(ci->c, "topiclock", "1");
}
}
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 3d013db9e..b316964c5 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -118,7 +118,7 @@ class RatboxProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
- if (na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (na->GetAccount()->IsUnconfirmed())
return;
Uplink::Send(Me, "ENCAP", "*", "SU", u->GetUID(), na->GetAccount()->GetDisplay());
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index 1eb40f4c3..8035e3987 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -354,7 +354,7 @@ class UnrealIRCdProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
/* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */
- if (Servers::Capab.count("ESVID") > 0 && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
+ if (Servers::Capab.count("ESVID") > 0 && !na->GetAccount()->IsUnconfirmed())
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->GetAccount()->GetDisplay().c_str());
else
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon);
diff --git a/modules/webcpanel/pages/chanserv/drop.cpp b/modules/webcpanel/pages/chanserv/drop.cpp
index 64ee9b9f8..411aa92c4 100644
--- a/modules/webcpanel/pages/chanserv/drop.cpp
+++ b/modules/webcpanel/pages/chanserv/drop.cpp
@@ -44,7 +44,7 @@ bool WebCPanel::ChanServ::Drop::OnRequest(HTTPProvider *server, const Anope::str
}
for (::ChanServ::Channel *ci : na->GetAccount()->GetRefs<::ChanServ::Channel *>())
- if ((ci->HasFieldS("SECUREFOUNDER") ? ci->AccessFor(na->GetAccount()).founder : ci->AccessFor(na->GetAccount()).HasPriv("FOUNDER")) || (na->GetAccount()->GetOper() && na->GetAccount()->GetOper()->HasCommand("chanserv/drop")))
+ if ((ci->IsSecureFounder() ? ci->AccessFor(na->GetAccount()).founder : ci->AccessFor(na->GetAccount()).HasPriv("FOUNDER")) || (na->GetAccount()->GetOper() && na->GetAccount()->GetOper()->HasCommand("chanserv/drop")))
{
replacements["CHANNEL_NAMES"] = ci->GetName();
replacements["ESCAPED_CHANNEL_NAMES"] = HTTPUtils::URLEncode(ci->GetName());
diff --git a/modules/webcpanel/pages/chanserv/set.cpp b/modules/webcpanel/pages/chanserv/set.cpp
index d3cca72cc..e33d52a60 100644
--- a/modules/webcpanel/pages/chanserv/set.cpp
+++ b/modules/webcpanel/pages/chanserv/set.cpp
@@ -56,60 +56,39 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
if (can_set && message.post_data.empty() == false)
{
- if (ci->HasFieldS("KEEPTOPIC") != message.post_data.count("keeptopic"))
+ if (ci->IsKeepTopic() != message.post_data.count("keeptopic"))
{
- if (!ci->HasFieldS("KEEPTOPIC"))
- ci->SetS<bool>("KEEPTOPIC", true);
- else
- ci->UnsetS<bool>("KEEPTOPIC");
+ ci->SetKeepTopic(!ci->IsKeepTopic());
replacements["MESSAGES"] = "Secure updated";
}
- if (ci->HasFieldS("PEACE") != message.post_data.count("peace"))
+ if (ci->IsPeace() != message.post_data.count("peace"))
{
- if (!ci->HasFieldS("PEACE"))
- ci->SetS<bool>("PEACE", true);
- else
- ci->UnsetS<bool>("PEACE");
+ ci->SetPeace(!ci->IsPeace());
replacements["MESSAGES"] = "Peace updated";
}
- if (ci->HasFieldS("CS_PRIVATE") != message.post_data.count("private"))
+ if (ci->IsPrivate() != message.post_data.count("private"))
{
- if (!ci->HasFieldS("CS_PRIVATE"))
- ci->SetS<bool>("CS_PRIVATE", true);
- else
- ci->UnsetS<bool>("CS_PRIVATE");
+ ci->SetPrivate(!ci->IsPrivate());
replacements["MESSAGES"] = "Private updated";
}
- if (ci->HasFieldS("RESTRICTED") != message.post_data.count("restricted"))
+ if (ci->IsRestricted() != message.post_data.count("restricted"))
{
- if (!ci->HasFieldS("RESTRICTED"))
- ci->SetS<bool>("RESTRICTED", true);
- else
- ci->UnsetS<bool>("RESTRICTED");
+ ci->SetRestricted(!ci->IsRestricted());
replacements["MESSAGES"] = "Restricted updated";
}
- if (ci->HasFieldS("CS_SECURE") != message.post_data.count("secure"))
+ if (ci->IsSecure() != message.post_data.count("secure"))
{
- if (!ci->HasFieldS("CS_SECURE"))
- ci->SetS<bool>("CS_SECURE", true);
- else
- ci->UnsetS<bool>("CS_SECURE");
+ ci->SetSecure(!ci->IsSecure());
replacements["MESSAGES"] = "Secure updated";
}
- if (ci->HasFieldS("SECUREOPS") != message.post_data.count("secureops"))
+ if (ci->IsSecureOps() != message.post_data.count("secureops"))
{
- if (!ci->HasFieldS("SECUREOPS"))
- ci->SetS<bool>("SECUREOPS", true);
- else
- ci->UnsetS<bool>("SECUREOPS");
+ ci->SetSecureOps(!ci->IsSecureOps());
replacements["MESSAGES"] = "Secureops updated";
}
- if (ci->HasFieldS("TOPICLOCK") != message.post_data.count("topiclock"))
+ if (ci->IsTopicLock() != message.post_data.count("topiclock"))
{
- if (!ci->HasFieldS("TOPICLOCK"))
- ci->SetS<bool>("TOPICLOCK", true);
- else
- ci->UnsetS<bool>("TOPICLOCK");
+ ci->SetTopicLock(!ci->IsTopicLock());
replacements["MESSAGES"] = "Topiclock updated";
}
}
@@ -132,25 +111,25 @@ bool WebCPanel::ChanServ::Set::OnRequest(HTTPProvider *server, const Anope::stri
if (can_set)
{
- if (ci->HasFieldS("KEEPTOPIC"))
+ if (ci->IsKeepTopic())
replacements["KEEPTOPIC"];
- if (ci->HasFieldS("PEACE"))
+ if (ci->IsPeace())
replacements["PEACE"];
- if (ci->HasFieldS("CS_PRIVATE"))
+ if (ci->IsPrivate())
replacements["PRIVATE"];
- if (ci->HasFieldS("RESTRICTED"))
+ if (ci->IsRestricted())
replacements["RESTRICTED"];
- if (ci->HasFieldS("CS_SECURE"))
+ if (ci->IsSecure())
replacements["SECURE"];
- if (ci->HasFieldS("SECUREOPS"))
+ if (ci->IsSecureOps())
replacements["SECUREOPS"];
- if (ci->HasFieldS("TOPICLOCK"))
+ if (ci->IsTopicLock())
replacements["TOPICLOCK"];
}
diff --git a/modules/webcpanel/pages/nickserv/alist.cpp b/modules/webcpanel/pages/nickserv/alist.cpp
index f950cf63a..dd5c536f9 100644
--- a/modules/webcpanel/pages/nickserv/alist.cpp
+++ b/modules/webcpanel/pages/nickserv/alist.cpp
@@ -42,7 +42,7 @@ bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
- replacements["CHANNELS"] = (ci->HasFieldS("CS_NO_EXPIRE") ? "!" : "") + ci->GetName();
+ replacements["CHANNELS"] = (ci->IsNoExpire() ? "!" : "") + ci->GetName();
replacements["ACCESSES"] = "Founder";
continue;
}
@@ -54,7 +54,7 @@ bool WebCPanel::NickServ::Alist::OnRequest(HTTPProvider *server, const Anope::st
++chan_count;
replacements["NUMBERS"] = stringify(chan_count);
- replacements["CHANNELS"] = (ci->HasFieldS("CS_NO_EXPIRE") ? "!" : "") + ci->GetName();
+ replacements["CHANNELS"] = (ci->IsNoExpire() ? "!" : "") + ci->GetName();
Anope::string access_str;
for (unsigned i = 0; i < access.size(); ++i)
access_str += ", " + access[i]->AccessSerialize();
diff --git a/modules/webcpanel/pages/nickserv/info.cpp b/modules/webcpanel/pages/nickserv/info.cpp
index 5dc9eed03..bf901aa83 100644
--- a/modules/webcpanel/pages/nickserv/info.cpp
+++ b/modules/webcpanel/pages/nickserv/info.cpp
@@ -42,56 +42,43 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str
}
if (message.post_data.count("greet") > 0)
{
- Anope::string *greet = na->GetAccount()->GetExt<Anope::string>("greet");
const Anope::string &post_greet = HTTPUtils::URLDecode(message.post_data["greet"].replace_all_cs("+", " "));
- if (post_greet.empty())
- na->GetAccount()->Shrink<Anope::string>("greet");
- else if (!greet || post_greet != *greet)
- na->GetAccount()->Extend<Anope::string>("greet", post_greet);
+ na->GetAccount()->SetGreet(post_greet);
replacements["MESSAGES"] = "Greet updated";
}
- if (na->GetAccount()->HasFieldS("AUTOOP") != message.post_data.count("autoop"))
+ if (na->GetAccount()->IsAutoOp() != message.post_data.count("autoop"))
{
- if (!na->GetAccount()->HasFieldS("AUTOOP"))
- na->GetAccount()->SetS<bool>("AUTOOP", true);
- else
- na->GetAccount()->UnsetS<bool>("AUTOOP");
+ na->GetAccount()->SetAutoOp(!na->GetAccount()->IsAutoOp());
replacements["MESSAGES"] = "Autoop updated";
}
- if (na->GetAccount()->HasFieldS("NS_PRIVATE") != message.post_data.count("private"))
+ if (na->GetAccount()->IsPrivate() != message.post_data.count("private"))
{
- if (!na->GetAccount()->HasFieldS("NS_PRIVATE"))
- na->GetAccount()->SetS<bool>("NS_PRIVATE", true);
- else
- na->GetAccount()->UnsetS<bool>("NS_PRIVATE");
+ na->GetAccount()->SetPrivate(!na->GetAccount()->IsPrivate());
replacements["MESSAGES"] = "Private updated";
}
- if (na->GetAccount()->HasFieldS("NS_SECURE") != message.post_data.count("secure"))
+ if (na->GetAccount()->IsSecure() != message.post_data.count("secure"))
{
- if (!na->GetAccount()->HasFieldS("NS_SECURE"))
- na->GetAccount()->SetS<bool>("NS_SECURE", true);
- else
- na->GetAccount()->UnsetS<bool>("NS_SECURE");
+ na->GetAccount()->SetSecure(!na->GetAccount()->IsSecure());
replacements["MESSAGES"] = "Secure updated";
}
- if (message.post_data["kill"] == "on" && !na->GetAccount()->HasFieldS("KILLPROTECT"))
+ if (message.post_data["kill"] == "on" && !na->GetAccount()->IsKillProtect())
{
- na->GetAccount()->SetS<bool>("KILLPROTECT", true);
- na->GetAccount()->UnsetS<bool>("KILL_QUICK");
+ na->GetAccount()->SetKillProtect(true);
+ na->GetAccount()->SetKillQuick(false);
replacements["MESSAGES"] = "Kill updated";
}
- else if (message.post_data["kill"] == "quick" && !na->GetAccount()->HasFieldS("KILL_QUICK"))
+ else if (message.post_data["kill"] == "quick" && !na->GetAccount()->IsKillQuick())
{
- na->GetAccount()->UnsetS<bool>("KILLPROTECT");
- na->GetAccount()->SetS<bool>("KILL_QUICK", true);
+ na->GetAccount()->SetKillProtect(false);
+ na->GetAccount()->SetKillQuick(true);
replacements["MESSAGES"] = "Kill updated";
}
- else if (message.post_data["kill"] == "off" && (na->GetAccount()->HasFieldS("KILLPROTECT") || na->GetAccount()->HasFieldS("KILL_QUICK")))
+ else if (message.post_data["kill"] == "off" && (na->GetAccount()->IsKillProtect() || na->GetAccount()->IsKillQuick()))
{
- na->GetAccount()->UnsetS<bool>("KILLPROTECT");
- na->GetAccount()->UnsetS<bool>("KILL_QUICK");
+ na->GetAccount()->SetKillProtect(false);
+ na->GetAccount()->SetKillQuick(false);
replacements["MESSAGES"] = "Kill updated";
}
}
@@ -107,20 +94,20 @@ bool WebCPanel::NickServ::Info::OnRequest(HTTPProvider *server, const Anope::str
replacements["VHOST"] = vhost->Mask();
}
- Anope::string *greet = na->GetAccount()->GetExt<Anope::string>("greet");
- if (greet)
- replacements["GREET"] = HTTPUtils::Escape(*greet);
- if (na->GetAccount()->HasFieldS("AUTOOP"))
+ Anope::string greet = na->GetAccount()->GetGreet();
+ if (greet.empty() == false)
+ replacements["GREET"] = HTTPUtils::Escape(greet);
+ if (na->GetAccount()->IsAutoOp())
replacements["AUTOOP"];
- if (na->GetAccount()->HasFieldS("NS_PRIVATE"))
+ if (na->GetAccount()->IsPrivate())
replacements["PRIVATE"];
- if (na->GetAccount()->HasFieldS("NS_SECURE"))
+ if (na->GetAccount()->IsSecure())
replacements["SECURE"];
- if (na->GetAccount()->HasFieldS("KILLPROTECT"))
+ if (na->GetAccount()->IsKillProtect())
replacements["KILL_ON"];
- if (na->GetAccount()->HasFieldS("KILL_QUICK"))
+ if (na->GetAccount()->IsKillQuick())
replacements["KILL_QUICK"];
- if (!na->GetAccount()->HasFieldS("KILLPROTECT") && !na->GetAccount()->HasFieldS("KILL_QUICK"))
+ if (!na->GetAccount()->IsKillProtect() && !na->GetAccount()->IsKillQuick())
replacements["KILL_OFF"];
TemplateFileServer page("nickserv/info.html");
diff --git a/src/users.cpp b/src/users.cpp
index 12f61a889..4afe7d4a9 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -330,7 +330,7 @@ void User::SendMessage(const MessageSource &source, const Anope::string &msg)
* - The user is not registered and NSDefMsg is enabled
* - The user is registered and has set /ns set msg on
*/
- bool send_privmsg = Config->UsePrivmsg && ((!this->nc && Config->DefPrivmsg) || (this->nc && this->nc->HasFieldS("MSG")));
+ bool send_privmsg = Config->UsePrivmsg && ((!this->nc && Config->DefPrivmsg) || (this->nc && this->nc->IsMsg()));
sepstream sep(translated_message, '\n', true);
for (Anope::string tok; sep.GetToken(tok);)
{
@@ -464,7 +464,7 @@ bool User::IsRecognized(bool check_secure) const
{
NickServ::Nick *na = NickServ::FindNick(nick);
- if (!na || na->GetAccount()->HasFieldS("NS_SECURE"))
+ if (!na || na->GetAccount()->IsSecure())
return false;
}