aboutsummaryrefslogtreecommitdiffstats
path: root/prosody-module/mod_http_upload_external
diff options
context:
space:
mode:
authorsteckbrief <steckbrief@chefmail.de>2018-10-06 10:52:25 +0200
committersteckbrief <steckbrief@chefmail.de>2018-10-06 10:52:25 +0200
commitb89763652f77f822a67bf5fecc4879b01abc4f5e (patch)
tree387c82a235d405e5129617fd129b917d1651475f /prosody-module/mod_http_upload_external
parent30afe3e279c02bebe6d76bd012c5f00ab0274463 (diff)
moves version functionality into its own function
Diffstat (limited to 'prosody-module/mod_http_upload_external')
-rw-r--r--prosody-module/mod_http_upload_external/mod_http_upload_external.lua14
1 files changed, 9 insertions, 5 deletions
diff --git a/prosody-module/mod_http_upload_external/mod_http_upload_external.lua b/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
index 4f4e83b..ad36cb8 100644
--- a/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
+++ b/prosody-module/mod_http_upload_external/mod_http_upload_external.lua
@@ -189,6 +189,14 @@ local function deletefile(origin, orig_from, stanza, request)
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)
-- validate
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
return listfiles(origin, orig_from, stanza, request);
elseif slot_type == "version" then
- 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;
+ return version(origin, stanza);
else
origin.send(st.error_reply(stanza, "cancel", "undefined-condition", "status code: " .. statuscode .. " response: " ..respbody));
return true;