]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_showwhois.cpp
Change 974 numeric to 490 to avoid collision with Insp's failed to load module error
[user/henk/code/inspircd.git] / src / modules / m_showwhois.cpp
1 using namespace std;
2
3 // showwhois module by typobox43
4 // Modified by Craig
5
6 #include "users.h"
7 #include "channels.h"
8 #include "modules.h"
9 #include "helperfuncs.h"
10
11 /* $ModDesc: Allows opers to set +W to see when a user uses WHOIS on them */
12
13 class ModuleShowwhois : public Module
14 {
15                 Server* Srv;
16
17         public:
18                 ModuleShowwhois(Server* Me)
19                         : Module::Module(Me)
20                 {
21                         Srv = Me;
22                         Srv->AddExtendedMode('W',MT_CLIENT,true,0,0);
23                 }
24
25                 ~ModuleShowwhois()
26                 {
27                 }
28
29                 void Implements(char* List)
30                 {
31                         List[I_OnWhois] = List[I_OnExtendedMode] = 1;
32                 }
33
34                 virtual Version GetVersion()
35                 {
36                         return Version(1,0,0,3,VF_STATIC);
37                 }
38
39                 virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list& params)
40                 {
41                         if((type == MT_CLIENT) && (modechar == 'W'))
42                         {
43                                 return 1;
44                         }
45
46                         return 0;
47                 }
48
49                 virtual void OnWhois(userrec* source, userrec* dest)
50                 {
51                         if((strchr(dest->modes,'W')) && (source != dest))
52                         {
53                                 WriteServ(dest->fd,"NOTICE %s :*** %s (%s@%s) did a /whois on you.",dest->nick,source->nick,source->ident,source->host);
54                         }
55                 }
56
57 };
58
59 class ModuleShowwhoisFactory : public ModuleFactory
60 {
61         public:
62                 ModuleShowwhoisFactory()
63                 {
64                 }
65
66                 ~ModuleShowwhoisFactory()
67                 {
68                 }
69
70                 virtual Module* CreateModule(Server* Me)
71                 {
72                         return new ModuleShowwhois(Me);
73                 }
74
75 };
76
77 extern "C" void* init_module()
78 {
79         return new ModuleShowwhoisFactory;
80 }