# HG changeset patch # User Kim Alvefur # Date 1561059627 -7200 # Node ID 4b2cc8a6044945cbfb83287da87687c546a84f84 # Parent c523642ea2933307ff49719ed1bbec39d8c6a3ee# Parent 0c35f353db68ff771b167eef4b32b1abed936a46 Merge 0.11->trunk diff -r c523642ea293 -r 4b2cc8a60449 plugins/mod_blocklist.lua --- a/plugins/mod_blocklist.lua Wed Jun 19 19:16:09 2019 +0200 +++ b/plugins/mod_blocklist.lua Thu Jun 20 21:40:27 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" }) diff -r c523642ea293 -r 4b2cc8a60449 spec/scansion/blocking.scs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/spec/scansion/blocking.scs Thu Jun 20 21:40:27 2019 +0200 @@ -0,0 +1,168 @@ +# XEP-0191: Blocking Command + +[Client] Romeo + jid: blocker@localhost + password: password + +[Client] Juliet + jid: blockee@localhost + password: password + +----- + +# The parties connect +Romeo connects + +Romeo sends: + + +Romeo receives: + + + + +Juliet connects + +Juliet sends: + + +Juliet receives: + + + + +# They add each other +Romeo sends: + + +Romeo receives: + + +Juliet receives: + + +Juliet sends: + + +Romeo receives: + + + + + +Juliet sends: + + +Juliet receives: + + +Romeo receives: + + +Romeo sends: + + +Juliet receives: + + + + + +Romeo receives: + + + + + +# They can now talk +Juliet sends: + + ohai + + +Romeo receives: + + ohai + + +# And now to the blockining + +Romeo sends: + + + + + + +Romeo receives: + + +Juliet receives: + + +# Can"t talk anymore +Romeo sends: + + hello? + + +Romeo receives: + + + + You have blocked this JID + + + + +Juliet sends: + + +Juliet receives: + + + + + + +Romeo sends: + + + + + + +Juliet receives: + + + + + +Romeo receives: + + +# Can talk again +Romeo sends: + + hello! + + +Juliet receives: + + hello! + + +# Bye +Juliet disconnects + +Juliet sends: + + +Romeo receives: + + +Romeo disconnects + +Romeo sends: + +