From beae4775cfd6692c30573a6e6ae4fa748d377fed Mon Sep 17 00:00:00 2001 From: Adam Date: Tue, 13 Mar 2012 16:58:14 -0400 Subject: [PATCH] Bug #1382 - Save maxusercount and maxusertime --- modules/commands/os_stats.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/modules/commands/os_stats.cpp b/modules/commands/os_stats.cpp index afa3b7e19..19ac54a27 100644 --- a/modules/commands/os_stats.cpp +++ b/modules/commands/os_stats.cpp @@ -13,6 +13,30 @@ #include "module.h" +struct Stats : Serializable +{ + Anope::string serialize_name() const + { + return "Stats"; + } + + serialized_data serialize() anope_override + { + serialized_data data; + + data["maxusercnt"] << maxusercnt; + data["maxusertime"] << maxusertime; + + return data; + } + + static void unserialize(serialized_data &data) + { + data["maxusercnt"] >> maxusercnt; + data["maxusertime"] >> maxusertime; + } +}; + /** * Count servers connected to server s * @param s The server to start counting from @@ -187,10 +211,12 @@ class CommandOSStats : public Command class OSStats : public Module { CommandOSStats commandosstats; + SerializeType stats_type; + Stats stats_saver; public: OSStats(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, CORE), - commandosstats(this) + commandosstats(this), stats_type("Stats", Stats::unserialize) { this->SetAuthor("Anope");