]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_foobar.cpp
We were already sending FMODE +nt after each channel creation to keep services happy...
[user/henk/code/inspircd.git] / src / modules / m_foobar.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 "inspircd.h"
15 #include "users.h"
16 #include "channels.h"
17 #include "modules.h"
18
19 /* $ModDesc: A dummy module for testing */
20
21 // Class ModuleFoobar inherits from Module
22 // It just outputs simple debug strings to show its methods are working.
23
24 class ModuleFoobar : public Module
25 {
26  private:
27          
28          // It is recommended that your class makes use of one or more Server
29          // objects. A server object is a class which contains methods which
30          // encapsulate the exports from the core of the ircd.
31          // such methods include Debug, SendChannel, etc.
32  
33          
34  public:
35         ModuleFoobar(InspIRCd* Me)
36                 : Module(Me)
37         {
38                 // The constructor just makes a copy of the server class
39         
40                 
41         }
42         
43         virtual ~ModuleFoobar()
44         {
45         }
46         
47         virtual Version GetVersion()
48         {
49                 // this method instantiates a class of type Version, and returns
50                 // the modules version information using it.
51         
52                 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
53         }
54
55         void Implements(char* List)
56         {
57                 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
58         }
59         
60         virtual void OnUserConnect(userrec* user)
61         {
62                 // method called when a user connects
63         
64                 std::string b = user->nick;
65                 ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
66         }
67
68         virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message)
69         {
70                 // method called when a user disconnects
71         
72                 std::string b = user->nick;
73                 ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
74         }
75         
76         virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent)
77         {
78                 // method called when a user joins a channel
79         
80                 std::string c = channel->name;
81                 std::string b = user->nick;
82                 ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
83         }
84
85         virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason, bool &silent)
86         {
87                 // method called when a user parts a channel
88         
89                 std::string c = channel->name;
90                 std::string b = user->nick;
91                 ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
92         }
93
94 };
95
96
97 //
98 // The ModuleFoobarFactory class inherits from ModuleFactory
99 // and creates a ModuleFoobar object when requested.
100 //
101
102 class ModuleFoobarFactory : public ModuleFactory
103 {
104  public:
105         ModuleFoobarFactory()
106         {
107         }
108         
109         ~ModuleFoobarFactory()
110         {
111         }
112         
113         virtual Module * CreateModule(InspIRCd* Me)
114         {
115                 return new ModuleFoobar(Me);
116         }
117         
118 };
119
120
121 //
122 // The "C" linkage factory0() function creates the ModuleFoobarFactory
123 // class for this library
124 //
125
126 extern "C" DllExport void * init_module( void )
127 {
128         return new ModuleFoobarFactory;
129 }
130