]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/json.h
Make FJOIN send UUID
[user/henk/code/inspircd.git] / src / modules / json.h
index c9fc5c4ff79a6c512a46490847e9180e7b854b74..7643d971364e88df7bf5aff6ae85409806011f9b 100644 (file)
 #define expect_false(expr) maybe_expect ((expr) != 0, 0)
 #define expect_true(expr)  maybe_expect ((expr) != 0, 1)
 
-static void unreachable_internal (char const *file, int line, char const *function);
-static void throw_unless_internal (char const *file, int line, char const *function, char const *condition);
-static void throw_msg_unless_internal (char const *file, int line, char const *function, char const *message);
-
-#define throw_unreachable                       unreachable_internal (__FILE__, __LINE__, __PRETTY_FUNCTION__)
-#define throw_unless(condition)                 if (!expect_false (condition)) throw_unless_internal (__FILE__, __LINE__, __PRETTY_FUNCTION__, #condition)
-#define throw_msg_unless(condition, message)    if (!expect_false (condition)) throw_msg_unless_internal (__FILE__, __LINE__, __PRETTY_FUNCTION__, message)
+#ifdef __GNUC__
+# define CURFUNC       __PRETTY_FUNCTION__
+#elif defined(__BORLANDC__)
+# define CURFUNC       __FUNC__
+#else
+# define CURFUNC       __FUNCTION__
+#endif
 
 namespace json
 {
@@ -524,9 +524,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);
   }