1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2009 InspIRCd Development Team
6 * See: http://wiki.inspircd.org/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
26 Implementation eventlist[] = { I_OnEvent };
27 ServerInstance->Modules->Attach(eventlist, this, 1);
30 virtual ~ModuleRPCTest()
34 virtual Version GetVersion()
36 return Version("A test of the RPC API", VF_VENDOR, API_VERSION);
40 virtual void OnEvent(Event *ev)
42 if (ev->GetEventID() == "RPCMethod")
44 RPCRequest *req = (RPCRequest*) ev->GetData();
46 if (req->method == "test.echo")
49 if (req->parameters->ArraySize() < 1)
51 req->error = "Insufficient parameters";
55 req->result->SetString(req->parameters->GetArray(0)->GetString());
61 MODULE_INIT(ModuleRPCTest)