Hi all - included is a patched for
https://issues.prosody.im/1739
When a user joins a MUC, and a pre-join hook changes their nickname -
it may have been changed into an existing occupant. When this occurs,
the room creates a new occupant, and an existing occupant winds up
being disassociated from the room.
This patch makes the room re-run the existing occupant check when a
nick change has occurred.
Apologies for the git formatting, I don't know mercurial very well - I
just downloaded the latest source, made a git repo, did my changes in
there, and exported as a patch. Hopefully it's easy to apply.
---
plugins/muc/muc.lib.lua | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 01427db..4902283 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -684,6 +684,17 @@ function room_mt:handle_normal_presence(origin, stanza)
if module:fire_event(event_name, event) then return true; end
local nick_changed = dest_occupant and orig_nick ~= dest_occupant.nick;
+ if nick_changed then
+ -- nick may have changed into an existing occupant
+ local orig_dest_occupant = dest_occupant
+ dest_occupant = self:get_occupant_by_nick(dest_occupant.nick)
+ if dest_occupant then
+ is_first_dest_session = false;
+ else
+ dest_occupant = orig_dest_occupant
+ end
+ end
+