X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_showwhois.cpp;h=5291ae59561b359bc3343e9fac2c90a68eee5fe2;hb=fd1d19d6345943ecdb5ce4ef947f9b3c5c8bca86;hp=ba4ba9e6ee04a69b04889f6421a1a96c3e68d64e;hpb=84a1569cd60daa64b1ae52a1fff62c0dc4d78850;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_showwhois.cpp b/src/modules/m_showwhois.cpp index ba4ba9e6e..5291ae595 100644 --- a/src/modules/m_showwhois.cpp +++ b/src/modules/m_showwhois.cpp @@ -23,8 +23,6 @@ #include "inspircd.h" -/* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */ - /** Handle user mode +W */ class SeeWhois : public SimpleUserModeHandler @@ -46,9 +44,9 @@ class WhoisNoticeCmd : public Command void HandleFast(User* dest, User* src) { - dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you", - dest->nick.c_str(), src->nick.c_str(), src->ident.c_str(), - dest->HasPrivPermission("users/auspex") ? src->host.c_str() : src->dhost.c_str()); + dest->WriteNotice("*** " + src->nick + " (" + src->ident + "@" + + (dest->HasPrivPermission("users/auspex") ? src->host : src->dhost) + + ") did a /whois on you"); } CmdResult Handle(const std::vector ¶meters, User *user) @@ -79,7 +77,7 @@ class ModuleShowwhois : public Module { } - void init() + void init() CXX11_OVERRIDE { ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois"); @@ -87,9 +85,8 @@ class ModuleShowwhois : public Module ShowWhoisFromOpers = tag->getBool("showfromopers", true); sw = new SeeWhois(this, OpersOnly); - if (!ServerInstance->Modes->AddMode(sw)) - throw ModuleException("Could not add new modes!"); - ServerInstance->AddCommand(&cmd); + ServerInstance->Modules->AddService(*sw); + ServerInstance->Modules->AddService(cmd); Implementation eventlist[] = { I_OnWhois }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } @@ -99,17 +96,17 @@ class ModuleShowwhois : public Module delete sw; } - Version GetVersion() + Version GetVersion() CXX11_OVERRIDE { return Version("Allows opers to set +W to see when a user uses WHOIS on them",VF_OPTCOMMON|VF_VENDOR); } - void OnWhois(User* source, User* dest) + void OnWhois(User* source, User* dest) CXX11_OVERRIDE { - if (!dest->IsModeSet('W') || source == dest) + if (!dest->IsModeSet(*sw) || source == dest) return; - if (!ShowWhoisFromOpers && IS_OPER(source)) + if (!ShowWhoisFromOpers && source->IsOper()) return; if (IS_LOCAL(dest)) @@ -126,7 +123,7 @@ class ModuleShowwhois : public Module ServerInstance->PI->SendEncapsulatedData(params); } } - }; MODULE_INIT(ModuleShowwhois) +