]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_conn_lusers.cpp
c0106566a2f640d98dcfb41782ae34bedf2fe8c1
[user/henk/code/inspircd.git] / src / modules / m_conn_lusers.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  Inspire is copyright (C) 2002-2004 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
23 /* $ModDesc: Sends the /LUSERS on connect */
24
25 // This has to be the simplest module ever.
26 // The RFC doesnt specify that you should send the /LUSERS numerics
27 // on connect, but someone asked for it, so its in a module.
28
29 class ModuleConnLUSERS : public Module
30 {
31  private:
32          
33          Server *Srv;
34  public:
35         ModuleConnLUSERS()
36         {
37                 Srv = new Server;
38         }
39         
40         virtual ~ModuleConnLUSERS()
41         {
42                 delete Srv;
43         }
44         
45         virtual Version GetVersion()
46         {
47                 return Version(1,0,0,1,VF_VENDOR);
48         }
49         
50         virtual void OnUserConnect(userrec* user)
51         {
52                 Srv->CallCommandHandler("LUSERS", NULL, 0, user);
53         }
54 };
55
56
57 //
58 // The ModuleConnLUSERSFactory class inherits from ModuleFactory
59 // and creates a ModuleConnLUSERS object when requested.
60 //
61
62 class ModuleConnLUSERSFactory : public ModuleFactory
63 {
64  public:
65         ModuleConnLUSERSFactory()
66         {
67         }
68         
69         ~ModuleConnLUSERSFactory()
70         {
71         }
72         
73         virtual Module * CreateModule()
74         {
75                 return new ModuleConnLUSERS;
76         }
77         
78 };
79
80
81 //
82 // The "C" linkage factory0() function creates the ModuleConnLUSERSFactory
83 // class for this library
84 //
85
86 extern "C" void * init_module( void )
87 {
88         return new ModuleConnLUSERSFactory;
89 }
90