-class ModuleShowwhoisFactory : public ModuleFactory {
-
- public:
-
- ModuleShowwhoisFactory() {
-
- }
-
- ~ModuleShowwhoisFactory() {
-
- }
-
- virtual Module* CreateModule() {
-
- return new ModuleShowwhois;
-
+class ModuleShowwhois : public Module
+{
+
+ SeeWhois* sw;
+
+ public:
+
+ ModuleShowwhois(InspIRCd* Me) : Module(Me)
+ {
+
+ sw = new SeeWhois(ServerInstance);
+ if (!ServerInstance->AddMode(sw, 'W'))
+ throw ModuleException("Could not add new modes!");
+ }
+
+ ~ModuleShowwhois()
+ {
+ ServerInstance->Modes->DelMode(sw);
+ DELETE(sw);
+ }
+
+ void Implements(char* List)
+ {
+ List[I_OnWhois] = 1;
+ }
+
+ virtual Version GetVersion()
+ {
+ return Version(1,1,0,3,VF_COMMON|VF_VENDOR,API_VERSION);
+ }
+
+ virtual void OnWhois(userrec* source, userrec* dest)
+ {
+ if ((dest->IsModeSet('W')) && (source != dest))
+ {
+ if (IS_LOCAL(dest))
+ {
+ dest->WriteServ("NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host);
+ }
+ else
+ {
+ std::deque<std::string> params;
+ params.push_back(dest->nick);
+ std::string msg = ":";
+ msg = msg + dest->server + " NOTICE " + dest->nick + " :*** " + source->nick + " (" + source->ident + "@" + source->host + ") did a /whois on you.";
+ params.push_back(msg);
+ Event ev((char *) ¶ms, NULL, "send_push");
+ ev.Send(ServerInstance);
+ }