summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2017-02-07 17:20:07 -0500
committerAdam <Adam@anope.org>2017-02-07 17:20:07 -0500
commit09dca29c8898916772c2a2a6b86b625c812007ed (patch)
tree1b28f4751feec3ea2b46fa0afb061da7926f3a47
parent8b694bc392c36551e428b84454efb81cdbc8bcd3 (diff)
Normalize databases by not allowing generic Object references
Remove redis database support
-rw-r--r--data/anope.example.conf16
-rw-r--r--data/modules.example.conf25
-rw-r--r--docs/SQLite.md22
-rw-r--r--include/event.h2
-rw-r--r--include/modules/chanserv/chanaccess.h7
-rw-r--r--include/modules/chanserv/main/chanaccess.h8
-rw-r--r--include/modules/hostserv.h4
-rw-r--r--include/modules/memoserv.h7
-rw-r--r--include/modules/operserv/info.h7
-rw-r--r--include/modules/sql.h2
-rw-r--r--include/serialize.h9
-rw-r--r--modules/chanserv/access.cpp9
-rw-r--r--modules/chanserv/flags.cpp59
-rw-r--r--modules/chanserv/main/chanaccess.cpp16
-rw-r--r--modules/chanserv/main/chanaccesstype.h4
-rw-r--r--modules/chanserv/xop.cpp61
-rw-r--r--modules/database/flatfile.cpp14
-rw-r--r--modules/database/old.cpp2
-rw-r--r--modules/database/redis.cpp448
-rw-r--r--modules/database/sql.cpp32
-rw-r--r--modules/extra/mysql.cpp39
-rw-r--r--modules/hostserv/add.cpp2
-rw-r--r--modules/hostserv/main/vhost.cpp9
-rw-r--r--modules/hostserv/main/vhost.h6
-rw-r--r--modules/hostserv/main/vhosttype.cpp2
-rw-r--r--modules/hostserv/main/vhosttype.h2
-rw-r--r--modules/hostserv/request.cpp2
-rw-r--r--modules/memoserv/main/memoinfo.cpp19
-rw-r--r--modules/memoserv/main/memoinfo.h10
-rw-r--r--modules/memoserv/main/memoinfotype.cpp3
-rw-r--r--modules/memoserv/main/memoinfotype.h3
-rw-r--r--modules/memoserv/main/memoserv.cpp8
-rw-r--r--modules/operserv/info.cpp44
-rw-r--r--modules/redis.cpp608
-rw-r--r--modules/sqlite.cpp46
-rw-r--r--src/serialize.cpp63
36 files changed, 223 insertions, 1397 deletions
diff --git a/data/anope.example.conf b/data/anope.example.conf
index 89c63ebfd..f6abe70db 100644
--- a/data/anope.example.conf
+++ b/data/anope.example.conf
@@ -1087,22 +1087,6 @@ module
}
/*
- * db_redis.
- *
- * This module allows using Redis (http://redis.io) as a database backend.
- * This module requires the module redis to be loaded and configured properly.
- */
-#module
-{
- name = "database/redis"
-
- /*
- * Redis database to use. This must be configured with the module redis.
- */
- engine = "redis/main"
-}
-
-/*
* [RECOMMENDED] Encryption modules.
*
* The encryption modules are used when dealing with passwords. This determines how
diff --git a/data/modules.example.conf b/data/modules.example.conf
index 0f22a7c72..725130137 100644
--- a/data/modules.example.conf
+++ b/data/modules.example.conf
@@ -384,31 +384,6 @@ module { name = "help" }
}
/*
- * redis
- *
- * This module allows other modules to use Redis.
- */
-#module
-{
- name = "redis"
-
- /* A redis database */
- redis
- {
- /* The name of this service */
- name = "redis/main"
-
- /*
- * The redis database to use. New connections default to 0.
- */
- db = 0
-
- ip = "127.0.0.1"
- port = 6379
- }
-}
-
-/*
* rest [EXTRA]
*
* This module exposes a RESTful API using JSON via the httpd module.
diff --git a/docs/SQLite.md b/docs/SQLite.md
index be25bbb27..30e0d7b12 100644
--- a/docs/SQLite.md
+++ b/docs/SQLite.md
@@ -6,21 +6,21 @@ It does this by using SQLites support for having indexes on expressions https://
For example the account table could look like:
```
-CREATE TABLE `anope_db_account` (
+CREATE TABLE `anope_account` (
+ `id` INTEGER PRIMARY KEY AUTOINCREMENT,
`display`,
`pass`,
`email`,
- `language`,
- `id` NOT NULL PRIMARY KEY,
- FOREIGN KEY (id) REFERENCES anope_db_objects(id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED
+ `language`
);
-CREATE INDEX idx_display ON `anope_db_account` (anope_canonicalize(display));
+
+CREATE INDEX idx_display ON `anope_account` (anope_canonicalize(display));
```
So, to do a SELECT which utilizes the indicies, Anope does something like:
```
-SELECT id FROM `anope_db_account` WHERE anope_canonicalize(display) = anope_canonicalize('Adam');
+SELECT id FROM `anope_account` WHERE anope_canonicalize(display) = anope_canonicalize('Adam');
```
If you are using your own SQLite instance, like the sqlite command line interface, the anope_canonicalize function
@@ -31,13 +31,13 @@ or libanope_sqlite_rfc1459.so into SQLite, depending on your casemap configurati
sqlite> .load lib/libanope_sqlite_ascii.so
```
-## Example of adding a new operator via SQLite
+## Example of registering a new user via SQLite
```
BEGIN TRANSACTION;
--- Allocate new ID and insert into objects table
-INSERT INTO anope_db_objects (id, type) SELECT MAX(id + 1), 'oper' FROM anope_db_objects;
--- Insert new operator using previously allocated id
-INSERT INTO anope_db_oper (name, type, require_oper, id) VALUES ('Adam', 'Services Root', 1, last_insert_rowid());
+-- Insert new account
+INSERT INTO anope_account (display, email, private, autoop, killprotect) VALUES ('Adam', 'adam@anope.org', 1, 1, 1);
+-- Insert nickname, linking it to the account
+INSERT INTO anope_nick (nick, account) VALUES ('Adam', last_insert_rowid());
COMMIT;
```
diff --git a/include/event.h b/include/event.h
index 85e406795..bcc04cc0a 100644
--- a/include/event.h
+++ b/include/event.h
@@ -1202,7 +1202,7 @@ namespace Event
virtual EventReturn OnSerializeDeref(Serialize::ID value, Serialize::TypeBase *type) anope_abstract;
- virtual EventReturn OnSerializableGetId(Serialize::ID &id) anope_abstract;
+ virtual EventReturn OnSerializableGetId(Serialize::TypeBase *type, Serialize::ID &id) anope_abstract;
virtual void OnSerializableDelete(Serialize::Object *) anope_abstract;
diff --git a/include/modules/chanserv/chanaccess.h b/include/modules/chanserv/chanaccess.h
index faaf48175..dff39c0f8 100644
--- a/include/modules/chanserv/chanaccess.h
+++ b/include/modules/chanserv/chanaccess.h
@@ -35,7 +35,7 @@ class CoreExport ChanAccess : public Serialize::Object
static constexpr const char *const NAME = "access";
Serialize::Storage<Channel *> channel;
- Serialize::Storage<Serialize::Object *> object;
+ Serialize::Storage<NickServ::Account *> account;
Serialize::Storage<Anope::string> creator, mask;
Serialize::Storage<time_t> last_seen, created;
@@ -56,11 +56,10 @@ class CoreExport ChanAccess : public Serialize::Object
virtual Anope::string GetMask() anope_abstract;
virtual void SetMask(const Anope::string &) anope_abstract;
- virtual Serialize::Object *GetObj() anope_abstract;
- virtual void SetObj(Serialize::Object *) anope_abstract;
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
virtual Anope::string Mask() anope_abstract;
- virtual NickServ::Account *GetAccount() anope_abstract;
/** Check if this access entry matches the given user or account
* @param u The user
diff --git a/include/modules/chanserv/main/chanaccess.h b/include/modules/chanserv/main/chanaccess.h
index a126da685..fb78056ea 100644
--- a/include/modules/chanserv/main/chanaccess.h
+++ b/include/modules/chanserv/main/chanaccess.h
@@ -22,8 +22,7 @@
class ChanAccessImpl : public ChanServ::ChanAccess
{
public:
- ChanAccessImpl(Serialize::TypeBase *type) : ChanServ::ChanAccess(type) { }
- ChanAccessImpl(Serialize::TypeBase *type, Serialize::ID id) : ChanServ::ChanAccess(type, id) { }
+ using ChanServ::ChanAccess::ChanAccess;
ChanServ::Channel *GetChannel() override;
void SetChannel(ChanServ::Channel *ci) override;
@@ -40,11 +39,10 @@ class ChanAccessImpl : public ChanServ::ChanAccess
Anope::string GetMask() override;
void SetMask(const Anope::string &) override;
- Serialize::Object *GetObj() override;
- void SetObj(Serialize::Object *) override;
+ NickServ::Account *GetAccount() override;
+ void SetAccount(NickServ::Account *) override;
Anope::string Mask() override;
- NickServ::Account *GetAccount() override;
bool Matches(const User *u, NickServ::Account *acc) override;
};
diff --git a/include/modules/hostserv.h b/include/modules/hostserv.h
index 6934c813e..f2ec9a187 100644
--- a/include/modules/hostserv.h
+++ b/include/modules/hostserv.h
@@ -31,8 +31,8 @@ namespace HostServ
public:
static constexpr const char *const NAME = "vhost";
- virtual Serialize::Object *GetOwner() anope_abstract;
- virtual void SetOwner(Serialize::Object *) anope_abstract;
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
virtual Anope::string GetIdent() anope_abstract;
virtual void SetIdent(const Anope::string &) anope_abstract;
diff --git a/include/modules/memoserv.h b/include/modules/memoserv.h
index 8c39b5a5e..888f793fe 100644
--- a/include/modules/memoserv.h
+++ b/include/modules/memoserv.h
@@ -138,8 +138,11 @@ namespace MemoServ
virtual bool HasIgnore(User *u) anope_abstract;
- virtual Serialize::Object *GetOwner() anope_abstract;
- virtual void SetOwner(Serialize::Object *) anope_abstract;
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
virtual int16_t GetMemoMax() anope_abstract;
virtual void SetMemoMax(const int16_t &) anope_abstract;
diff --git a/include/modules/operserv/info.h b/include/modules/operserv/info.h
index 0e2198880..0ab6d65b6 100644
--- a/include/modules/operserv/info.h
+++ b/include/modules/operserv/info.h
@@ -25,8 +25,11 @@ class OperInfo : public Serialize::Object
public:
static constexpr const char *const NAME = "operinfo";
- virtual Serialize::Object *GetTarget() anope_abstract;
- virtual void SetTarget(Serialize::Object *) anope_abstract;
+ virtual NickServ::Account *GetAccount() anope_abstract;
+ virtual void SetAccount(NickServ::Account *) anope_abstract;
+
+ virtual ChanServ::Channel *GetChannel() anope_abstract;
+ virtual void SetChannel(ChanServ::Channel *) anope_abstract;
virtual Anope::string GetInfo() anope_abstract;
virtual void SetInfo(const Anope::string &) anope_abstract;
diff --git a/include/modules/sql.h b/include/modules/sql.h
index 263b99fd1..31e7af0bf 100644
--- a/include/modules/sql.h
+++ b/include/modules/sql.h
@@ -210,7 +210,7 @@ namespace SQL
virtual Query BeginTransaction() anope_abstract;
virtual Query Commit() anope_abstract;
- virtual Serialize::ID GetID(const Anope::string &) anope_abstract;
+ virtual Serialize::ID GetID(const Anope::string &prefix, const Anope::string &type) anope_abstract;
virtual Query GetTables(const Anope::string &prefix) anope_abstract;
};
diff --git a/include/serialize.h b/include/serialize.h
index 90aedc7ae..10ec14d16 100644
--- a/include/serialize.h
+++ b/include/serialize.h
@@ -41,11 +41,9 @@ namespace Serialize
template<typename T, typename> class Type;
template<typename T> class Reference;
- // by id
- extern std::unordered_map<ID, Object *> objects;
extern std::vector<FieldBase *> serializableFields;
- extern Object *GetID(ID id);
+ extern Object *GetID(Serialize::TypeBase *type, ID id);
template<typename T>
inline T GetObject();
@@ -240,7 +238,6 @@ class CoreExport Serialize::TypeBase : public Service
std::set<Object *> objects;
TypeBase(Module *owner, const Anope::string &n);
- ~TypeBase();
void Unregister();
@@ -292,7 +289,7 @@ class Serialize::Type : public Base
T* RequireID(ID id)
{
- Object *s = Serialize::GetID(id);
+ Object *s = Serialize::GetID(this, id);
if (s == nullptr)
return new T(this, id);
@@ -353,7 +350,7 @@ class Serialize::Reference
if (!valid)
return nullptr;
- Object *targ = GetID(id);
+ Object *targ = GetID(type, id);
if (targ != nullptr && targ->GetSerializableType() == type)
return anope_dynamic_static_cast<T*>(targ);
diff --git a/modules/chanserv/access.cpp b/modules/chanserv/access.cpp
index 44d21734e..a29524a73 100644
--- a/modules/chanserv/access.cpp
+++ b/modules/chanserv/access.cpp
@@ -202,7 +202,7 @@ class CommandCSAccess : public Command
access = Serialize::New<AccessChanAccess *>();
if (na)
- access->SetObj(na->GetAccount());
+ access->SetAccount(na->GetAccount());
access->SetChannel(ci);
access->SetMask(mask);
access->SetCreator(source.GetNick());
@@ -263,7 +263,7 @@ class CommandCSAccess : public Command
ChanServ::AccessGroup ag = source.AccessFor(ci);
ChanServ::ChanAccess *u_highest = ag.Highest();
- if ((!u_highest || *u_highest <= *access) && !ag.founder && !source.IsOverride() && access->GetObj() != source.nc)
+ if ((!u_highest || *u_highest <= *access) && !ag.founder && !source.IsOverride() && access->GetAccount() != source.nc)
{
denied = true;
return;
@@ -305,7 +305,7 @@ class CommandCSAccess : public Command
ChanServ::ChanAccess *access = ci->GetAccess(i - 1);
if (mask.equals_ci(access->Mask()))
{
- if (access->GetObj() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasOverridePriv("chanserv/access/modify"))
+ if (access->GetAccount() != source.nc && !u_access.founder && (!highest || *highest <= *access) && !source.HasOverridePriv("chanserv/access/modify"))
{
source.Reply(_("Access denied. You do not have enough privileges on \002{0}\002 to remove the access of \002{1}\002."), ci->GetName(), access->Mask());
}
@@ -555,9 +555,6 @@ class CommandCSAccess : public Command
" Use of this command requires the \002{4}\002 privilege on \037channel\037."),
source.GetCommand(), ChanServ::ACCESS_INVALID + 1, ChanServ::ACCESS_FOUNDER - 1, "AUTOOP", "ACCESS_CHANGE");
- if (!Config->GetModule("chanserv/main")->Get<bool>("disallow_channel_access"))
- source.Reply(_("The given \037mask\037 may also be a channel, which will use the access list from the other channel up to the given \037level\037."));
-
//XXX show def levels
source.Reply(_("\n"
diff --git a/modules/chanserv/flags.cpp b/modules/chanserv/flags.cpp
index 6ec65d104..f535aa136 100644
--- a/modules/chanserv/flags.cpp
+++ b/modules/chanserv/flags.cpp
@@ -108,55 +108,28 @@ class CommandCSFlags : public Command
ChanServ::AccessGroup u_access = source.AccessFor(ci);
ChanServ::ChanAccess *highest = u_access.Highest();
- NickServ::Nick *na = nullptr;
- ChanServ::Channel *targ_ci = nullptr;
-
- if (IRCD->IsChannelValid(mask))
+ NickServ::Nick *na = NickServ::FindNick(mask);
+ if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access"))
{
- if (Config->GetModule("chanserv/main")->Get<bool>("disallow_channel_access"))
- {
- source.Reply(_("Channels may not be on access lists."));
- return;
- }
-
- targ_ci = ChanServ::Find(mask);
- if (targ_ci == NULL)
- {
- source.Reply(_("Channel \002{0}\002 isn't registered."), mask);
- return;
- }
- else if (ci == targ_ci)
- {
- source.Reply(_("You can't add a channel to its own access list."));
- return;
- }
-
- mask = targ_ci->GetName();
+ source.Reply(_("Masks and unregistered users may not be on access lists."));
+ return;
}
- else
+
+ if (mask.find_first_of("!*@") == Anope::string::npos && !na)
{
- na = NickServ::FindNick(mask);
- if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access"))
+ User *targ = User::Find(mask, true);
+ if (targ != NULL)
+ mask = "*!*@" + targ->GetDisplayedHost();
+ else
{
- source.Reply(_("Masks and unregistered users may not be on access lists."));
+ source.Reply(_("\002{0}\002 isn't registered."), mask);
return;
}
- else if (mask.find_first_of("!*@") == Anope::string::npos && !na)
- {
- User *targ = User::Find(mask, true);
- if (targ != NULL)
- mask = "*!*@" + targ->GetDisplayedHost();
- else
- {
- source.Reply(_("\002{0}\002 isn't registered."), mask);
- return;
- }
- }
-
- if (na)
- mask = na->GetNick();
}
+ if (na)
+ mask = na->GetNick();
+
ChanServ::ChanAccess *current = NULL;
unsigned current_idx;
std::set<char> current_flags;
@@ -275,9 +248,7 @@ class CommandCSFlags : public Command
FlagsChanAccess *access = Serialize::New<FlagsChanAccess *>();
if (na)
- access->SetObj(na->GetAccount());
- else if (targ_ci)
- access->SetObj(targ_ci);
+ access->SetAccount(na->GetAccount());
access->SetChannel(ci);
access->SetMask(mask);
access->SetCreator(source.GetNick());
diff --git a/modules/chanserv/main/chanaccess.cpp b/modules/chanserv/main/chanaccess.cpp
index 75c70ed9c..f2b170989 100644
--- a/modules/chanserv/main/chanaccess.cpp
+++ b/modules/chanserv/main/chanaccess.cpp
@@ -71,14 +71,14 @@ void ChanAccessImpl::SetMask(const Anope::string &n)
Object::Set(&ChanAccessType<ChanServ::ChanAccess>::mask, n);
}
-Serialize::Object *ChanAccessImpl::GetObj()
+NickServ::Account *ChanAccessImpl::GetAccount()
{
- return Get(&ChanAccessType<ChanServ::ChanAccess>::obj);
+ return Get(&ChanAccessType<ChanServ::ChanAccess>::account);
}
-void ChanAccessImpl::SetObj(Serialize::Object *o)
+void ChanAccessImpl::SetAccount(NickServ::Account *acc)
{
- Object::Set(&ChanAccessType<ChanServ::ChanAccess>::obj, o);
+ Object::Set(&ChanAccessType<ChanServ::ChanAccess>::account, acc);
}
Anope::string ChanAccessImpl::Mask()
@@ -89,14 +89,6 @@ Anope::string ChanAccessImpl::Mask()
return GetMask();
}
-NickServ::Account *ChanAccessImpl::GetAccount()
-{
- if (!GetObj() || GetObj()->GetSerializableType()->GetName() != NickServ::Account::NAME)
- return nullptr;
-
- return anope_dynamic_static_cast<NickServ::Account *>(GetObj());
-}
-
bool ChanAccessImpl::Matches(const User *u, NickServ::Account *acc)
{
if (this->GetAccount())
diff --git a/modules/chanserv/main/chanaccesstype.h b/modules/chanserv/main/chanaccesstype.h
index b93747be7..4d95ee8b7 100644
--- a/modules/chanserv/main/chanaccesstype.h
+++ b/modules/chanserv/main/chanaccesstype.h
@@ -25,7 +25,7 @@ class ChanAccessType : public Serialize::Type<T>
public:
Serialize::ObjectField<ChanServ::ChanAccess, ChanServ::Channel *> channel;
Serialize::Field<ChanServ::ChanAccess, Anope::string> mask;
- Serialize::ObjectField<ChanServ::ChanAccess, Serialize::Object *> obj;
+ Serialize::ObjectField<ChanServ::ChanAccess, NickServ::Account *> account;
Serialize::Field<ChanServ::ChanAccess, Anope::string> creator;
Serialize::Field<ChanServ::ChanAccess, time_t> last_seen;
Serialize::Field<ChanServ::ChanAccess, time_t> created;
@@ -33,7 +33,7 @@ class ChanAccessType : public Serialize::Type<T>
ChanAccessType(Module *me) : Serialize::Type<T>(me)
, channel(this, "channel", &ChanServ::ChanAccess::channel, true)
, mask(this, "mask", &ChanServ::ChanAccess::mask)
- , obj(this, "obj", &ChanServ::ChanAccess::object, true)
+ , account(this, "account", &ChanServ::ChanAccess::account, true)
, creator(this, "creator", &ChanServ::ChanAccess::creator)
, last_seen(this, "last_seen", &ChanServ::ChanAccess::last_seen)
, created(this, "created", &ChanServ::ChanAccess::created)
diff --git a/modules/chanserv/xop.cpp b/modules/chanserv/xop.cpp
index 91fc7e4f1..d41ed7ae6 100644
--- a/modules/chanserv/xop.cpp
+++ b/modules/chanserv/xop.cpp
@@ -153,58 +153,29 @@ class CommandCSXOP : public Command
}
}
- NickServ::Nick *na = nullptr;
- ChanServ::Channel *targ_ci = nullptr;
+ NickServ::Nick *na = NickServ::FindNick(mask);
- if (IRCD->IsChannelValid(mask))
+ if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access"))
{
- if (Config->GetModule("chanserv/main")->Get<bool>("disallow_channel_access"))
- {
- source.Reply(_("Channels may not be on access lists."));
- return;
- }
-
- targ_ci = ChanServ::Find(mask);
- if (targ_ci == NULL)
- {
- source.Reply(_("Channel \002{0}\002 isn't registered."), mask);
- return;
- }
-
- if (ci == targ_ci)
- {
- source.Reply(_("You can't add a channel to its own access list."));
- return;
- }
-
- mask = targ_ci->GetName();
+ source.Reply(_("Masks and unregistered users may not be on access lists."));
+ return;
}
- else
- {
- na = NickServ::FindNick(mask);
- if (!na && Config->GetModule("chanserv/main")->Get<bool>("disallow_hostmask_access"))
+ if (mask.find_first_of("!*@") == Anope::string::npos && !na)
+ {
+ User *targ = User::Find(mask, true);
+ if (targ != NULL)
+ mask = "*!*@" + targ->GetDisplayedHost();
+ else
{
- source.Reply(_("Masks and unregistered users may not be on access lists."));
+ source.Reply(_("\002{0}\002 isn't registered."), mask);
return;
}
-
- if (mask.find_first_of("!*@") == Anope::string::npos && !na)
- {
- User *targ = User::Find(mask, true);
- if (targ != NULL)
- mask = "*!*@" + targ->GetDisplayedHost();
- else
- {
- source.Reply(_("\002{0}\002 isn't registered."), mask);
- return;
- }
- }
-
- if (na)
- mask = na->GetNick();
}
+ if (na)
+ mask = na->GetNick();
+
for (unsigned i = 0; i < ci->GetAccessCount(); ++i)
{
ChanServ::ChanAccess *a = ci->GetAccess(i);
@@ -231,9 +202,7 @@ class CommandCSXOP : public Command
XOPChanAccess *acc = Serialize::New<XOPChanAccess *>();
if (na)
- acc->SetObj(na->GetAccount());
- else if (targ_ci)
- acc->SetObj(targ_ci);
+ acc->SetAccount(na->GetAccount());
acc->SetChannel(ci);
acc->SetMask(mask);
acc->SetCreator(source.GetNick());
diff --git a/modules/database/flatfile.cpp b/modules/database/flatfile.cpp
index 27a51539c..ec6911ce2 100644
--- a/modules/database/flatfile.cpp
+++ b/modules/database/flatfile.cpp
@@ -129,7 +129,7 @@ class DBFlatFile : public Module
HostServ::VHost *vhost = Serialize::New<HostServ::VHost *>();
if (vhost != nullptr)
{
- vhost->SetOwner(acc);
+ vhost->SetAccount(acc);
vhost->SetIdent(data["vhost_ident"]);
vhost->SetHost(data["vhost_host"]);
vhost->SetCreator(data["vhost_creator"]);
@@ -352,7 +352,7 @@ class DBFlatFile : public Module
NickServ::Nick *nick = NickServ::FindNick(mask);
if (nick != nullptr)
- access->SetObj(nick->GetAccount());
+ access->SetAccount(nick->GetAccount());
access->AccessUnserialize(data["data"]);
}
@@ -557,18 +557,18 @@ class DBFlatFile : public Module
void LoadOperInfo(const Anope::string &type, std::map<Anope::string, Anope::string> &data)
{
- Serialize::Object *target = NickServ::FindAccount(data["target"]);
- if (target == nullptr)
- target = ChanServ::Find(data["target"]);
+ NickServ::Account *acc = NickServ::FindAccount(data["target"]);
+ ChanServ::Channel *chan = ChanServ::Find(data["target"]);
- if (target == nullptr)
+ if (acc == nullptr && chan == nullptr)
return;
OperInfo *o = Serialize::New<OperInfo *>();
if (o == nullptr)
return;
- o->SetTarget(target);
+ o->SetAccount(acc);
+ o->SetChannel(chan);
o->SetInfo(data["info"]);
o->SetCreator(data["adder"]);
try
diff --git a/modules/database/old.cpp b/modules/database/old.cpp
index 894b9125b..3a2b6ccb6 100644
--- a/modules/database/old.cpp
+++ b/modules/database/old.cpp
@@ -743,7 +743,7 @@ static void LoadVHosts()
if (vhost == nullptr)
continue;
- vhost->SetOwner(na->GetAccount());
+ vhost->SetAccount(na->GetAccount());
vhost->SetIdent(ident);
vhost->SetHost(host);
vhost->SetCreator(creator);
diff --git a/modules/database/redis.cpp b/modules/database/redis.cpp
deleted file mode 100644
index b6ce95241..000000000
--- a/modules/database/redis.cpp
+++ /dev/null
@@ -1,448 +0,0 @@
-/*
- * Anope IRC Services
- *
- * Copyright (C) 2013-2016 Anope Team <team@anope.org>
- *
- * This file is part of Anope. Anope is free software; you can
- * redistribute it and/or modify it under the terms of the GNU
- * General Public License as published by the Free Software
- * Foundation, version 2.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see see <http://www.gnu.org/licenses/>.
- */
-
-#include "module.h"
-#include "modules/redis.h"
-
-using namespace Redis;
-
-class DatabaseRedis;
-static DatabaseRedis *me;
-
-class TypeLoader : public Interface
-{
- Serialize::TypeBase *type;
-
- public:
- TypeLoader(Module *creator, Serialize::TypeBase *t) : Interface(creator), type(t) { }
-
- void OnResult(const Reply &r) override;
-};
-
-class ObjectLoader : public Interface
-{
- Serialize::Object *obj;
-
- public:
- ObjectLoader(Module *creator, Serialize::Object *s) : Interface(creator), obj(s) { }
-
- void OnResult(const Reply &r) override;
-};
-
-class FieldLoader : public Interface
-{
- Serialize::Object *obj;
- Serialize::FieldBase *field;
-
- public:
- FieldLoader(Module *creator, Serialize::Object *o, Serialize::FieldBase *f) : Interface(creator), obj(o), field(f) { }
-
- void OnResult(const Reply &) override;
-};
-
-class SubscriptionListener : public Interface
-{
- public:
- SubscriptionListener(Module *creator) : Interface(creator) { }
-
- void OnResult(const Reply &r) override;
-};
-
-class DatabaseRedis : public Module
- , public EventHook<Event::LoadDatabase>
- , public EventHook<Event::SerializeEvents>
-{
- SubscriptionListener sl;
-
- public:
- ServiceReference<Provider> redis;
-
- DatabaseRedis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, DATABAS