Software /
code /
prosody
Comparison
plugins/mod_pubsub/mod_pubsub.lua @ 8695:09e7fd8b16cd
mod_pubsub: Reject publishing of non-items
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 21 Mar 2018 23:41:03 +0100 |
parent | 8505:c9bdb4dfed96 |
child | 8808:40a7135eb6ac |
comparison
equal
deleted
inserted
replaced
8694:059183e5571e | 8695:09e7fd8b16cd |
---|---|
55 for jid in pairs(jids) do | 55 for jid in pairs(jids) do |
56 module:log("debug", "Sending notification to %s", jid); | 56 module:log("debug", "Sending notification to %s", jid); |
57 message.attr.to = jid; | 57 message.attr.to = jid; |
58 module:send(message); | 58 module:send(message); |
59 end | 59 end |
60 end | |
61 | |
62 function is_item_stanza(item) | |
63 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item"; | |
60 end | 64 end |
61 | 65 |
62 module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq); | 66 module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq); |
63 module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq); | 67 module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq); |
64 | 68 |
205 autocreate_on_subscribe = autocreate_on_subscribe; | 209 autocreate_on_subscribe = autocreate_on_subscribe; |
206 | 210 |
207 nodestore = node_store; | 211 nodestore = node_store; |
208 itemstore = create_simple_itemstore; | 212 itemstore = create_simple_itemstore; |
209 broadcaster = simple_broadcast; | 213 broadcaster = simple_broadcast; |
214 itemcheck = is_item_stanza; | |
210 get_affiliation = get_affiliation; | 215 get_affiliation = get_affiliation; |
211 | 216 |
212 normalize_jid = jid_bare; | 217 normalize_jid = jid_bare; |
213 })); | 218 })); |
214 end | 219 end |