X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fxmlrpc.lua;h=29815b0d94fc3a427642475fdc2185b486de0b5c;hb=a689938fa45323f67433bcd5554affd3f4b0fc52;hp=478c2a1cf36a87fc37069416cc4e9d458daf3f4d;hpb=ba596f33614438d0f42713ca39423bdc88eb224d;p=prosody.git diff --git a/util/xmlrpc.lua b/util/xmlrpc.lua index 478c2a1c..29815b0d 100644 --- a/util/xmlrpc.lua +++ b/util/xmlrpc.lua @@ -1,6 +1,6 @@ -- Prosody IM --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +-- Copyright (C) 2008-2010 Matthew Wild +-- Copyright (C) 2008-2010 Waqas Hussain -- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. @@ -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