Software /
code /
prosody-modules
Comparison
mod_limits_exception/mod_limits_exception.lua @ 4562:28c16c93d79a
mod_limits_exception: New module to except some JIDs from rate limiting
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 24 May 2021 15:46:11 +0100 |
comparison
equal
deleted
inserted
replaced
4561:c6b740ccf6ec | 4562:28c16c93d79a |
---|---|
1 local unlimited_jids = module:get_option_inherited_set("unlimited_jids", {}); | |
2 | |
3 if unlimited_jids:empty() then | |
4 return; | |
5 end | |
6 | |
7 module:hook("authentication-success", function (event) | |
8 local session = event.session; | |
9 local jid = session.username .. "@" .. session.host; | |
10 if unlimited_jids:contains(jid) then | |
11 if session.conn and session.conn.setlimit then | |
12 session.conn:setlimit(0); | |
13 elseif session.throttle then | |
14 session.throttle = nil; | |
15 end | |
16 end | |
17 end); |