Mercurial > prosody-modules
comparison mod_server_info/mod_server_info.lua @ 5794:174c77da03f5
mod_server_info: New module to add custom service extension forms to disco
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Tue, 12 Dec 2023 19:08:28 +0000 |
| parents | |
| children | ed82916e5796 |
comparison
equal
deleted
inserted
replaced
| 5793:e304e19536f2 | 5794:174c77da03f5 |
|---|---|
| 1 -- XEP-0128: Service Discovery Extensions (manual config) | |
| 2 -- | |
| 3 -- Copyright (C) 2023 Matthew Wild | |
| 4 -- | |
| 5 -- This project is MIT/X11 licensed. Please see the | |
| 6 -- COPYING file in the source package for more information. | |
| 7 -- | |
| 8 | |
| 9 local dataforms = require "util.dataforms"; | |
| 10 | |
| 11 local config = module:get_option("server_info"); | |
| 12 | |
| 13 if not config or next(config) == nil then return; end -- Nothing to do | |
| 14 | |
| 15 for _, form in ipairs(config) do | |
| 16 module:add_extension(dataforms.new(form):form({}, "result")); | |
| 17 end | |
| 18 |
