mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 19:49:02 -04:00
for file in $(find -type f -and -not -path '*/.svn/*' -and -not -name '*.so') ; do sed -e 's#http://www.inspircd.org/wiki#http://wiki.inspircd.org#' -e 's#http://wiki.inspircd.org/index.php/#http://wiki.inspircd.org/#' -i $file ; done git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11223 e03df62e-2008-0410-955e-edbf42e46eb7
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
/* +------------------------------------+
|
|
* | Inspire Internet Relay Chat Daemon |
|
|
* +------------------------------------+
|
|
*
|
|
* InspIRCd: (C) 2002-2009 InspIRCd Development Team
|
|
* See: http://wiki.inspircd.org/Credits
|
|
*
|
|
* This program is free but copyrighted software; see
|
|
* the file COPYING for details.
|
|
*
|
|
* ---------------------------------------------------
|
|
*/
|
|
|
|
#include "inspircd.h"
|
|
#include "rpc.h"
|
|
|
|
/* $ModDesc: A test of the RPC API */
|
|
/* $ModDep: rpc.h */
|
|
|
|
class ModuleRPCTest : public Module
|
|
{
|
|
private:
|
|
|
|
public:
|
|
ModuleRPCTest(InspIRCd *Me) : Module(Me)
|
|
{
|
|
Implementation eventlist[] = { I_OnEvent };
|
|
ServerInstance->Modules->Attach(eventlist, this, 1);
|
|
}
|
|
|
|
virtual ~ModuleRPCTest()
|
|
{
|
|
}
|
|
|
|
virtual Version GetVersion()
|
|
{
|
|
return Version("$Id$", VF_VENDOR, API_VERSION);
|
|
}
|
|
|
|
|
|
virtual void OnEvent(Event *ev)
|
|
{
|
|
if (ev->GetEventID() == "RPCMethod")
|
|
{
|
|
RPCRequest *req = (RPCRequest*) ev->GetData();
|
|
|
|
if (req->method == "test.echo")
|
|
{
|
|
req->claimed = true;
|
|
if (req->parameters->ArraySize() < 1)
|
|
{
|
|
req->error = "Insufficient parameters";
|
|
return;
|
|
}
|
|
|
|
req->result->SetString(req->parameters->GetArray(0)->GetString());
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
MODULE_INIT(ModuleRPCTest)
|
|
|