1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 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 * ---------------------------------------------------
17 /* $ModDesc: A test of the RPC API */
20 class ModuleRPCTest : public Module
25 ModuleRPCTest(InspIRCd *Me) : Module(Me)
27 Implementation eventlist[] = { I_OnEvent };
28 ServerInstance->Modules->Attach(eventlist, this, 1);
31 virtual ~ModuleRPCTest()
35 virtual Version GetVersion()
37 return Version("$Id$", VF_VENDOR, API_VERSION);
41 virtual void OnEvent(Event *ev)
43 if (ev->GetEventID() == "RPCMethod")
45 RPCRequest *req = (RPCRequest*) ev->GetData();
47 if (req->method == "test.echo")
50 if (req->parameters->ArraySize() < 1)
52 req->error = "Insufficient parameters";
56 req->result->SetString(req->parameters->GetArray(0)->GetString());
62 MODULE_INIT(ModuleRPCTest)