]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_antibear.cpp
Fixes and removal of Server::GetServerName()
[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                 user->WriteServ("439 %s :This server has anti-spambot mechanisms enabled.", user->nick);
54                 user->WriteServ("931 %s :Malicious bots, spammers, and other automated systems of dubious origin are NOT welcome here.", user->nick);
55         }
56 };
57
58 class ModuleAntiBearFactory : public ModuleFactory
59 {
60  public:
61         ModuleAntiBearFactory()
62         {
63         }
64         
65         ~ModuleAntiBearFactory()
66         {
67         }
68         
69         virtual Module * CreateModule(Server* Me)
70         {
71                 return new ModuleAntiBear(Me);
72         }
73         
74 };
75
76
77 //
78 // The "C" linkage factory0() function creates the ModuleAntiBearFactory
79 // class for this library
80 //
81
82 extern "C" void * init_module( void )
83 {
84         return new ModuleAntiBearFactory;
85 }