Software / code / prosody
Comparison
plugins/mod_pep_plus.lua @ 8696:164da3186511
mod_pep_plus: Validate items here too (thanks Link Mauve)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sun, 25 Mar 2018 23:30:14 +0200 |
| parent | 8377:58cdbbe3b86a |
| child | 8728:41c959c5c84b |
comparison
equal
deleted
inserted
replaced
| 8695:09e7fd8b16cd | 8696:164da3186511 |
|---|---|
| 30 return { services = services }; | 30 return { services = services }; |
| 31 end | 31 end |
| 32 | 32 |
| 33 function module.restore(data) | 33 function module.restore(data) |
| 34 services = data.services; | 34 services = data.services; |
| 35 end | |
| 36 | |
| 37 function is_item_stanza(item) | |
| 38 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item"; | |
| 35 end | 39 end |
| 36 | 40 |
| 37 local function subscription_presence(username, recipient) | 41 local function subscription_presence(username, recipient) |
| 38 local user_bare = jid_join(username, host); | 42 local user_bare = jid_join(username, host); |
| 39 local recipient_bare = jid_bare(recipient); | 43 local recipient_bare = jid_bare(recipient); |
| 186 autocreate_on_publish = true; | 190 autocreate_on_publish = true; |
| 187 autocreate_on_subscribe = true; | 191 autocreate_on_subscribe = true; |
| 188 | 192 |
| 189 itemstore = simple_itemstore(username); | 193 itemstore = simple_itemstore(username); |
| 190 broadcaster = get_broadcaster(username); | 194 broadcaster = get_broadcaster(username); |
| 195 itemcheck = is_item_stanza; | |
| 191 get_affiliation = function (jid) | 196 get_affiliation = function (jid) |
| 192 if jid_bare(jid) == user_bare then | 197 if jid_bare(jid) == user_bare then |
| 193 return "owner"; | 198 return "owner"; |
| 194 elseif subscription_presence(username, jid) then | 199 elseif subscription_presence(username, jid) then |
| 195 return "subscriber"; | 200 return "subscriber"; |