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