1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2007 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
20 /* $ModDesc: A dummy module for testing */
22 // Class ModuleFoobar inherits from Module
23 // It just outputs simple debug strings to show its methods are working.
25 class ModuleFoobar : public Module
29 // It is recommended that your class makes use of one or more Server
30 // objects. A server object is a class which contains methods which
31 // encapsulate the exports from the core of the ircd.
32 // such methods include Debug, SendChannel, etc.
36 ModuleFoobar(InspIRCd* Me)
39 // The constructor just makes a copy of the server class
44 virtual ~ModuleFoobar()
48 virtual Version GetVersion()
50 // this method instantiates a class of type Version, and returns
51 // the modules version information using it.
53 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
56 void Implements(char* List)
58 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
61 virtual void OnUserConnect(userrec* user)
63 // method called when a user connects
65 std::string b = user->nick;
66 ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
69 virtual void OnUserQuit(userrec* user, const std::string &reason, const std::string &oper_message)
71 // method called when a user disconnects
73 std::string b = user->nick;
74 ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
77 virtual void OnUserJoin(userrec* user, chanrec* channel, bool &silent)
79 // method called when a user joins a channel
81 std::string c = channel->name;
82 std::string b = user->nick;
83 ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
86 virtual void OnUserPart(userrec* user, chanrec* channel, const std::string &partreason, bool &silent)
88 // method called when a user parts a channel
90 std::string c = channel->name;
91 std::string b = user->nick;
92 ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
99 // The ModuleFoobarFactory class inherits from ModuleFactory
100 // and creates a ModuleFoobar object when requested.
103 class ModuleFoobarFactory : public ModuleFactory
106 ModuleFoobarFactory()
110 ~ModuleFoobarFactory()
114 virtual Module * CreateModule(InspIRCd* Me)
116 return new ModuleFoobar(Me);
123 // The "C" linkage factory0() function creates the ModuleFoobarFactory
124 // class for this library
127 extern "C" void * init_module( void )
129 return new ModuleFoobarFactory;