net.dns: (for some reason this commit didn't pull over from 0.5) Remove hard-coded...
[prosody.git] / plugins / mod_xmlrpc.lua
index 56312fc769b90777721e44e5ca961f26781c4c3b..7165386ae3fec8516ac53fccfe80feb220675d60 100644 (file)
@@ -67,14 +67,14 @@ local function parse_xml(xml)
 end
 
 local function handle_xmlrpc_request(jid, method, args)
-       local is_secure_call = (method:sub(1,7) ~= "secure/");
+       local is_secure_call = (method:sub(1,7) == "secure/");
        if not is_admin(jid) and not is_secure_call then
                return create_error_response(401, "not authorized");
        end
        method = get_method(method);
        if not method then return create_error_response(404, "method not found"); end
        args = args or {};
-       if is_secure_call then t_insert(args, 1, jid); end
+       if is_secure_call then table.insert(args, 1, jid); end
        local success, result = pcall(method, unpack(args));
        if success then
                success, result = pcall(create_response, result or "nil");
@@ -83,7 +83,7 @@ local function handle_xmlrpc_request(jid, method, args)
                end
                return create_error_response(500, "Error in creating response: "..result);
        end
-       return create_error_response(0, result or "nil");
+       return create_error_response(0, tostring(result):gsub("^[^:]+:%d+: ", ""));
 end
 
 local function handle_xmpp_request(origin, stanza)