aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2018-08-01 19:18:31 +0100
committerMatthew Wild <mwild1@gmail.com>2018-08-01 19:18:31 +0100
commit1f3ce5cb0a7621bb05fd8ff06b85feee13f909d7 (patch)
treee6386c59847c908b3af262b80d2eab32a6b002e9 /plugins
parentd3ebf8d0ea686ffc2bd70f3bc795443e0e75af5d (diff)
downloadprosody-1f3ce5cb0a7621bb05fd8ff06b85feee13f909d7.tar.gz
prosody-1f3ce5cb0a7621bb05fd8ff06b85feee13f909d7.zip
mod_pep: Add 'pep_max_items' option to set an upper limit, defaults to 256 (scientifically chosen)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pep.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index 89c1f820..7c40cc81 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -26,6 +26,8 @@ local host = module.host;
local node_config = module:open_store("pep", "map");
local known_nodes = module:open_store("pep");
+local max_max_items = module:get_option_number("pep_max_items", 256);
+
function module.save()
return { services = services };
end
@@ -38,6 +40,12 @@ function is_item_stanza(item)
return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item";
end
+function check_node_config(node, actor, new_config)
+ if (new_config["max_items"] or 1) > max_max_items then
+ return false;
+ end
+end
+
local function subscription_presence(username, recipient)
local user_bare = jid_join(username, host);
local recipient_bare = jid_bare(recipient);
@@ -236,6 +244,8 @@ function get_pep_service(username)
end;
normalize_jid = jid_bare;
+
+ check_node_config = check_node_config;
});
local nodes, err = known_nodes:get(username);
if nodes then