Mercurial > prosody-modules
diff mod_http_admin_api/mod_http_admin_api.lua @ 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 | 0d6b69777bc1 |
children | ae1d1e352504 |
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