1
0
mirror of https://github.com/anope/anope.git synced 2026-07-02 11:46:37 +02:00

Added a new database format and sqlite support. Also moved db-convert to a module.

This commit is contained in:
Adam
2011-09-25 04:19:15 -04:00
parent 43201ead95
commit 1f2399de36
75 changed files with 4143 additions and 5880 deletions
+51
View File
@@ -45,6 +45,57 @@ NickCore::~NickCore()
}
}
SerializableBase::serialized_data NickCore::serialize()
{
serialized_data data;
data["display"].setKey().setMax(Config->NickLen) << this->display;
data["pass"] << this->pass;
data["email"] << this->email;
data["greet"] << this->greet;
data["language"] << this->language;
for (unsigned i = 0; i < this->access.size(); ++i)
data["access"] << this->access[i] << " ";
for (unsigned i = 0; i < this->cert.size(); ++i)
data["cert"] << this->cert[i] << " ";
data["memomax"] << this->memos.memomax;
for (unsigned i = 0; i < this->memos.ignores.size(); ++i)
data["memoignores"] << this->memos.ignores[i] << " ";
return data;
}
void NickCore::unserialize(serialized_data &data)
{
NickCore *nc = new NickCore(data["display"].astr());
data["pass"] >> nc->pass;
data["email"] >> nc->email;
data["greet"] >> nc->greet;
data["language"] >> nc->language;
{
Anope::string buf;
data["access"] >> buf;
spacesepstream sep(buf);
while (sep.GetToken(buf))
nc->access.push_back(buf);
}
{
Anope::string buf;
data["cert"] >> buf;
spacesepstream sep(buf);
while (sep.GetToken(buf))
nc->access.push_back(buf);
}
data["memomax"] >> nc->memos.memomax;
{
Anope::string buf;
data["memoignores"] >> buf;
spacesepstream sep(buf);
while (sep.GetToken(buf))
nc->memos.ignores.push_back(buf);
}
}
bool NickCore::IsServicesOper() const
{
return this->o != NULL;