diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-10-21 19:01:02 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-10-21 19:01:02 +0500 |
commit | 9f001523b27f094d292cf33fb14be6b1df5feba9 (patch) | |
tree | 9286d8ef2c1a74f0b3cdfbd8f52deecd9b51803b /plugins | |
parent | 0664ac358ab979b91c8ab7a5973b89fd7b16b129 (diff) | |
download | prosody-9f001523b27f094d292cf33fb14be6b1df5feba9.tar.gz prosody-9f001523b27f094d292cf33fb14be6b1df5feba9.zip |
mod_presence: Send unavailable presence when sending unsubscribed presence stanzas (some legacy clients continue to display unsubscribed contacts as available).
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_presence.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/plugins/mod_presence.lua b/plugins/mod_presence.lua index d696612d..f83e017b 100644 --- a/plugins/mod_presence.lua +++ b/plugins/mod_presence.lua @@ -142,7 +142,7 @@ function handle_normal_presence(origin, stanza, core_route_stanza) stanza.attr.to = nil; -- reset it end -function send_presence_of_available_resources(user, host, jid, recipient_session, core_route_stanza) +function send_presence_of_available_resources(user, host, jid, recipient_session, core_route_stanza, stanza) local h = hosts[host]; local count = 0; if h and h.type == "local" then @@ -151,6 +151,7 @@ function send_presence_of_available_resources(user, host, jid, recipient_session for k, session in pairs(u.sessions) do local pres = session.presence; if pres then + if stanza then pres = stanza; pres.attr.from = session.full_jid; end pres.attr.to = jid; core_route_stanza(session, pres); pres.attr.to = nil; @@ -199,6 +200,9 @@ function handle_outbound_presence_subscriptions_and_probes(origin, stanza, from_ rostermanager.roster_push(node, host, to_bare); end core_route_stanza(origin, stanza); + -- COMPAT: Some legacy clients keep displaying unsubscribed contacts as online unless an unavailable presence is sent: + send_presence_of_available_resources(node, host, to_bare, origin, core_route_stanza, + st.presence({ type="unavailable", from=from_bare, to=to_bare, id=stanza.attr.id })); end stanza.attr.from, stanza.attr.to = st_from, st_to; end |