# HG changeset patch # User Kim Alvefur # Date 1521672063 -3600 # Node ID 09e7fd8b16cd1726ef8c47adc7e1038f3e00b4ec # Parent 059183e5571ef1e484eb5739801fd49aee67b6d5 mod_pubsub: Reject publishing of non-items diff -r 059183e5571e -r 09e7fd8b16cd plugins/mod_pubsub/mod_pubsub.lua --- a/plugins/mod_pubsub/mod_pubsub.lua Wed Mar 21 23:40:45 2018 +0100 +++ b/plugins/mod_pubsub/mod_pubsub.lua Wed Mar 21 23:41:03 2018 +0100 @@ -59,6 +59,10 @@ end end +function is_item_stanza(item) + return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item"; +end + module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq); module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq); @@ -207,6 +211,7 @@ nodestore = node_store; itemstore = create_simple_itemstore; broadcaster = simple_broadcast; + itemcheck = is_item_stanza; get_affiliation = get_affiliation; normalize_jid = jid_bare;