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 * ---------------------------------------------------
16 /* $ModDesc: A dummy module for testing */
18 // Class ModuleFoobar inherits from Module
19 // It just outputs simple debug strings to show its methods are working.
21 class ModuleFoobar : public Module
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.
32 ModuleFoobar(InspIRCd* Me)
35 // The constructor just makes a copy of the server class
38 Implementation eventlist[] = { I_OnUserConnect, I_OnUserQuit, I_OnUserJoin, I_OnUserPart };
39 ServerInstance->Modules->Attach(eventlist, this, 4);
42 virtual ~ModuleFoobar()
46 virtual Version GetVersion()
48 // this method instantiates a class of type Version, and returns
49 // the modules version information using it.
51 return Version(1,1,0,1,VF_VENDOR,API_VERSION);
54 void Implements(char* List)
56 List[I_OnUserConnect] = List[I_OnUserQuit] = List[I_OnUserJoin] = List[I_OnUserPart] = 1;
59 virtual void OnUserConnect(User* user)
61 // method called when a user connects
63 std::string b = user->nick;
64 ServerInstance->Log(DEBUG,"Foobar: User connecting: "+b);
67 virtual void OnUserQuit(User* user, const std::string &reason, const std::string &oper_message)
69 // method called when a user disconnects
71 std::string b = user->nick;
72 ServerInstance->Log(DEBUG,"Foobar: User quitting: "+b);
75 virtual void OnUserJoin(User* user, Channel* channel, bool &silent)
77 // method called when a user joins a channel
79 std::string c = channel->name;
80 std::string b = user->nick;
81 ServerInstance->Log(DEBUG,"Foobar: User "+b+" joined "+c);
84 virtual void OnUserPart(User* user, Channel* channel, const std::string &partreason, bool &silent)
86 // method called when a user parts a channel
88 std::string c = channel->name;
89 std::string b = user->nick;
90 ServerInstance->Log(DEBUG,"Foobar: User "+b+" parted "+c);
96 MODULE_INIT(ModuleFoobar)