util.pluginloader: Return full file path from internal file loader on success, not...
[prosody.git] / util / xmlrpc.lua
index 478c2a1cf36a87fc37069416cc4e9d458daf3f4d..29815b0d94fc3a427642475fdc2185b486de0b5c 100644 (file)
@@ -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