moves version functionality into its own function
This commit is contained in:
parent
30afe3e279
commit
b89763652f
1 changed files with 9 additions and 5 deletions
|
@ -189,6 +189,14 @@ local function deletefile(origin, orig_from, stanza, request)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function version(origin, stanza)
|
||||||
|
local reply = st.reply(stanza);
|
||||||
|
reply:tag("version", { xmlns = xmlns_http_upload });
|
||||||
|
reply:tag("xmpp-fileservice-module", { spec = spec_version, implementation = impl_version }):up();
|
||||||
|
origin.send(reply);
|
||||||
|
return true;
|
||||||
|
end
|
||||||
|
|
||||||
local function create_upload_slot(origin, orig_from, stanza, request)
|
local function create_upload_slot(origin, orig_from, stanza, request)
|
||||||
-- validate
|
-- validate
|
||||||
local filename = request:get_child_text("filename");
|
local filename = request:get_child_text("filename");
|
||||||
|
@ -328,11 +336,7 @@ module:hook("iq/host/"..xmlns_http_upload..":request", function (event)
|
||||||
elseif slot_type == "list" then
|
elseif slot_type == "list" then
|
||||||
return listfiles(origin, orig_from, stanza, request);
|
return listfiles(origin, orig_from, stanza, request);
|
||||||
elseif slot_type == "version" then
|
elseif slot_type == "version" then
|
||||||
local reply = st.reply(stanza);
|
return version(origin, stanza);
|
||||||
reply:tag("version", { xmlns = xmlns_http_upload });
|
|
||||||
reply:tag("xmpp-fileservice-module", { spec = spec_version, implementation = impl_version }):up();
|
|
||||||
origin.send(reply);
|
|
||||||
return true;
|
|
||||||
else
|
else
|
||||||
origin.send(st.error_reply(stanza, "cancel", "undefined-condition", "status code: " .. statuscode .. " response: " ..respbody));
|
origin.send(st.error_reply(stanza, "cancel", "undefined-condition", "status code: " .. statuscode .. " response: " ..respbody));
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue