-- 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.
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)
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