diff options
| author | Adam <Adam@anope.org> | 2012-04-23 05:08:26 -0400 |
|---|---|---|
| committer | Adam <Adam@anope.org> | 2012-04-23 05:08:26 -0400 |
| commit | 573e49a7ead331219eb6f0d3ca9cf83e793a5c9c (patch) | |
| tree | e145e04fa3d041cf92ce46da4ac790b63231059c /modules/commands/os_session.h | |
| parent | 63c639e108a00d7dbb0d7ac9891684fc83a3b207 (diff) | |
Reworked live SQL support yet again
Diffstat (limited to 'modules/commands/os_session.h')
| -rw-r--r-- | modules/commands/os_session.h | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/modules/commands/os_session.h b/modules/commands/os_session.h index 561280170..b40177a32 100644 --- a/modules/commands/os_session.h +++ b/modules/commands/os_session.h @@ -17,9 +17,9 @@ struct Exception : Serializable time_t time; /* When this exception was added */ time_t expires; /* Time when it expires. 0 == no expiry */ - Anope::string serialize_name() const anope_override { return "Exception"; } - serialized_data serialize() anope_override; - static void unserialize(serialized_data &data); + const Anope::string serialize_name() const anope_override { return "Exception"; } + Serialize::Data serialize() const anope_override; + static Serializable* unserialize(Serializable *obj, Serialize::Data &data); }; class SessionService : public Service @@ -51,9 +51,9 @@ class SessionService : public Service static service_reference<SessionService> session_service("SessionService", "session"); -Serializable::serialized_data Exception::serialize() +Serialize::Data Exception::serialize() const { - serialized_data data; + Serialize::Data data; data["mask"] << this->mask; data["limit"] << this->limit; @@ -65,12 +65,16 @@ Serializable::serialized_data Exception::serialize() return data; } -void Exception::unserialize(Serializable::serialized_data &data) +Serializable* Exception::unserialize(Serializable *obj, Serialize::Data &data) { if (!session_service) - return; + return NULL; - Exception *ex = new Exception; + Exception *ex; + if (obj) + ex = debug_cast<Exception *>(obj); + else + ex = new Exception; data["mask"] >> ex->mask; data["limit"] >> ex->limit; data["who"] >> ex->who; @@ -78,7 +82,9 @@ void Exception::unserialize(Serializable::serialized_data &data) data["time"] >> ex->time; data["expires"] >> ex->expires; - session_service->AddException(ex); + if (!obj) + session_service->AddException(ex); + return ex; } #endif |
