aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2015-08-24 13:16:49 +1000
committerdaurnimator <quae@daurnimator.com>2015-08-24 13:16:49 +1000
commit0944fb2e1b3c6b10fef40e93e0ba0ae72795acac (patch)
tree69193a2d369ee457191c7b704afaa6803265d4d1
parente366acf0be642691e5f011d83a4070a00cd19c8d (diff)
downloadprosody-0944fb2e1b3c6b10fef40e93e0ba0ae72795acac.tar.gz
prosody-0944fb2e1b3c6b10fef40e93e0ba0ae72795acac.zip
plugins/muc/muc.lib: Fix issue #505 where unavailable presences were never used
-rw-r--r--plugins/muc/muc.lib.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index deb9ee25..60b12ac8 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -187,15 +187,15 @@ end
-- Takes the x element that goes into the stanzas
function room_mt:publicise_occupant_status(occupant, base_x, nick, actor, reason)
-- Build real jid and (optionally) occupant jid template presences
- local base_presence;
- if occupant.role ~= nil then
+ local base_presence do
-- Try to use main jid's presence
local pr = occupant:get_presence();
- if pr ~= nil then
+ if pr and (pr.attr.type ~= "unavailable" or occupant.role == nil) then
base_presence = st.clone(pr);
+ else -- user is leaving but didn't send a leave presence. make one for them
+ base_presence = st.presence {from = occupant.nick; type = "unavailable";};
end
end
- base_presence = base_presence or st.presence {from = occupant.nick; type = "unavailable";};
-- Fire event (before full_p and anon_p are created)
local event = {