Mercurial > prosody-modules
view mod_server_contact_info/mod_server_contact_info.lua @ 2491:5fbca7de2088
mod_smacks: Send out more ack requests where needed
Under some circumstances it was possible that more than "max_unacked_stanzas"
where left in the outgoing stanza queue without forcing an ack.
This could happen, when more stanzas entered the queue while the last ack request
was still unanswered.
Now the test "#queue > max_unacked_stanzas" is done upon receiving
an ack as well as when sending out stanzas, which fixes this bug.
author | tmolitor <thilo@eightysoft.de> |
---|---|
date | Sun, 12 Feb 2017 19:27:50 +0100 |
parents | d6a3362ca256 |
children | d18a91c030df |
line wrap: on
line source
-- XEP-0157: Contact Addresses for XMPP Services for Prosody -- -- Copyright (C) 2011-2016 Kim Alvefur -- -- This file is MIT/X11 licensed. -- local t_insert = table.insert; local array = require "util.array"; local df_new = require "util.dataforms".new; -- Source: http://xmpp.org/registrar/formtypes.html#http:--jabber.org-network-serverinfo local valid_types = { abuse = true; admin = true; feedback = true; sales = true; security = true; support = true; } local contact_config = module:get_option("contact_info"); if not contact_config or not next(contact_config) then -- we'll use admins from the config as default local admins = module:get_option_inherited_set("admins", {}); if admins:empty() then module:log("error", "No contact_info or admins set in config"); return -- Nothing to attach, so we'll just skip it. end module:log("debug", "No contact_info in config, using admins as fallback"); contact_config = { admin = array.collect( admins / function(admin) return "xmpp:" .. admin; end); }; end local form_layout = { { value = "http://jabber.org/network/serverinfo"; type = "hidden"; name = "FORM_TYPE"; }; }; local form_values = {}; for t in pairs(valid_types) do local addresses = contact_config[t]; if addresses then t_insert(form_layout, { name = t .. "-addresses", type = "list-multi" }); local values = {}; if type(addresses) ~= "table" then values[1] = { value = addresses }; else for i, address in ipairs(addresses) do values[i] = { value = address }; end end form_values[t .. "-addresses"] = values; end end module:add_extension(df_new(form_layout):form(form_values, "result"));