Mercurial > prosody-hg
comparison plugins/mod_limits.lua @ 9942:b0d5f4ae92b7
mod_limits: Allow configuring a list of unrestricted JIDs (fixes #1323)
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 02 Apr 2019 20:38:51 +0200 |
| parents | a2f8d54dd445 |
| children | 46773fe2be45 |
comparison
equal
deleted
inserted
replaced
| 9941:a2f8d54dd445 | 9942:b0d5f4ae92b7 |
|---|---|
| 94 end | 94 end |
| 95 | 95 |
| 96 function module.unload() | 96 function module.unload() |
| 97 filters.remove_filter_hook(filter_hook); | 97 filters.remove_filter_hook(filter_hook); |
| 98 end | 98 end |
| 99 | |
| 100 function module.add_host(module) | |
| 101 local unlimited_jids = module:get_option_inherited_set("unlimited_jids", {}); | |
| 102 | |
| 103 if not unlimited_jids:empy() then | |
| 104 module:hook("authentication-success", function (event) | |
| 105 local session = event.session; | |
| 106 local session_type = session.type:match("^[^_]+"); | |
| 107 local jid = session.username .. "@" .. session.host; | |
| 108 if unlimited_jids:contains(jid) then | |
| 109 local filter_set = type_filters[session_type]; | |
| 110 filters.remove_filter(session, "bytes/in", filter_set.bytes_in); | |
| 111 session.throttle = nil; | |
| 112 end | |
| 113 end); | |
| 114 end | |
| 115 end |
