From b2b9301c9ecdf9903c85a3e686ca186ecd73113c Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 8 Mar 2009 01:06:37 +0500 Subject: util/xmlrpc: Added extension to RPC functions (allowing nil parameters and return values) --- util/xmlrpc.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/util/xmlrpc.lua b/util/xmlrpc.lua index 5a391754..8b1d56cf 100644 --- a/util/xmlrpc.lua +++ b/util/xmlrpc.lua @@ -41,6 +41,9 @@ local map = { number=function(stanza, object) stanza:tag("int"):text(tostring(object)):up(); end; + ["nil"]=function(stanza, object) -- nil extension + stanza:tag("nil"):up(); + end; }; _lua_to_xmlrpc = function(stanza, object) local h = map[type(object)]; @@ -146,6 +149,9 @@ local rmap = { if tostring(tonumber(n)) == n then n = tonumber(n); end return n; end; + ["nil"]=function(stanza) -- nil extension + return nil; + end; } _xmlrpc_to_lua = function(stanza) local h = rmap[stanza.name]; -- cgit v1.2.3