Comparison

plugins/mod_presence.lua @ 9671:e50559a42dfe

rostermanager, mod_presence: Store stanza for incoming subscription requests (fixes #689) (thanks Zash, Ge0rG)
author Matthew Wild <mwild1@gmail.com>
date Sat, 01 Dec 2018 22:13:24 +0000
parent 8728:41c959c5c84b
child 9676:837ba29aaeff
comparison
equal deleted inserted replaced
9670:73e1bdc001ce 9671:e50559a42dfe
78 res.presence.attr.to = origin.full_jid; 78 res.presence.attr.to = origin.full_jid;
79 core_post_stanza(res, res.presence, true); 79 core_post_stanza(res, res.presence, true);
80 res.presence.attr.to = nil; 80 res.presence.attr.to = nil;
81 end 81 end
82 end 82 end
83 for jid in pairs(roster[false].pending) do -- resend incoming subscription requests 83 for jid, pending_request in pairs(roster[false].pending) do -- resend incoming subscription requests
84 origin.send(st.presence({type="subscribe", from=jid})); -- TODO add to attribute? Use original? 84 local subscribe = st.clone(st.deserialize(pending_request));
85 subscribe.attr.type, subscribe.attr.from = "subscribe", jid;
86 origin.send(subscribe);
85 end 87 end
86 local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host}); 88 local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host});
87 for jid, item in pairs(roster) do -- resend outgoing subscription requests 89 for jid, item in pairs(roster) do -- resend outgoing subscription requests
88 if item.ask then 90 if item.ask then
89 request.attr.to = jid; 91 request.attr.to = jid;
223 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- TODO send last activity 225 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- TODO send last activity
224 end 226 end
225 else 227 else
226 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt 228 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt
227 if not rostermanager.is_contact_pending_in(node, host, from_bare) then 229 if not rostermanager.is_contact_pending_in(node, host, from_bare) then
228 if rostermanager.set_contact_pending_in(node, host, from_bare) then 230 if rostermanager.set_contact_pending_in(node, host, from_bare, stanza) then
229 sessionmanager.send_to_available_resources(node, host, stanza); 231 sessionmanager.send_to_available_resources(node, host, stanza);
230 end -- TODO else return error, unable to save 232 end -- TODO else return error, unable to save
231 end 233 end
232 end 234 end
233 elseif stanza.attr.type == "unsubscribe" then 235 elseif stanza.attr.type == "unsubscribe" then