From 4b6bdeccb537b6f8030172c37afa7dc324e26765 Mon Sep 17 00:00:00 2001 From: danieldg Date: Sun, 17 Jan 2010 16:00:14 +0000 Subject: Add Module::init() for correct exception handling during hook registration git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12278 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_censor.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/modules/m_censor.cpp') diff --git a/src/modules/m_censor.cpp b/src/modules/m_censor.cpp index 03d591fa8..e356ee9a7 100644 --- a/src/modules/m_censor.cpp +++ b/src/modules/m_censor.cpp @@ -44,14 +44,15 @@ class ModuleCensor : public Module CensorChannel cc; public: - ModuleCensor() - : cu(this), cc(this) + ModuleCensor() : cu(this), cc(this) { } + + void init() { /* Read the configuration file on startup. */ OnRehash(NULL); - if (!ServerInstance->Modes->AddMode(&cu) || !ServerInstance->Modes->AddMode(&cc)) - throw ModuleException("Could not add new modes!"); + ServerInstance->Modules->AddService(cu); + ServerInstance->Modules->AddService(cc); Implementation eventlist[] = { I_OnRehash, I_OnUserPreMessage, I_OnUserPreNotice }; ServerInstance->Modules->Attach(eventlist, this, 3); } -- cgit v1.2.3