summaryrefslogtreecommitdiff
path: root/modules/operserv
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2016-12-01 09:25:53 -0500
committerAdam <Adam@anope.org>2016-12-01 09:25:53 -0500
commitca28f9cfcbff0fbdb2afe96f1427245f83db7c47 (patch)
treeac5de801a4db01a7cb689ec670537ad74c7c53e6 /modules/operserv
parent2f512281029fbf4f7ef9832e05804831ad2d9ba2 (diff)
Allow objects to opt out of gc, don't gc accounts with users logged in
Also store cached state with the field by using Serialize::Storage for field storage
Diffstat (limited to 'modules/operserv')
-rw-r--r--modules/operserv/dns.cpp27
-rw-r--r--modules/operserv/forbid.cpp9
-rw-r--r--modules/operserv/ignore.cpp7
-rw-r--r--modules/operserv/info.cpp9
-rw-r--r--modules/operserv/news.cpp9
-rw-r--r--modules/operserv/session.cpp9
-rw-r--r--modules/operserv/stats.cpp5
7 files changed, 33 insertions, 42 deletions
diff --git a/modules/operserv/dns.cpp b/modules/operserv/dns.cpp
index e607b1712..1ccb54530 100644
--- a/modules/operserv/dns.cpp
+++ b/modules/operserv/dns.cpp
@@ -27,11 +27,10 @@ class DNSZoneImpl : public DNSZone
{
friend class DNSZoneType;
- Anope::string name;
+ Serialize::Storage<Anope::string> name;
public:
- DNSZoneImpl(Serialize::TypeBase *type) : DNSZone(type) { }
- DNSZoneImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSZone(type, id) { }
+ using DNSZone::DNSZone;
Anope::string GetName() override;
void SetName(const Anope::string &) override;
@@ -72,10 +71,10 @@ class DNSServerImpl : public DNSServer
ServiceReference<DNS::Manager> manager;
- DNSZone *zone = nullptr;
- Anope::string name;
- unsigned int limit = 0;
- bool pooled = false;
+ Serialize::Storage<DNSZone *> zone;
+ Serialize::Storage<Anope::string> name;
+ Serialize::Storage<unsigned int> limit;
+ Serialize::Storage<bool> pooled;
/* is actually in the pool */
bool active = false;
@@ -84,8 +83,7 @@ class DNSServerImpl : public DNSServer
std::set<Anope::string, ci::less> zones;
time_t repool = 0;
- DNSServerImpl(Serialize::TypeBase *type) : DNSServer(type) { }
- DNSServerImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSServer(type, id) { }
+ using DNSServer::DNSServer;
DNSZone *GetZone() override;
void SetZone(DNSZone *) override;
@@ -188,12 +186,11 @@ class DNSZoneMembershipImpl : public DNSZoneMembership
{
friend class DNSZoneMembershipType;
- DNSServer *server = nullptr;
- DNSZone *zone = nullptr;
+ Serialize::Storage<DNSServer *> server;
+ Serialize::Storage<DNSZone *> zone;
public:
- DNSZoneMembershipImpl(Serialize::TypeBase *type) : DNSZoneMembership(type) { }
- DNSZoneMembershipImpl(Serialize::TypeBase *type, Serialize::ID id) : DNSZoneMembership(type, id) { }
+ using DNSZoneMembership::DNSZoneMembership;
DNSServer *GetServer() override;
void SetServer(DNSServer *) override;
@@ -247,8 +244,8 @@ class DNSIPImpl : public DNSIP
{
friend class DNSIPType;
- DNSServer *server = nullptr;
- Anope::string ip;
+ Serialize::Storage<DNSServer *> server;
+ Serialize::Storage<Anope::string> ip;
public:
DNSIPImpl(Serialize::TypeBase *type) : DNSIP(type) { }
diff --git a/modules/operserv/forbid.cpp b/modules/operserv/forbid.cpp
index 1a013ed0d..22d927381 100644
--- a/modules/operserv/forbid.cpp
+++ b/modules/operserv/forbid.cpp
@@ -26,13 +26,12 @@ class ForbidDataImpl : public ForbidData
{
friend class ForbidDataType;
- Anope::string mask, creator, reason;
- time_t created = 0, expires = 0;
- ForbidType type = static_cast<ForbidType>(0);
+ Serialize::Storage<Anope::string> mask, creator, reason;
+ Serialize::Storage<time_t> created, expires;
+ Serialize::Storage<ForbidType> type;
public:
- ForbidDataImpl(Serialize::TypeBase *type) : ForbidData(type) { }
- ForbidDataImpl(Serialize::TypeBase *type, Serialize::ID id) : ForbidData(type, id) { }
+ using ForbidData::ForbidData;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/ignore.cpp b/modules/operserv/ignore.cpp
index a25b0ef8c..397916ca4 100644
--- a/modules/operserv/ignore.cpp
+++ b/modules/operserv/ignore.cpp
@@ -25,12 +25,11 @@ class IgnoreImpl : public Ignore
{
friend class IgnoreType;
- Anope::string mask, creator, reason;
- time_t time = 0;
+ Serialize::Storage<Anope::string> mask, creator, reason;
+ Serialize::Storage<time_t> time;
public:
- IgnoreImpl(Serialize::TypeBase *type) : Ignore(type) { }
- IgnoreImpl(Serialize::TypeBase *type, Serialize::ID id) : Ignore(type, id) { }
+ using Ignore::Ignore;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/info.cpp b/modules/operserv/info.cpp
index 30c0b06ad..c6038af5a 100644
--- a/modules/operserv/info.cpp
+++ b/modules/operserv/info.cpp
@@ -27,13 +27,12 @@ class OperInfoImpl : public OperInfo
{
friend class OperInfoType;
- Serialize::Object *target = nullptr;
- Anope::string info, creator;
- time_t created = 0;
+ Serialize::Storage<Serialize::Object *> target;
+ Serialize::Storage<Anope::string> info, creator;
+ Serialize::Storage<time_t> created;
public:
- OperInfoImpl(Serialize::TypeBase *type) : OperInfo(type) { }
- OperInfoImpl(Serialize::TypeBase *type, Serialize::ID id) : OperInfo(type, id) { }
+ using OperInfo::OperInfo;
Serialize::Object *GetTarget() override;
void SetTarget(Serialize::Object *) override;
diff --git a/modules/operserv/news.cpp b/modules/operserv/news.cpp
index a99063c19..e2119a2de 100644
--- a/modules/operserv/news.cpp
+++ b/modules/operserv/news.cpp
@@ -77,13 +77,12 @@ class NewsItemImpl : public NewsItem
{
friend class NewsItemType;
- NewsType type;
- Anope::string text, who;
- time_t time = 0;
+ Serialize::Storage<NewsType> type;
+ Serialize::Storage<Anope::string> text, who;
+ Serialize::Storage<time_t> time;
public:
- NewsItemImpl(Serialize::TypeBase *type) : NewsItem(type) { }
- NewsItemImpl(Serialize::TypeBase *type, Serialize::ID id) : NewsItem(type, id) { }
+ using NewsItem::NewsItem;
NewsType GetNewsType() override;
void SetNewsType(NewsType) override;
diff --git a/modules/operserv/session.cpp b/modules/operserv/session.cpp
index 0390d9205..cdd230473 100644
--- a/modules/operserv/session.cpp
+++ b/modules/operserv/session.cpp
@@ -47,13 +47,12 @@ class ExceptionImpl : public Exception
{
friend class ExceptionType;
- Anope::string mask, who, reason;
- unsigned int limit = 0;
- time_t time = 0, expires = 0;
+ Serialize::Storage<Anope::string> mask, who, reason;
+ Serialize::Storage<unsigned int> limit;
+ Serialize::Storage<time_t> time, expires;
public:
- ExceptionImpl(Serialize::TypeBase *type) : Exception(type) { }
- ExceptionImpl(Serialize::TypeBase *type, Serialize::ID id) : Exception(type, id) { }
+ using Exception::Exception;
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
diff --git a/modules/operserv/stats.cpp b/modules/operserv/stats.cpp
index 04b1af6c8..abee79cf6 100644
--- a/modules/operserv/stats.cpp
+++ b/modules/operserv/stats.cpp
@@ -25,11 +25,10 @@ class StatsImpl : public Stats
{
friend class StatsType;
- unsigned int maxusercnt = 0;
- time_t maxusertime = 0;
+ Serialize::Storage<unsigned int> maxusercnt;
+ Serialize::Storage<time_t> maxusertime;
public:
-
using Stats::Stats;
unsigned int GetMaxUserCount() override;