aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_limits.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2019-04-02 20:38:51 +0200
committerKim Alvefur <zash@zash.se>2019-04-02 20:38:51 +0200
commit0f802ffe183a94cc9407cdf92bb9eaa9c213e602 (patch)
tree3c1d27e4061e4d1cc4eb11cdfc5786315c3aa56a /plugins/mod_limits.lua
parentad925d5dad90ae6462302e74325b74c88ff1fceb (diff)
downloadprosody-0f802ffe183a94cc9407cdf92bb9eaa9c213e602.tar.gz
prosody-0f802ffe183a94cc9407cdf92bb9eaa9c213e602.zip
mod_limits: Allow configuring a list of unrestricted JIDs (fixes #1323)
Diffstat (limited to 'plugins/mod_limits.lua')
-rw-r--r--plugins/mod_limits.lua17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/mod_limits.lua b/plugins/mod_limits.lua
index 32bc75a9..56e3faaf 100644
--- a/plugins/mod_limits.lua
+++ b/plugins/mod_limits.lua
@@ -96,3 +96,20 @@ end
function module.unload()
filters.remove_filter_hook(filter_hook);
end
+
+function module.add_host(module)
+ local unlimited_jids = module:get_option_inherited_set("unlimited_jids", {});
+
+ if not unlimited_jids:empy() then
+ module:hook("authentication-success", function (event)
+ local session = event.session;
+ local session_type = session.type:match("^[^_]+");
+ local jid = session.username .. "@" .. session.host;
+ if unlimited_jids:contains(jid) then
+ local filter_set = type_filters[session_type];
+ filters.remove_filter(session, "bytes/in", filter_set.bytes_in);
+ session.throttle = nil;
+ end
+ end);
+ end
+end