1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
22 #include "helperfuncs.h"
24 /* $ModDesc: A dummy module for testing */
26 // Class ModuleFoobar inherits from Module
27 // It just outputs simple debug strings to show its methods are working.
29 class ModuleFoobar : public Module
33 // It is recommended that your class makes use of one or more Server
34 // objects. A server object is a class which contains methods which
35 // encapsulate the exports from the core of the ircd.
36 // such methods include Debug, SendChannel, etc.
40 ModuleFoobar(Server* Me)
43 // The constructor just makes a copy of the server class
48 virtual ~ModuleFoobar()
52 virtual Version GetVersion()
54 // this method instantiates a class of type Version, and returns
55 // the modules version information using it.
57 return Version(1,0,0,1,VF_VENDOR);
60 void Implements(char* List)
62 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
65 virtual void OnUserConnect(userrec* user)
67 // method called when a user connects
69 std::string b = user->nick;
70 Srv->Log(DEBUG,"Foobar: User connecting: " + b);
73 virtual void OnUserQuit(userrec* user, const std::string &reason)
75 // method called when a user disconnects
77 std::string b = user->nick;
78 Srv->Log(DEBUG,"Foobar: User quitting: " + b);
81 virtual void OnUserJoin(userrec* user, chanrec* channel)
83 // method called when a user joins a channel
85 std::string c = channel->name;
86 std::string b = user->nick;
87 Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c);
90 virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason)
92 // method called when a user parts a channel
94 std::string c = channel->name;
95 std::string b = user->nick;
96 Srv->Log(DEBUG,"Foobar: User " + b + " parted " + c);
103 // The ModuleFoobarFactory class inherits from ModuleFactory
104 // and creates a ModuleFoobar object when requested.
107 class ModuleFoobarFactory : public ModuleFactory
110 ModuleFoobarFactory()
114 ~ModuleFoobarFactory()
118 virtual Module * CreateModule(Server* Me)
120 return new ModuleFoobar(Me);
127 // The "C" linkage factory0() function creates the ModuleFoobarFactory
128 // class for this library
131 extern "C" void * init_module( void )
133 return new ModuleFoobarFactory;