Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

mod_limits_exception.lua 1022B

1234567891011121314151617181920212223242526272829303132
  1. -- we use async to detect Prosody 0.10 and earlier
  2. local have_async = pcall(require, 'util.async');
  3. if not have_async then
  4. return;
  5. end
  6. local unlimited_jids = module:get_option_inherited_set("unlimited_jids", {});
  7. -- rises the limit of the stanza size for the unlimited jids, default is 10MB
  8. local unlimited_stanza_size_limit = module:get_option_number("unlimited_size", 10*1024*1024);
  9. if unlimited_jids:empty() then
  10. return;
  11. end
  12. module:hook("authentication-success", function (event)
  13. local session = event.session;
  14. local jid = session.username .. "@" .. session.host;
  15. if unlimited_jids:contains(jid) then
  16. if session.conn and session.conn.setlimit then
  17. session.conn:setlimit(0);
  18. elseif session.throttle then
  19. session.throttle = nil;
  20. end
  21. if unlimited_stanza_size_limit and session.stream.set_stanza_size_limit then
  22. module:log('info', 'Setting stanza size limits for %s to %s', jid, unlimited_stanza_size_limit)
  23. session.stream:set_stanza_size_limit(unlimited_stanza_size_limit);
  24. end
  25. end
  26. end);