Software /
code /
prosody
Diff
util/xmlrpc.lua @ 1554:06030af44fad 0.5.0
util.xmlrpc: Fixed table serialization (regression introduced in previous change)
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 15 Jul 2009 01:40:11 +0500 |
parent | 1523:841d61be198f |
child | 2923:b7049746bd29 |
line wrap: on
line diff
--- a/util/xmlrpc.lua Tue Jul 14 21:04:22 2009 +0100 +++ b/util/xmlrpc.lua Wed Jul 15 01:40:11 2009 +0500 @@ -46,17 +46,12 @@ stanza:tag("nil"):up(); end; }; -_lua_to_xmlrpc = function(stanza, ...) - for i=1,select('#', ...) do - stanza:tag("param"):tag("value"); - local object = select(i, ...); - local h = map[type(object)]; - if h then - h(stanza, object); - else - error("Type not supported by XML-RPC: " .. type(object)); - end - stanza:up():up(); +_lua_to_xmlrpc = function(stanza, object) + local h = map[type(object)]; + if h then + h(stanza, object); + else + error("Type not supported by XML-RPC: " .. type(object)); end end function create_response(object) @@ -76,7 +71,11 @@ local stanza = st.stanza("methodCall") :tag("methodName"):text(method_name):up() :tag("params"); - _lua_to_xmlrpc(stanza, ...); + for i=1,select('#', ...) do + stanza:tag("param"):tag("value"); + _lua_to_xmlrpc(stanza, select(i, ...)); + stanza:up():up(); + end stanza:up():up():up(); return stanza; end