+class ModuleShowwhois : public Module
+{
+ bool ShowWhoisFromOpers;
+ SeeWhois* sw;
+ WhoisNoticeCmd cmd;
+
+ public:
+
+ ModuleShowwhois()
+ : sw(NULL), cmd(this)
+ {
+ }
+
+ void init() CXX11_OVERRIDE
+ {
+ ConfigTag* tag = ServerInstance->Config->ConfValue("showwhois");
+
+ bool OpersOnly = tag->getBool("opersonly", true);
+ ShowWhoisFromOpers = tag->getBool("showfromopers", true);
+
+ sw = new SeeWhois(this, OpersOnly);
+ ServerInstance->Modules->AddService(*sw);
+ ServerInstance->Modules->AddService(cmd);
+ Implementation eventlist[] = { I_OnWhois };
+ ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
+ }
+
+ ~ModuleShowwhois()
+ {
+ delete sw;
+ }
+
+ 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) CXX11_OVERRIDE
+ {
+ if (!dest->IsModeSet('W') || source == dest)
+ return;
+
+ if (!ShowWhoisFromOpers && source->IsOper())
+ return;
+
+ if (IS_LOCAL(dest))