Mercurial > prosody-hg
comparison plugins/mod_presence.lua @ 10411:db2a06b9ff98
Merge 0.11->trunk
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 16 Nov 2019 16:52:31 +0100 |
| parents | 4a419089ad00 |
| children | f0e9e5bda415 |
comparison
equal
deleted
inserted
replaced
| 10410:659b577f280c | 10411:db2a06b9ff98 |
|---|---|
| 79 res.presence.attr.to = origin.full_jid; | 79 res.presence.attr.to = origin.full_jid; |
| 80 core_post_stanza(res, res.presence, true); | 80 core_post_stanza(res, res.presence, true); |
| 81 res.presence.attr.to = nil; | 81 res.presence.attr.to = nil; |
| 82 end | 82 end |
| 83 end | 83 end |
| 84 for jid in pairs(roster[false].pending) do -- resend incoming subscription requests | 84 for jid, pending_request in pairs(roster[false].pending) do -- resend incoming subscription requests |
| 85 origin.send(st.presence({type="subscribe", from=jid})); -- TODO add to attribute? Use original? | 85 if type(pending_request) == "table" then |
| 86 local subscribe = st.deserialize(pending_request); | |
| 87 subscribe.attr.type, subscribe.attr.from = "subscribe", jid; | |
| 88 origin.send(subscribe); | |
| 89 else | |
| 90 origin.send(st.presence({type="subscribe", from=jid})); | |
| 91 end | |
| 86 end | 92 end |
| 87 local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host}); | 93 local request = st.presence({type="subscribe", from=origin.username.."@"..origin.host}); |
| 88 for jid, item in pairs(roster) do -- resend outgoing subscription requests | 94 for jid, item in pairs(roster) do -- resend outgoing subscription requests |
| 89 if item.ask then | 95 if item.ask then |
| 90 request.attr.to = jid; | 96 request.attr.to = jid; |
| 224 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- TODO send last activity | 230 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- TODO send last activity |
| 225 end | 231 end |
| 226 else | 232 else |
| 227 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt | 233 core_post_stanza(hosts[host], st.presence({from=to_bare, to=from_bare, type="unavailable"}), true); -- acknowledging receipt |
| 228 if not rostermanager.is_contact_pending_in(node, host, from_bare) then | 234 if not rostermanager.is_contact_pending_in(node, host, from_bare) then |
| 229 if rostermanager.set_contact_pending_in(node, host, from_bare) then | 235 if rostermanager.set_contact_pending_in(node, host, from_bare, stanza) then |
| 230 sessionmanager.send_to_available_resources(node, host, stanza); | 236 sessionmanager.send_to_available_resources(node, host, stanza); |
| 231 end -- TODO else return error, unable to save | 237 end -- TODO else return error, unable to save |
| 232 end | 238 end |
| 233 end | 239 end |
| 234 elseif stanza.attr.type == "unsubscribe" then | 240 elseif stanza.attr.type == "unsubscribe" then |
