aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/mod_pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-08-04 03:13:55 +0200
committerKim Alvefur <zash@zash.se>2018-08-04 03:13:55 +0200
commit1ff3dd919ee164f232dcbade13359ba166a975ad (patch)
tree2d44909d29198c2d89a8cae15c50b69ab5a1bd9a /plugins/mod_pubsub/mod_pubsub.lua
parent260f94ba39b492a9660abd59ebdba0ea57685f0a (diff)
downloadprosody-1ff3dd919ee164f232dcbade13359ba166a975ad.tar.gz
prosody-1ff3dd919ee164f232dcbade13359ba166a975ad.zip
mod_pubsub: Add configurable maximum on number of items
Like aefb96a52f5f
Diffstat (limited to 'plugins/mod_pubsub/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 5b01d1d1..18bdf17f 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -70,6 +70,14 @@ function simple_broadcast(kind, node, jids, item, actor, node_obj)
end
end
+local max_max_items = module:get_option_number("pubsub_max_items", 256);
+function check_node_config(node, actor, new_config) -- luacheck: ignore 212/actor 212/node
+ if (new_config["max_items"] or 1) > max_max_items then
+ return false;
+ end
+ return true;
+end
+
function is_item_stanza(item)
return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item";
end
@@ -222,6 +230,7 @@ function module.load()
itemstore = create_simple_itemstore;
broadcaster = simple_broadcast;
itemcheck = is_item_stanza;
+ check_node_config = check_node_config;
get_affiliation = get_affiliation;
normalize_jid = jid_bare;