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/nickcore.cpp | |
parent | 76ba147c22944b67e8522cd2bb7b6e1bae498ced (diff) |
Optimize much of the database code and serialize code.
Diffstat (limited to 'src/nickcore.cpp')
-rw-r--r-- | src/nickcore.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/nickcore.cpp b/src/nickcore.cpp index f9ac3ef6c..304a40569 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -78,11 +78,9 @@ NickCore::~NickCore() } } -Serialize::Data NickCore::Serialize() const +void NickCore::Serialize(Serialize::Data &data) const { - Serialize::Data data; - - data["display"].SetMax(Config->NickLen) << this->display; + data["display"] << this->display; data["pass"] << this->pass; data["email"] << this->email; data["greet"] << this->greet; @@ -95,24 +93,27 @@ Serialize::Data NickCore::Serialize() const data["memomax"] << this->memos.memomax; for (unsigned i = 0; i < this->memos.ignores.size(); ++i) data["memoignores"] << this->memos.ignores[i] << " "; - - return data; } Serializable* NickCore::Unserialize(Serializable *obj, Serialize::Data &data) { NickCore *nc; + Anope::string sdisplay, sflags; + + data["display"] >> sdisplay; + data["flags"] >> sflags; + if (obj) nc = anope_dynamic_static_cast<NickCore *>(obj); else - nc = new NickCore(data["display"].astr()); + nc = new NickCore(sdisplay); data["pass"] >> nc->pass; data["email"] >> nc->email; data["greet"] >> nc->greet; data["language"] >> nc->language; - nc->FromString(data["flags"].astr()); + nc->FromString(sflags); { Anope::string buf; data["access"] >> buf; |