X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_testcommand.cpp;h=842dd3a55fe768ec7d0c8bca56741266aae2dc72;hb=e9d1efc1ae29ee86b3c2a42bf56531afac7add6d;hp=fd05b8009b4488d42e02a13290249a24b65ea25e;hpb=5797374a691d9436fdf713ef90fa537d09bc717c;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_testcommand.cpp b/src/modules/m_testcommand.cpp index fd05b8009..842dd3a55 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -1,69 +1,66 @@ -#include +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits + * + * This program is free but copyrighted software; see + * the file COPYING for details. + * + * --------------------------------------------------- + */ +#include "inspircd.h" #include "users.h" #include "channels.h" #include "modules.h" -/* $ModDesc: Povides a proof-of-concept test /WOOT command */ +/* $ModDesc: Provides a pointless /dalinfo command, demo module */ -Server *Srv; - - -void handle_woot(char **parameters, int pcnt, userrec *user) -{ - // this test command just accepts: - // /woot - // and sends to all opers with +s mode. - Srv->SendOpers(parameters[0]); -} - -class ModuleTestCommand : public Module +/** Handle /DALINFO + */ +class cmd_dalinfo : public command_t { public: - ModuleTestCommand() - { - Srv = new Server; - Srv->AddCommand("WOOT",handle_woot,0,1) - } - - virtual ~ModuleTestCommand() - { - delete Srv; - } - - virtual Version GetVersion() + /* Command 'dalinfo', takes no parameters and needs no special modes */ + cmd_dalinfo (InspIRCd* Instance) : command_t(Instance,"DALINFO", 0, 0) { - return Version(1,0,0,0); + this->source = "m_testcommand.so"; } - - virtual void OnUserConnect(userrec* user) + + CmdResult Handle (const char** parameters, int pcnt, userrec *user) { + user->WriteServ("NOTICE %s :*** DALNet had nothing to do with it.", user->nick); + return CMD_FAILURE; } - }; - -class ModuleTestCommandFactory : public ModuleFactory +class ModuleTestCommand : public Module { + cmd_dalinfo* newcommand; public: - ModuleTestCommandFactory() + ModuleTestCommand(InspIRCd* Me) + : Module(Me) { + // Create a new command + newcommand = new cmd_dalinfo(ServerInstance); + ServerInstance->AddCommand(newcommand); } - - ~ModuleTestCommandFactory() + + void Implements(char* List) { } - - virtual Module * CreateModule() + + virtual ~ModuleTestCommand() { - return new ModuleTestCommand; } - -}; + virtual Version GetVersion() + { + return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION); + } +}; -extern "C" void * init_module( void ) -{ - return new ModuleTestCommandFactory; -} +MODULE_INIT(ModuleTestCommand)