aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-05-05 15:33:29 +0100
committerMatthew Wild <mwild1@gmail.com>2010-05-05 15:33:29 +0100
commitec60bf9e1b50e97162097027e852ce5d0db4bdf8 (patch)
tree202337a4771185f05d2cec4ca647782100e363dd /plugins
parent5492f0aebdf5cb5657d380d60207a5d2bcae506d (diff)
downloadprosody-ec60bf9e1b50e97162097027e852ce5d0db4bdf8.tar.gz
prosody-ec60bf9e1b50e97162097027e852ce5d0db4bdf8.zip
mod_proxy65: Send error reply to activation stanza if one or both parties were not connected to the proxy
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_proxy65.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_proxy65.lua b/plugins/mod_proxy65.lua
index 3a543d8f..190d30be 100644
--- a/plugins/mod_proxy65.lua
+++ b/plugins/mod_proxy65.lua
@@ -241,6 +241,7 @@ function handle_to_domain(origin, stanza)
return true;
end
elseif stanza.name == "iq" and type == "set" then
+ module:log("debug", "Received activation request from %s", stanza.attr.from);
local reply, from, to, sid = set_activation(stanza);
if reply ~= nil and from ~= nil and to ~= nil and sid ~= nil then
local sha = sha1(sid .. from .. to, true);
@@ -251,6 +252,15 @@ function handle_to_domain(origin, stanza)
transfers[sha].activated = true;
transfers[sha].target:lock_read(false);
transfers[sha].initiator:lock_read(false);
+ else
+ module:log("debug", "Both parties were not yet connected");
+ local message = "Neither party is connected to the proxy";
+ if transfers[sha].initiator then
+ message = "The recipient is not connected to the proxy";
+ elseif transfers[sha].target then
+ message = "The sender (you) is not connected to the proxy";
+ end
+ origin.send(st.error_reply(stanza, "cancel", "not-allowed", message));
end
else
module:log("error", "activation failed: sid: %s, initiator: %s, target: %s", tostring(sid), tostring(from), tostring(to));