diff options
author | Adam <Adam@anope.org> | 2012-12-13 06:12:56 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2012-12-13 06:12:56 -0500 |
commit | c1077faa281c5635f85b892e605e23bd6c8fcc3b (patch) | |
tree | 213b5f87a19f182e1efd6110f03ff10d5b10ebf6 /src/xline.cpp | |
parent | 76ba147c22944b67e8522cd2bb7b6e1bae498ced (diff) |
Optimize much of the database code and serialize code.
Diffstat (limited to 'src/xline.cpp')
-rw-r--r-- | src/xline.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/src/xline.cpp b/src/xline.cpp index 4ac6581a1..b2fd00974 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -137,10 +137,8 @@ bool XLine::IsRegex() const return !this->mask.empty() && this->mask[0] == '/' && this->mask[this->mask.length() - 1] == '/'; } -Serialize::Data XLine::Serialize() const +void XLine::Serialize(Serialize::Data &data) const { - Serialize::Data data; - data["mask"] << this->mask; data["by"] << this->by; data["created"] << this->created; @@ -149,13 +147,15 @@ Serialize::Data XLine::Serialize() const data["uid"] << this->id; if (this->manager) data["manager"] << this->manager->name; - - return data; } Serializable* XLine::Unserialize(Serializable *obj, Serialize::Data &data) { - ServiceReference<XLineManager> xlm("XLineManager", data["manager"].astr()); + Anope::string smanager; + + data["manager"] >> smanager; + + ServiceReference<XLineManager> xlm("XLineManager", smanager); if (!xlm) return NULL; @@ -176,9 +176,16 @@ Serializable* XLine::Unserialize(Serializable *obj, Serialize::Data &data) } else { + Anope::string smask, sby, sreason, suid; time_t expires; + + data["mask"] >> smask; + data["by"] >> sby; + data["reason"] >> sreason; + data["uid"] >> suid; data["expires"] >> expires; - xl = new XLine(data["mask"].astr(), data["by"].astr(), expires, data["reason"].astr(), data["uid"].astr()); + + xl = new XLine(smask, sby, expires, sreason, suid); xlm->AddXLine(xl); } |