Mercurial > prosody-modules
comparison mod_groups_internal/mod_groups_internal.lua @ 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 | 1e7406b85add |
children | 6357ac65b4eb |
comparison
equal
deleted
inserted
replaced
4384:205a027d86f3 | 4385:dfb34cc97028 |
---|---|
82 end | 82 end |
83 end | 83 end |
84 end | 84 end |
85 | 85 |
86 --luacheck: ignore 131 | 86 --luacheck: ignore 131 |
87 function create(group_info, create_muc) | 87 function create(group_info, create_muc, group_id) |
88 if not group_info.name then | 88 if not group_info.name then |
89 return nil, "group-name-required"; | 89 return nil, "group-name-required"; |
90 end | 90 end |
91 local group_id = id.short(); | 91 if group_id then |
92 if exists(group_id) then | |
93 return nil, "conflict" | |
94 end | |
95 else | |
96 group_id = id.short(); | |
97 end | |
92 | 98 |
93 if create_muc then | 99 if create_muc then |
94 return nil, "not-implemented"; | 100 return nil, "not-implemented"; |
95 end | 101 end |
96 | 102 |