Changeset

4385:dfb34cc97028

mod_groups_internal: allow specifying a group_id on create It will refuse to create that group if it exists already, as it should.
author Jonas Schäfer <jonas@wielicki.name>
date Mon, 25 Jan 2021 21:32:53 +0100
parents 4384:205a027d86f3
children 4386:6357ac65b4eb
files mod_groups_internal/mod_groups_internal.lua
diffstat 1 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_groups_internal/mod_groups_internal.lua	Mon Jan 25 18:43:48 2021 +0100
+++ b/mod_groups_internal/mod_groups_internal.lua	Mon Jan 25 21:32:53 2021 +0100
@@ -84,11 +84,17 @@
 end
 
 --luacheck: ignore 131
-function create(group_info, create_muc)
+function create(group_info, create_muc, group_id)
 	if not group_info.name then
 		return nil, "group-name-required";
 	end
-	local group_id = id.short();
+	if group_id then
+		if exists(group_id) then
+			return nil, "conflict"
+		end
+	else
+		group_id = id.short();
+	end
 
 	if create_muc then
 		return nil, "not-implemented";