Changeset

2157:7d1a22ac2a21

mod_track_muc_joins: Only check directed presence when joining (would be gone when leaving)
author Kim Alvefur <zash@zash.se>
date Wed, 13 Apr 2016 11:52:51 +0200
parents 2156:3fcac143fe0b
children 2158:de3fb9d2673c
files mod_track_muc_joins/mod_track_muc_joins.lua
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mod_track_muc_joins/mod_track_muc_joins.lua	Tue Apr 12 16:05:21 2016 +0200
+++ b/mod_track_muc_joins/mod_track_muc_joins.lua	Wed Apr 13 11:52:51 2016 +0200
@@ -7,14 +7,10 @@
 	if not session then return end;
 	local log = session.log or module._log;
 
-	local from_jid = stanza.attr.from;
-	if not session.directed or not session.directed[from_jid] then
-		return; -- Never sent presence there, can't be a MUC join
-	end
-
 	local muc_x = stanza:get_child("x", "http://jabber.org/protocol/muc#user");
 	if not muc_x then return end -- Not MUC related
 
+	local from_jid = stanza.attr.from;
 	local room = jid_bare(from_jid);
 	local joined = stanza.attr.type;
 	if joined == nil then
@@ -26,6 +22,10 @@
 		return;
 	end
 
+	if joined and not session.directed or not session.directed[from_jid] then
+		return; -- Never sent presence there, can't be a MUC join
+	end
+
 	-- Check for status code 100, meaning it's their own reflected presence
 	for status in muc_x:childtags("status") do
 		log("debug", "Status code %d", status.attr.code);