MT#8851 pushd: use from info when available if origin is null

This fix error if the message is coming from a c2c connection

Change-Id: I337b13da286ecda8a0ab9c48baf6a5137fa510d0
changes/30/230/1
Victor Seva 11 years ago
parent 4201b42698
commit 39e4b7dfb2

@ -76,17 +76,24 @@ local function handle_offline(event)
module:log("debug", "handle_offline");
local origin, stanza = event.origin, event.stanza;
local to = stanza.attr.to;
local from = stanza.attr.from;
local node, host;
local caller = { username = 'unknow', host = 'unknown.local' };
local http_options = {
method = "POST",
body = "",
}
if from then
caller.username, caller.host = jid_split(from);
end
if to then
node, host = jid_split(to);
if push_enable(node, host) then
http_options.body = format(pushd_config.query,
origin.username, origin.host, node, host);
origin.username or caller.username,
origin.host or caller.host, node, host);
module:log("debug", "Sending http pushd request: %s data: %s",
pushd_config.url, http_options.body);
http.request(pushd_config.url, http_options, process_response);

Loading…
Cancel
Save