# HG changeset patch # User Matthew Wild # Date 1273070009 -3600 # Node ID a3580f556c27b1e0bb0d240acfce9407e7cfbe6e # Parent c49be80767ee3f51ac9a8eb2895fea57c151ea0d mod_proxy65: Send error reply to activation stanza if one or both parties were not connected to the proxy diff -r c49be80767ee -r a3580f556c27 plugins/mod_proxy65.lua --- a/plugins/mod_proxy65.lua Wed May 05 15:32:16 2010 +0100 +++ b/plugins/mod_proxy65.lua Wed May 05 15:33:29 2010 +0100 @@ -241,6 +241,7 @@ 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 @@ 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));