Changeset

6495:44df423f8290

mod_blocklist: Don't send unavailable presence from unavailable sessions when blocking a contact
author Kim Alvefur <zash@zash.se>
date Sun, 26 Oct 2014 16:29:50 +0100
parents 6494:5979eaed12c0
children 6501:71b6e8b48a12
files plugins/mod_blocklist.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_blocklist.lua	Sat Oct 25 14:45:11 2014 +0200
+++ b/plugins/mod_blocklist.lua	Sun Oct 26 16:29:50 2014 +0100
@@ -149,7 +149,9 @@
 		for jid, in_roster in pairs(new) do
 			if not blocklist[jid] and in_roster and sessions[username] then
 				for _, session in pairs(sessions[username].sessions) do
-					module:send(st.presence({ type = "unavailable", to = jid, from = session.full_jid }));
+					if session.presence then
+						module:send(st.presence({ type = "unavailable", to = jid, from = session.full_jid }));
+					end
 				end
 			end
 		end