aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2014-04-21 17:51:32 -0400
committerdaurnimator <quae@daurnimator.com>2014-04-21 17:51:32 -0400
commit09fa17a7efd4502c7fdf21ec2492946bb59239e3 (patch)
tree495714305bd6bb50ef7e340b6e708f76ec90392c
parent9592b3a68c66c5d2ea10ea04ce3f47041cf2921d (diff)
downloadprosody-09fa17a7efd4502c7fdf21ec2492946bb59239e3.tar.gz
prosody-09fa17a7efd4502c7fdf21ec2492946bb59239e3.zip
plugins/muc/muc.lib: Move sending of occupant list to joining user out of hook, and into main flow: It has to occur before publication of their status
-rw-r--r--plugins/muc/history.lib.lua2
-rw-r--r--plugins/muc/muc.lib.lua17
2 files changed, 9 insertions, 10 deletions
diff --git a/plugins/muc/history.lib.lua b/plugins/muc/history.lib.lua
index 417d62a8..596f92da 100644
--- a/plugins/muc/history.lib.lua
+++ b/plugins/muc/history.lib.lua
@@ -131,7 +131,7 @@ end
-- Send history on join
module:hook("muc-occupant-joined", function(event)
send_history(event.room, event.stanza);
-end, 50); -- Between occupant list (80) and subject(20)
+end, 50); -- Before subject(20)
-- add to history
module:hook("muc-broadcast-message", function(event)
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 2e48ade1..6aca5c62 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -320,15 +320,6 @@ module:hook("muc-occupant-pre-join", function(event)
end
end, -10);
--- Send occupant list to newly joined user
-module:hook("muc-occupant-joined", function(event)
- local real_jid = event.stanza.attr.from;
- event.room:send_occupant_list(real_jid, function(nick, occupant)
- -- Don't include self
- return occupant:get_presence(real_jid) == nil;
- end);
-end, 80);
-
function room_mt:handle_presence_to_occupant(origin, stanza)
local type = stanza.attr.type;
if type == "error" then -- error, kick em out!
@@ -457,6 +448,14 @@ function room_mt:handle_presence_to_occupant(origin, stanza)
dest_x:tag("status", {code = "100"}):up();
end
self:save_occupant(dest_occupant);
+
+ if orig_occupant == nil and is_first_dest_session then
+ -- Send occupant list to newly joined user
+ self:send_occupant_list(real_jid, function(nick, occupant)
+ -- Don't include self
+ return occupant:get_presence(real_jid) == nil;
+ end)
+ end
self:publicise_occupant_status(dest_occupant, dest_x);
if orig_occupant ~= nil and orig_occupant ~= dest_occupant and not is_last_orig_session then -- If user is swapping and wasn't last original session