X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_testcommand.cpp;h=bce148adcd548db1a1ead85e5d9a720046e95f54;hb=0898f10f75bcd8ecde21c73da90955f95dc30e50;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..bce148adc 100644 --- a/src/modules/m_testcommand.cpp +++ b/src/modules/m_testcommand.cpp @@ -1,69 +1,61 @@ -#include - -#include "users.h" -#include "channels.h" -#include "modules.h" - -/* $ModDesc: Povides a proof-of-concept test /WOOT command */ - -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 +/* +------------------------------------+ + * | Inspire Internet Relay Chat Daemon | + * +------------------------------------+ + * + * InspIRCd: (C) 2002-2008 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" + +/* $ModDesc: Provides a pointless /dalinfo command, demo module */ + +/** Handle /DALINFO + */ +class CommandDalinfo : public Command { 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 */ + CommandDalinfo (InspIRCd* Instance) : Command(Instance,"DALINFO", 0, 0) { - return Version(1,0,0,0); + this->source = "m_testcommand.so"; } - - virtual void OnUserConnect(userrec* user) + + CmdResult Handle (const char* const* parameters, int pcnt, User *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 { + CommandDalinfo* newcommand; public: - ModuleTestCommandFactory() + ModuleTestCommand(InspIRCd* Me) + : Module(Me) { + // Create a new command + newcommand = new CommandDalinfo(ServerInstance); + ServerInstance->AddCommand(newcommand); + } - - ~ModuleTestCommandFactory() + + + virtual ~ModuleTestCommand() { } - - virtual Module * CreateModule() + + virtual Version GetVersion() { - return new ModuleTestCommand; + return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION); } - }; - -extern "C" void * init_module( void ) -{ - return new ModuleTestCommandFactory; -} +MODULE_INIT(ModuleTestCommand)