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 * ---------------------------------------------------
23 /* $ModDesc: A dummy module for testing */
25 // Class ModuleFoobar inherits from Module
26 // It just outputs simple debug strings to show its methods are working.
28 class ModuleFoobar : public Module
32 // It is recommended that your class makes use of one or more Server
33 // objects. A server object is a class which contains methods which
34 // encapsulate the exports from the core of the ircd.
35 // such methods include Debug, SendChannel, etc.
39 ModuleFoobar(Server* Me)
42 // The constructor just makes a copy of the server class
47 virtual ~ModuleFoobar()
51 virtual Version GetVersion()
53 // this method instantiates a class of type Version, and returns
54 // the modules version information using it.
56 return Version(1,0,0,1,VF_VENDOR);
59 void Implements(char* List)
61 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
64 virtual void OnUserConnect(userrec* user)
66 // method called when a user connects
68 std::string b = user->nick;
69 Srv->Log(DEBUG,"Foobar: User connecting: " + b);
72 virtual void OnUserQuit(userrec* user, const std::string &reason)
74 // method called when a user disconnects
76 std::string b = user->nick;
77 Srv->Log(DEBUG,"Foobar: User quitting: " + b);
80 virtual void OnUserJoin(userrec* user, chanrec* channel)
82 // method called when a user joins a channel
84 std::string c = channel->name;
85 std::string b = user->nick;
86 Srv->Log(DEBUG,"Foobar: User " + b + " joined " + c);
89 virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason)
91 // method called when a user parts a channel
93 std::string c = channel->name;
94 std::string b = user->nick;
95 Srv->Log(DEBUG,"Foobar: User " + b + " parted " + c);
102 // The ModuleFoobarFactory class inherits from ModuleFactory
103 // and creates a ModuleFoobar object when requested.
106 class ModuleFoobarFactory : public ModuleFactory
109 ModuleFoobarFactory()
113 ~ModuleFoobarFactory()
117 virtual Module * CreateModule(Server* Me)
119 return new ModuleFoobar(Me);
126 // The "C" linkage factory0() function creates the ModuleFoobarFactory
127 // class for this library
130 extern "C" void * init_module( void )
132 return new ModuleFoobarFactory;