3 // showwhois module by typobox43
12 /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
16 class SeeWhois : public ModeHandler
19 SeeWhois(InspIRCd* Instance) : ModeHandler(Instance, 'W', 0, 0, false, MODETYPE_CHANNEL, false) { }
21 ModeAction OnModeChange(userrec* source, userrec* dest, chanrec* channel, std::string ¶meter, bool adding)
23 /* Only opers can change other users modes */
24 if ((source != dest) && (!*source->oper))
25 return MODEACTION_DENY;
29 if (!channel->IsModeSet('W'))
31 dest->SetMode('W',true);
32 return MODEACTION_ALLOW;
37 if (channel->IsModeSet('W'))
39 dest->SetMode('W',false);
40 return MODEACTION_ALLOW;
44 return MODEACTION_DENY;
48 class ModuleShowwhois : public Module
55 ModuleShowwhois(InspIRCd* Me) : Module::Module(Me)
58 sw = new SeeWhois(ServerInstance);
59 ServerInstance->AddMode(sw, 'W');
67 void Implements(char* List)
72 virtual Version GetVersion()
74 return Version(1,0,0,3,VF_STATIC);
77 virtual void OnWhois(userrec* source, userrec* dest)
79 if ((dest->IsModeSet('W')) && (source != dest))
81 dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host);
87 class ModuleShowwhoisFactory : public ModuleFactory
90 ModuleShowwhoisFactory()
94 ~ModuleShowwhoisFactory()
98 virtual Module* CreateModule(InspIRCd* Me)
100 return new ModuleShowwhois(Me);
105 extern "C" void* init_module()
107 return new ModuleShowwhoisFactory;