summaryrefslogtreecommitdiff
path: root/modules/extra/xmlrpc.h
blob: d5a5ea4a7924ffe5c9d61aeb00edd89ece1fe974 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "httpd.h"

class XMLRPCRequest
{
	std::map<Anope::string, Anope::string> replies;

 public:
	Anope::string name;
	Anope::string id;
	std::deque<Anope::string> data;
	HTTPReply& r;
	
	XMLRPCRequest(HTTPReply &_r) : r(_r) { }
	inline void reply(const Anope::string &dname, const Anope::string &ddata) { this->replies.insert(std::make_pair(dname, ddata)); }
	inline const std::map<Anope::string, Anope::string> &get_replies() { return this->replies; }
};

class XMLRPCServiceInterface;

class XMLRPCEvent
{
 public:
 	virtual ~XMLRPCEvent() { }
	virtual bool Run(XMLRPCServiceInterface *iface, HTTPClient *client, XMLRPCRequest &request) = 0;
};

class XMLRPCServiceInterface : public Service
{
 public:
	XMLRPCServiceInterface(Module *creator, const Anope::string &sname) : Service(creator, "XMLRPCServiceInterface", sname) { }

	virtual void Register(XMLRPCEvent *event) = 0;

	virtual void Unregister(XMLRPCEvent *event) = 0;

	virtual Anope::string Sanitize(const Anope::string &string) = 0;

	virtual void Reply(XMLRPCRequest &request) = 0;
};