summaryrefslogtreecommitdiff
path: root/src/modules/json.h
diff options
context:
space:
mode:
authorpippijn <pippijn@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-17 14:39:18 +0000
committerpippijn <pippijn@e03df62e-2008-0410-955e-edbf42e46eb7>2007-07-17 14:39:18 +0000
commit801fca4042fa3365f647564e6a060436958aed31 (patch)
tree11cc69e000f285ef16ec1dde80c5f59860274cbe /src/modules/json.h
parentc3c50e894376297209d11d7ce490fd782ba206a4 (diff)
Now, json-rpc _ONLY_ supports member function pointers. An example is given in
ModuleRpcJson::ModuleRpcJson. I must admit that it is kind of ugly but it is the only way I can see right now. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7464 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/json.h')
-rw-r--r--src/modules/json.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/modules/json.h b/src/modules/json.h
index 385b7c559..ca9ed8d3f 100644
--- a/src/modules/json.h
+++ b/src/modules/json.h
@@ -532,9 +532,18 @@ namespace json
{
namespace rpc
{
- typedef void (*method) (HTTPRequest *http, Value &request, Value &response);
- void init (void);
- void add_method (char *name, method mth);
+ typedef void (Module::*method) (HTTPRequest *http, Value &request, Value &response);
+
+ struct mfp
+ {
+ Module const *mod;
+ method mth;
+ };
+
+ typedef std::map<std::string, mfp> method_map;
+ extern method_map methods;
+
+ void add_method (char *name, Module const *mod, method mth);
void service (HTTPRequest *http, Value &request, Value &response);
void process (HTTPRequest *http, std::string &response, char const *request);
}