util/xmlrpc.lua

changeset 1497
4c2c403ca04b
parent 894
2c0b9e3c11c3
child 1498
481dfc89047a
equal deleted inserted replaced
1496:4fa337035f46 1497:4c2c403ca04b
64 _lua_to_xmlrpc(stanza, {faultCode=faultCode, faultString=faultString}); 64 _lua_to_xmlrpc(stanza, {faultCode=faultCode, faultString=faultString});
65 stanza:up():up(); 65 stanza:up():up();
66 return stanza; 66 return stanza;
67 end 67 end
68 68
69 function create_request(method_name, object)
70 local stanza = st.stanza("methodCall")
71 :tag("methodName"):text(method_name):up()
72 :tag("params"):tag("param"):tag("value");
73 _lua_to_xmlrpc(stanza, object);
74 stanza:up():up():up();
75 return stanza;
76 end
69 77
70 local _xmlrpc_to_lua; 78 local _xmlrpc_to_lua;
71 local int_parse = function(stanza) 79 local int_parse = function(stanza)
72 if #stanza.tags ~= 0 or #stanza == 0 then error("<"..stanza.name.."> must have a single text child"); end 80 if #stanza.tags ~= 0 or #stanza == 0 then error("<"..stanza.name.."> must have a single text child"); end
73 local n = tonumber(t_concat(stanza)); 81 local n = tonumber(t_concat(stanza));

mercurial