Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

mod_jiconop.lua 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. local st = require "util.stanza";
  2. local get_services = module:depends("external_services").get_services;
  3. -- Jitsi Connection Optimization
  4. -- gathers needed information and pushes it with a message to clients
  5. -- this way we skip 4 request responses during every client setup
  6. local shard_name_config = module:get_option_string('shard_name');
  7. if shard_name_config then
  8. module:add_identity("server", "shard", shard_name_config);
  9. end
  10. local region_name_config = module:get_option_string('region_name');
  11. if region_name_config then
  12. module:add_identity("server", "region", region_name_config);
  13. end
  14. -- this is after xmpp-bind, the moment a client has resource and can be contacted
  15. module:hook("resource-bind", function (event)
  16. local session = event.session;
  17. -- disco info data / all identity and features
  18. local query = st.stanza("query", { xmlns = "http://jabber.org/protocol/disco#info" });
  19. local done = {};
  20. for _,identity in ipairs(module:get_host_items("identity")) do
  21. local identity_s = identity.category.."\0"..identity.type;
  22. if not done[identity_s] then
  23. query:tag("identity", identity):up();
  24. done[identity_s] = true;
  25. end
  26. end
  27. -- check whether room has lobby enabled and display name is required for those trying to join
  28. local lobby_muc_component_config = module:get_option_string('lobby_muc');
  29. module:context(lobby_muc_component_config):fire_event('host-disco-info-node',
  30. {origin = session; reply = query; node = 'lobbyrooms';});
  31. local stanza = st.message({
  32. from = module.host;
  33. to = session.full_jid; });
  34. stanza:add_child(query):up();
  35. --- get turnservers and credentials
  36. local services = get_services();
  37. stanza:tag("services");
  38. for _, srv in ipairs(services) do
  39. stanza:tag("service", srv):up();
  40. end
  41. session.send(stanza);
  42. end);