diff options
author | Waqas Hussain <waqas20@gmail.com> | 2010-11-28 15:02:56 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2010-11-28 15:02:56 +0500 |
commit | 2fd7797f35de1e31834e53d8a87f907f286b6afb (patch) | |
tree | 5de44ae8549be8d1bbf0af60dd5c500ae36a048e | |
parent | 8a3189b1453c33278de261d61d2251ec4d2207c5 (diff) | |
download | prosody-2fd7797f35de1e31834e53d8a87f907f286b6afb.tar.gz prosody-2fd7797f35de1e31834e53d8a87f907f286b6afb.zip |
mod_pep: Remove PEP subscriptions on getting a presence unsubscribe.
-rw-r--r-- | plugins/mod_pep.lua | 10 |
1 files changed, 10 insertions, 0 deletions
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); |