Changeset

7705:0a29a5e64f1d

mod_muc/muc.lib: Allow passing different <x> elements to be passed to :publicise_occupant_status()
author Kim Alvefur <zash@zash.se>
date Wed, 26 Oct 2016 13:06:08 +0200
parents 7704:5022e6181193
children 7706:d92e186c2a1c
files plugins/muc/muc.lib.lua
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Tue Oct 18 19:07:55 2016 +0200
+++ b/plugins/muc/muc.lib.lua	Wed Oct 26 13:06:08 2016 +0200
@@ -191,7 +191,8 @@
 
 -- Broadcasts an occupant's presence to the whole room
 -- Takes the x element that goes into the stanzas
-function room_mt:publicise_occupant_status(occupant, base_x, nick, actor, reason)
+function room_mt:publicise_occupant_status(occupant, x, nick, actor, reason)
+	local base_x = x.base or x;
 	-- Build real jid and (optionally) occupant jid template presences
 	local base_presence do
 		-- Try to use main jid's presence
@@ -226,7 +227,7 @@
 	local full_p, full_x;
 	local function get_full_p()
 		if full_p == nil then
-			full_x = st.clone(base_x);
+			full_x = st.clone(x.full or base_x);
 			self:build_item_list(occupant, full_x, false, nick, actor_nick, actor, reason);
 			full_p = st.clone(base_presence):add_child(full_x);
 		end
@@ -236,7 +237,7 @@
 	local anon_p, anon_x;
 	local function get_anon_p()
 		if anon_p == nil then
-			anon_x = st.clone(base_x);
+			anon_x = st.clone(x.anon or base_x);
 			self:build_item_list(occupant, anon_x, true, nick, actor_nick, nil, reason);
 			anon_p = st.clone(base_presence):add_child(anon_x);
 		end
@@ -249,7 +250,7 @@
 	else
 		-- Can always see your own full jids
 		-- But not allowed to see actor's
-		self_x = st.clone(base_x);
+		self_x = st.clone(x.self or base_x);
 		self:build_item_list(occupant, self_x, false, nick, actor_nick, nil, reason);
 		self_p = st.clone(base_presence):add_child(self_x);
 	end