From 7e75018ba60a9f50ea9e936eb1b6eb6b44dbc668 Mon Sep 17 00:00:00 2001
From: J-P Nurmi <jpnurmi@gmail.com>
Date: Sat, 28 Feb 2015 21:15:23 +0100
Subject: [PATCH] Fix chansaver loading

CModules::LoadModule() sets the module type _after_ construction.
The constructor cannot therefore do actions based on the module
type. Move loading to OnLoad().
---
 modules/chansaver.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--- a/modules/chansaver.cpp
+++ b/modules/chansaver.cpp
@@ -21,6 +21,12 @@
 class CChanSaverMod : public CModule {
 public:
 	MODCONSTRUCTOR(CChanSaverMod) {
+	}
+
+	virtual ~CChanSaverMod() {
+	}
+
+	bool OnLoad(const CString& sArgsi, CString& sMessage) override {
 		switch (GetType()) {
 			case CModInfo::GlobalModule:
 				LoadUsers();
@@ -32,9 +38,7 @@ public:
 				LoadNetwork(GetNetwork());
 				break;
 		}
-	}
-
-	virtual ~CChanSaverMod() {
+		return true;
 	}
 
 	void LoadUsers() {
