1
0
mirror of https://github.com/anope/anope.git synced 2026-07-08 05:23:13 +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
+39 -2
View File
@@ -16,6 +16,10 @@
/* List of XLine managers we check users against in XLineManager::CheckAll */
std::list<XLineManager *> XLineManager::XLineManagers;
XLine::XLine()
{
}
XLine::XLine(const Anope::string &mask, const Anope::string &reason) : Mask(mask), Created(0), Expires(0), Reason(reason)
{
}
@@ -66,6 +70,37 @@ sockaddrs XLine::GetIP() const
return addr;
}
SerializableBase::serialized_data XLine::serialize()
{
serialized_data data;
data["mask"] << this->Mask;
data["by"] << this->By;
data["created"] << this->Created;
data["expires"] << this->Expires;
data["reason"] << this->Reason;
data["manager"] << this->Manager;
return data;
}
void XLine::unserialize(SerializableBase::serialized_data &data)
{
service_reference<XLineManager> xlm(data["manager"].astr());
if (!xlm)
return;
XLine *xl = new XLine();
data["mask"] >> xl->Mask;
data["by"] >> xl->By;
data["created"] >> xl->Created;
data["expires"] >> xl->Expires;
data["reason"] >> xl->Reason;
xlm->AddXLine(xl);
}
/** Constructor
*/
XLineManager::XLineManager(Module *creator, const Anope::string &xname, char t) : Service<XLineManager>(creator, xname), type(t)
@@ -159,6 +194,7 @@ const std::vector<XLine *> &XLineManager::GetList() const
*/
void XLineManager::AddXLine(XLine *x)
{
x->Manager = this->name;
this->XLines.push_back(x);
}
@@ -199,8 +235,9 @@ XLine *XLineManager::GetEntry(unsigned index)
*/
void XLineManager::Clear()
{
while (!this->XLines.empty())
this->DelXLine(this->XLines.front());
for (unsigned i = 0; i < this->XLines.size(); ++i)
delete this->XLines[i];
this->XLines.clear();
}
/** Add an entry to this XLine Manager