X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fxmlrpc.lua;h=29815b0d94fc3a427642475fdc2185b486de0b5c;hb=a689938fa45323f67433bcd5554affd3f4b0fc52;hp=2c256aa120b07bfaa9e4e87b29330e8ade65217a;hpb=c1f121dad90e17d4f96bd0b303d051437e9a109c;p=prosody.git diff --git a/util/xmlrpc.lua b/util/xmlrpc.lua index 2c256aa1..29815b0d 100644 --- a/util/xmlrpc.lua +++ b/util/xmlrpc.lua @@ -1,6 +1,6 @@ --- Prosody IM v0.4 --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain +-- Prosody IM +-- 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. @@ -14,6 +14,7 @@ local t_concat = table.concat; local t_insert = table.insert; local tostring = tostring; local tonumber = tonumber; +local select = select; local st = require "util.stanza"; module "xmlrpc" @@ -66,11 +67,15 @@ function create_error_response(faultCode, faultString) return stanza; end -function create_request(method_name, object) +function create_request(method_name, ...) local stanza = st.stanza("methodCall") :tag("methodName"):text(method_name):up() - :tag("params"):tag("param"):tag("value"); - _lua_to_xmlrpc(stanza, object); + :tag("params"); + 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