]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_conn_lusers.cpp
Someone is getting slapped for this; the new hidesplits/hidebans behavior doesn't...
[user/henk/code/inspircd.git] / src / modules / m_conn_lusers.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *            the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "users.h"
15 #include "channels.h"
16 #include "modules.h"
17 #include "inspircd.h"
18
19 /* $ModDesc: Sends the /LUSERS on connect */
20
21
22
23 // This has to be the simplest module ever.
24 // The RFC doesnt specify that you should send the /LUSERS numerics
25 // on connect, but someone asked for it, so its in a module.
26
27 class ModuleConnLUSERS : public Module
28 {
29  private:
30          
31          
32  public:
33         ModuleConnLUSERS(InspIRCd* Me)
34                 : Module::Module(Me)
35         {
36                 
37         }
38         
39         virtual ~ModuleConnLUSERS()
40         {
41         }
42         
43         virtual Version GetVersion()
44         {
45                 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
46         }
47
48         void Implements(char* List)
49         {
50                 List[I_OnUserConnect] = 1;
51         }
52         
53         virtual void OnUserConnect(userrec* user)
54         {
55                 // if we're using a protocol module, we cant just call
56                 // the command handler because the protocol module
57                 // has hooked it. We must call OnPreCommand in the
58                 // protocol module. Yes, at some point there will
59                 // be a way to get the current protocol module's name
60                 // from the core and probably a pointer to its class.
61                 Module* Proto = ServerInstance->FindModule("m_spanningtree.so");
62                 if (Proto)
63                 {
64                         Proto->OnPreCommand("LUSERS", NULL, 0, user, true, "LUSERS");
65                 }
66                 else
67                 {
68                         ServerInstance->CallCommandHandler("LUSERS", NULL, 0, user);
69                 }
70         }
71 };
72
73
74 //
75 // The ModuleConnLUSERSFactory class inherits from ModuleFactory
76 // and creates a ModuleConnLUSERS object when requested.
77 //
78
79 class ModuleConnLUSERSFactory : public ModuleFactory
80 {
81  public:
82         ModuleConnLUSERSFactory()
83         {
84         }
85         
86         ~ModuleConnLUSERSFactory()
87         {
88         }
89         
90         virtual Module * CreateModule(InspIRCd* Me)
91         {
92                 return new ModuleConnLUSERS(Me);
93         }
94         
95 };
96
97
98 //
99 // The "C" linkage factory0() function creates the ModuleConnLUSERSFactory
100 // class for this library
101 //
102
103 extern "C" void * init_module( void )
104 {
105         return new ModuleConnLUSERSFactory;
106 }
107