]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_foobar.cpp
b086eb3454140bfd83936c6dcd67a4e912f6ba00
[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
16 /* $ModDesc: A dummy module for testing */
17
18 // Class ModuleFoobar inherits from Module
19 // It just outputs simple debug strings to show its methods are working.
20
21 class ModuleFoobar : public Module
22 {
23  private:
24          
25          // It is recommended that your class makes use of one or more Server
26          // objects. A server object is a class which contains methods which
27          // encapsulate the exports from the core of the ircd.
28          // such methods include Debug, SendChannel, etc.
29  
30          
31  public:
32         ModuleFoobar(InspIRCd* Me)
33                 : Module(Me)
34         {
35                 // The constructor just makes a copy of the server class
36         
37                 
38         }
39         
40         virtual ~ModuleFoobar()
41         {
42         }
43         
44         virtual Version GetVersion()
45         {
46                 // this method instantiates a class of type Version, and returns
47                 // the modules version information using it.
48         
49                 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
50         }
51
52         void Implements(char* List)
53         {
54                 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
55         }
56         
57         virtual void OnUserConnect(userrec* user)
58         {
59                 // method called when a user connects
60         
61                 std::string b = user->nick;
62                 ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
63         }
64
65         virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message)
66         {
67                 // method called when a user disconnects
68         
69                 std::string b = user->nick;
70                 ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
71         }
72         
73         virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent)
74         {
75                 // method called when a user joins a channel
76         
77                 std::string c = channel->name;
78                 std::string b = user->nick;
79                 ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
80         }
81
82         virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason, bool &silent)
83         {
84                 // method called when a user parts a channel
85         
86                 std::string c = channel->name;
87                 std::string b = user->nick;
88                 ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
89         }
90
91 };
92
93
94 MODULE_INIT(ModuleFoobar)
95