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 * ---------------------------------------------------
20 /* $ModDesc: A test of the RPC API */
23 class ModuleRPCTest : public Module
28 ModuleRPCTest(InspIRCd *Me) : Module(Me)
30 Implementation eventlist[] = { I_OnEvent };
31 ServerInstance->Modules->Attach(eventlist, this, 1);
34 virtual ~ModuleRPCTest()
38 virtual Version GetVersion()
40 return Version(1, 1, 0, 0, VF_VENDOR, API_VERSION);
44 virtual void OnEvent(Event *ev)
46 if (ev->GetEventID() == "RPCMethod")
48 RPCRequest *req = (RPCRequest*) ev->GetData();
50 if (req->method == "test.echo")
53 if (req->parameters->ArraySize() < 1)
55 req->error = "Insufficient parameters";
59 req->result->SetString(req->parameters->GetArray(0)->GetString());
65 MODULE_INIT(ModuleRPCTest)