]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_antibear.cpp
Add m_sqlutils - Currently provides ID->chan/user lookups
[user/henk/code/inspircd.git] / src / modules / m_antibear.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                     E-mail:
7  *              <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *          the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 using namespace std;
18
19 #include "users.h"
20 #include "channels.h"
21 #include "modules.h"
22 #include "helperfuncs.h"
23
24 /* $ModDesc: Sends a numeric on connect which cripples a common type of trojan/spambot */
25
26 class ModuleAntiBear : public Module
27 {
28  private:
29          
30          Server *Srv;
31  public:
32         ModuleAntiBear(Server* Me) : Module::Module(Me)
33         {
34                 Srv = Me;
35         }
36         
37         virtual ~ModuleAntiBear()
38         {
39         }
40         
41         virtual Version GetVersion()
42         {
43                 return Version(1,0,0,0,VF_VENDOR);
44         }
45
46         void Implements(char* List)
47         {
48                 List[I_OnUserRegister] = 1;
49         }
50         
51         virtual void OnUserRegister(userrec* user)
52         {
53                 WriteServ(user->fd,"439 %s :This server has anti-spambot mechanisms enabled.", user->nick);
54                 WriteServ(user->fd,"931 %s :Malicious bots, spammers, and other automated systems of", user->nick);
55                 WriteServ(user->fd,"437 %s :dubious origin are NOT welcome here.", user->nick); 
56         }
57 };
58
59 class ModuleAntiBearFactory : public ModuleFactory
60 {
61  public:
62         ModuleAntiBearFactory()
63         {
64         }
65         
66         ~ModuleAntiBearFactory()
67         {
68         }
69         
70         virtual Module * CreateModule(Server* Me)
71         {
72                 return new ModuleAntiBear(Me);
73         }
74         
75 };
76
77
78 //
79 // The "C" linkage factory0() function creates the ModuleAntiBearFactory
80 // class for this library
81 //
82
83 extern "C" void * init_module( void )
84 {
85         return new ModuleAntiBearFactory;
86 }
87