Software / code / prosody
Comparison
plugins/mod_pep.lua @ 3795:6bd4305044a8
mod_pep: Remove PEP subscriptions on getting a presence unsubscribe.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 28 Nov 2010 15:02:56 +0500 |
| parent | 3794:56add628d838 |
| child | 3737:659563b1db89 |
comparison
equal
deleted
inserted
replaced
| 3794:56add628d838 | 3795:6bd4305044a8 |
|---|---|
| 143 end | 143 end |
| 144 end | 144 end |
| 145 end | 145 end |
| 146 elseif t == "unavailable" then | 146 elseif t == "unavailable" then |
| 147 if recipients[user] then recipients[user][stanza.attr.from] = nil; end | 147 if recipients[user] then recipients[user][stanza.attr.from] = nil; end |
| 148 elseif not self and t == "unsubscribe" then | |
| 149 local from = jid_bare(stanza.attr.from); | |
| 150 local subscriptions = recipients[user]; | |
| 151 if subscriptions then | |
| 152 for subscriber in pairs(subscriptions) do | |
| 153 if jid_bare(subscriber) == from then | |
| 154 recipients[user][subscriber] = nil; | |
| 155 end | |
| 156 end | |
| 157 end | |
| 148 end | 158 end |
| 149 end, 10); | 159 end, 10); |
| 150 | 160 |
| 151 module:hook("iq/bare/http://jabber.org/protocol/pubsub:pubsub", function(event) | 161 module:hook("iq/bare/http://jabber.org/protocol/pubsub:pubsub", function(event) |
| 152 local session, stanza = event.origin, event.stanza; | 162 local session, stanza = event.origin, event.stanza; |