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