From c1077faa281c5635f85b892e605e23bd6c8fcc3b Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 13 Dec 2012 06:12:56 -0500 Subject: Optimize much of the database code and serialize code. --- modules/commands/cs_seen.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'modules/commands/cs_seen.cpp') diff --git a/modules/commands/cs_seen.cpp b/modules/commands/cs_seen.cpp index 18a21d35e..8f90e2f08 100644 --- a/modules/commands/cs_seen.cpp +++ b/modules/commands/cs_seen.cpp @@ -38,30 +38,30 @@ struct SeenInfo : Serializable { } - Serialize::Data Serialize() const anope_override + void Serialize(Serialize::Data &data) const anope_override { - Serialize::Data data; - data["nick"] << nick; data["vhost"] << vhost; data["type"] << type; data["nick2"] << nick2; data["channel"] << channel; data["message"] << message; - data["last"].SetType(Serialize::DT_INT) << last; - - return data; + data.SetType("last", Serialize::Data::DT_INT); data["last"] << last; } static Serializable* Unserialize(Serializable *obj, Serialize::Data &data) { + Anope::string snick; + + data["nick"] >> snick; + SeenInfo *s; if (obj) s = anope_dynamic_static_cast(obj); else { /* ignore duplicate entries in the db, created by an old bug */ - s = FindInfo(data["nick"].str()); + s = FindInfo(snick); if (!s) s = new SeenInfo(); } -- cgit