X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_showwhois.cpp;h=96d8d90cf24f8e192c62d8b09b4a251a0e02697c;hb=9d75ba35743eb8f44a2d7beb8e08aa43c13f5d2e;hp=bf3028c122e233febc6664b1a6596bd45ee57625;hpb=1031f333332cf1b09db4fd632f141143ee637c34;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index bf3028c12..96d8d90cf 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -28,9 +28,14 @@ class SeeWhois : public SimpleUserModeHandler { public: - SeeWhois(Module* Creator, bool IsOpersOnly) : SimpleUserModeHandler(Creator, "showwhois", 'W') + SeeWhois(Module* Creator) + : SimpleUserModeHandler(Creator, "showwhois", 'W') { - oper = IsOpersOnly; + } + + void SetOperOnly(bool operonly) + { + oper = operonly; } }; @@ -67,13 +72,13 @@ class WhoisNoticeCmd : public Command class ModuleShowwhois : public Module { bool ShowWhoisFromOpers; - SeeWhois* sw; + SeeWhois sw; WhoisNoticeCmd cmd; public: ModuleShowwhois() - : sw(NULL), cmd(this) + : sw(this), cmd(this) { } @@ -81,17 +86,8 @@ class ModuleShowwhois : public Module { ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois"); - bool OpersOnly = tag->getBool("opersonly", true); + sw.SetOperOnly(tag->getBool("opersonly", true)); ShowWhoisFromOpers = tag->getBool("showfromopers", true); - - sw = new SeeWhois(this, OpersOnly); - ServerInstance->Modules->AddService(*sw); - ServerInstance->Modules->AddService(cmd); - } - - ~ModuleShowwhois() - { - delete sw; } Version GetVersion() CXX11_OVERRIDE @@ -101,7 +97,7 @@ class ModuleShowwhois : public Module void OnWhois(User* source, User* dest) CXX11_OVERRIDE { - if (!dest->IsModeSet(*sw) || source == dest) + if (!dest->IsModeSet(sw) || source == dest) return; if (!ShowWhoisFromOpers && source->IsOper())