mod_muc_webchat_url: Fix default url
[prosody-modules.git] / mod_c2s_limit_sessions / mod_c2s_limit_sessions.lua
blobca6e9aa6b82fd2ad264b7d6a0c263abeb16e21e4
1 -- mod_c2s_limit_sessions
3 local next, count = next, require "util.iterators".count;
5 local max_resources = module:get_option_number("max_resources", 10);
7 local sessions = hosts[module.host].sessions;
8 module:hook("resource-bind", function(event)
9 local session = event.session;
10 if count(next, sessions[session.username].sessions) > max_resources then
11 session:close{ condition = "policy-violation", text = "Too many resources" };
12 return false
13 end
14 end, -1);