From af3c75f9a19e457286a66ad112920f90b7714c5f Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 28 Nov 2010 15:02:56 +0500 Subject: mod_pep: Remove PEP subscriptions on getting a presence unsubscribe. --- plugins/mod_pep.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua index 0d42ac0f..28c31294 100644 --- a/plugins/mod_pep.lua +++ b/plugins/mod_pep.lua @@ -145,6 +145,16 @@ module:hook("presence/bare", function(event) end elseif t == "unavailable" then if recipients[user] then recipients[user][stanza.attr.from] = nil; end + elseif not self and t == "unsubscribe" then + local from = jid_bare(stanza.attr.from); + local subscriptions = recipients[user]; + if subscriptions then + for subscriber in pairs(subscriptions) do + if jid_bare(subscriber) == from then + recipients[user][subscriber] = nil; + end + end + end end end, 10); -- cgit v1.2.3