Software /
code /
prosody-modules
Changeset
4390:17d44ba8fde2
mod_http_admin_api: support for creating groups with MUCs
author | Jonas Schäfer <jonas@wielicki.name> |
---|---|
date | Tue, 26 Jan 2021 15:37:28 +0100 |
parents | 4389:6cfa313cd524 |
children | 4391:679a0c9d365d |
files | mod_http_admin_api/mod_http_admin_api.lua mod_http_admin_api/openapi.yaml |
diffstat | 2 files changed, 21 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_admin_api/mod_http_admin_api.lua Mon Jan 25 21:51:26 2021 +0100 +++ b/mod_http_admin_api/mod_http_admin_api.lua Tue Jan 26 15:37:28 2021 +0100 @@ -403,6 +403,7 @@ table.insert(group_list, { id = group_id; name = group_info.name; + muc_jid = group_info.muc_jid; members = mod_groups.get_members(group_id); }); end @@ -422,6 +423,7 @@ return json.encode({ id = group_id; name = group.name; + muc_jid = group.muc_jid; members = mod_groups.get_members(group_id); }); end @@ -442,17 +444,25 @@ return 400; end - local group_id = mod_groups.create({ - name = group.name; - }); + local create_muc = group.create_muc and true or false; + + local group_id = mod_groups.create( + { + name = group.name; + }, + create_muc + ); if not group_id then return 500; end event.response.headers["Content-Type"] = json_content_type; + + local info = mod_groups.get_info(group_id); return json.encode({ id = group_id; - name = group.name; + name = info.name; + muc_jid = info.muc_jid or nil; members = {}; }); end
--- a/mod_http_admin_api/openapi.yaml Mon Jan 25 21:51:26 2021 +0100 +++ b/mod_http_admin_api/openapi.yaml Tue Jan 26 15:37:28 2021 +0100 @@ -573,6 +573,9 @@ name: type: string description: "Display name of the group" + create_muc: + type: boolean + description: Create a MUC associated with the group Group: type: object properties: @@ -582,6 +585,10 @@ name: type: string description: Display name of the group + muc_jid: + type: string + nullable: true + description: JID of the associated MUC, if any. GroupList: type: array items: