5 /* $ModDesc: A dummy module for testing */
7 // Class ModuleFoobar inherits from Module
8 // It just outputs simple debug strings to show its methods are working.
10 class ModuleFoobar : public Module
14 // It is recommended that your class makes use of one or more Server
15 // objects. A server object is a class which contains methods which
16 // encapsulate the exports from the core of the ircd.
17 // such methods include Debug, SendChannel, etc.
23 // The constructor just creates an instance of the server class
28 virtual ~ModuleFoobar()
30 // destructor deletes the instance of the server class
35 virtual Version GetVersion()
37 // this method instantiates a class of type Version, and returns
38 // the modules version information using it.
40 return Version(1,0,0,0);
43 virtual void OnUserConnect(userrec* user)
45 // method called when a user connects
47 std::string b = user->nick;
48 Srv->Log(DEBUG,"Foobar: User connecting: " + b);
51 virtual void OnUserQuit(userrec* user)
53 // method called when a user disconnects
55 std::string b = user->nick;
56 Srv->Log(DEBUG,"Foobar: User quitting: " + b);
59 virtual void OnUserJoin(userrec* user, chanrec* channel)
61 // method called when a user joins a channel
63 std::string c = channel->name;
64 std::string b = user->nick;
65 Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c);
68 virtual void OnUserPart(userrec* user, chanrec* channel)
70 // method called when a user parts a channel
72 std::string c = channel->name;
73 std::string b = user->nick;
74 Srv->Log(DEBUG,"Foobar: User " + b + " parted " + c);
81 // The ModuleFoobarFactory class inherits from ModuleFactory
82 // and creates a ModuleFoobar object when requested.
85 class ModuleFoobarFactory : public ModuleFactory
92 ~ModuleFoobarFactory()
96 virtual Module * CreateModule()
98 return new ModuleFoobar;
105 // The "C" linkage factory0() function creates the ModuleFoobarFactory
106 // class for this library
109 extern "C" void * init_module( void )
111 return new ModuleFoobarFactory;