#1615 MUC sends unnecessary presences on role change
Reporter
MattJ
Owner
MattJ
Created
Updated
Stars
★ (1)
Tags
Milestone-0.11
Status-Fixed
Type-Defect
Priority-Medium
MattJ
on
What steps will reproduce the problem?
1. Set to the muc:
muc_room_locking = false
muc_room_default_public_jids = true
2. Using a hook to make all participants owner, like:
https://github.com/jitsi/jitsi-meet/blob/master/resources/prosody-plugins/mod_muc_allowners.lua#L46
What is the expected output?
No duplicate presences
What do you see instead?
After receiving self-presence on join, we receive duplicate equivalent presences for the rest of the participants in the meeting.
What version of the product are you using? On what operating system?
prosody-0.11_1nightly112
Please provide any additional information below.
I submitted another issue, an hour ago, can you reject or ignore it, thanks.
This fixes the issue, tested it.
It is wrong priorities while checking boolean statements:
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 93334b88..ecea9d95 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -1326,8 +1326,8 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason, data)
if occupant.role == nil then
module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;});
elseif is_semi_anonymous and
- (old_role == "moderator" and occupant.role ~= "moderator") or
- (old_role ~= "moderator" and occupant.role == "moderator") then -- Has gained or lost moderator status
+ ((old_role == "moderator" and occupant.role ~= "moderator") or
+ (old_role ~= "moderator" and occupant.role == "moderator")) then -- Has gained or lost moderator status
-- Send everyone else's presences (as jid visibility has changed)
What steps will reproduce the problem? 1. Set to the muc: muc_room_locking = false muc_room_default_public_jids = true 2. Using a hook to make all participants owner, like: https://github.com/jitsi/jitsi-meet/blob/master/resources/prosody-plugins/mod_muc_allowners.lua#L46 What is the expected output? No duplicate presences What do you see instead? After receiving self-presence on join, we receive duplicate equivalent presences for the rest of the participants in the meeting. What version of the product are you using? On what operating system? prosody-0.11_1nightly112 Please provide any additional information below. I submitted another issue, an hour ago, can you reject or ignore it, thanks. This fixes the issue, tested it. It is wrong priorities while checking boolean statements: diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 93334b88..ecea9d95 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -1326,8 +1326,8 @@ function room_mt:set_affiliation(actor, jid, affiliation, reason, data) if occupant.role == nil then module:fire_event("muc-occupant-left", {room = self; nick = occupant.nick; occupant = occupant;}); elseif is_semi_anonymous and - (old_role == "moderator" and occupant.role ~= "moderator") or - (old_role ~= "moderator" and occupant.role == "moderator") then -- Has gained or lost moderator status + ((old_role == "moderator" and occupant.role ~= "moderator") or + (old_role ~= "moderator" and occupant.role == "moderator")) then -- Has gained or lost moderator status -- Send everyone else's presences (as jid visibility has changed)
Patch committed as https://hg.prosody.im/trunk/rev/1dba335eacea Thanks!
ChangesFix was released in 0.11.8
Changes