aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_presence.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-12-01 22:13:24 +0000
committerMatthew Wild <mwild1@gmail.com>2018-12-01 22:13:24 +0000
commit38b328ad1be357a028a818eaad7c6c3541ac6759 (patch)
tree46f72ed2c7dd32d234f23a949bcb0197798681ec /plugins/mod_presence.lua
parentc219636c741e61d57ef8315480e6a596e6e4ff7a (diff)
downloadprosody-38b328ad1be357a028a818eaad7c6c3541ac6759.tar.gz
prosody-38b328ad1be357a028a818eaad7c6c3541ac6759.zip
rostermanager, mod_presence: Store stanza for incoming subscription requests (fixes #689) (thanks Zash, Ge0rG)
Diffstat (limited to 'plugins/mod_presence.lua')
-rw-r--r--plugins/mod_presence.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua
index 5056a3a3..51254c63 100644
--- a/plugins/mod_presence.lua
+++ b/plugins/mod_presence.lua
@@ -80,8 +80,10 @@ function handle_normal_presence(origin, stanza)
res.presence.attr.to = nil;
end
end
- for jid in pairs(roster[false].pending) do -- resend incoming subscription requests
- origin.send(st.presence({type="subscribe", from=jid})); -- TODO add to attribute? Use original?
+ for jid, pending_request in pairs(roster[false].pending) do -- resend incoming subscription requests
+ local subscribe = st.clone(st.deserialize(pending_request));
+ subscribe.attr.type, subscribe.attr.from = "subscribe", jid;
+ origin.send(subscribe);
end
local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host});
for jid, item in pairs(roster) do -- resend outgoing subscription requests
@@ -225,7 +227,7 @@ function handle_inbound_presence_subscriptions_and_probes(origin, stanza, from_b
else
core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt
if not rostermanager.is_contact_pending_in(node, host, from_bare) then
- if rostermanager.set_contact_pending_in(node, host, from_bare) then
+ if rostermanager.set_contact_pending_in(node, host, from_bare, stanza) then
sessionmanager.send_to_available_resources(node, host, stanza);
end -- TODO else return error, unable to save
end