Changeset

10052:0c35f353db68 0.11

mod_blocklist: Trigger resend of presence when unblocking a contact (fixes #1380)
author Kim Alvefur <zash@zash.se>
date Thu, 20 Jun 2019 21:20:00 +0200
parents 10051:7d312e77c857
children 10053:4b2cc8a60449 10055:d67e8ef63235
files plugins/mod_blocklist.lua
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_blocklist.lua	Thu Jun 20 21:18:46 2019 +0200
+++ b/plugins/mod_blocklist.lua	Thu Jun 20 21:20:00 2019 +0200
@@ -128,6 +128,7 @@
 	-- > only if the contact is allowed to receive presence notifications [...]
 	-- So contacts we need to do that for are added to the set below.
 	local send_unavailable = is_blocking and {};
+	local send_available = not is_blocking and {};
 
 	-- Because blocking someone currently also blocks the ability to reject
 	-- subscription requests, we'll preemptively reject such
@@ -147,6 +148,8 @@
 			elseif is_contact_pending_in(username, module.host, jid) then
 				remove_pending[jid] = true;
 			end
+		elseif is_contact_subscribed(username, module.host, jid) then
+			send_available[jid] = true;
 		end
 	end
 
@@ -203,6 +206,11 @@
 			save_roster(username, module.host, roster);
 			-- Not much we can do about save failing here
 		end
+	else
+		local user_bare = username .. "@" .. module.host;
+		for jid in pairs(send_available) do
+			module:send(st.presence({ type = "probe", to = user_bare, from = jid }));
+		end
 	end
 
 	local blocklist_push = st.iq({ type = "set", id = "blocklist-push" })