diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-07-14 22:12:13 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-07-14 22:12:13 +0100 |
commit | 478035981e4cb5d844960e0c1cefd2d5b11fac89 (patch) | |
tree | 7f83a0652ddb7db014ef24e492435cfe39196620 | |
parent | 086283ad1d3474993527d7689ac1fb5423aada9b (diff) | |
parent | c4acb049235afac930d84d1a68325b9d37f64d3c (diff) | |
download | prosody-478035981e4cb5d844960e0c1cefd2d5b11fac89.tar.gz prosody-478035981e4cb5d844960e0c1cefd2d5b11fac89.zip |
Merge with 0.5
-rw-r--r-- | util/xmlrpc.lua | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/util/xmlrpc.lua b/util/xmlrpc.lua index 478c2a1c..4855b323 100644 --- a/util/xmlrpc.lua +++ b/util/xmlrpc.lua @@ -46,17 +46,12 @@ local map = { 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 @@ function create_request(method_name, ...) 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 |