comparison mod_invites_register/mod_invites_register.lua @ 4384:205a027d86f3

mod_invites_register: port to mod_groups_internal
author Jonas Schäfer <jonas@wielicki.name>
date Mon, 25 Jan 2021 18:43:48 +0100
parents 46fb40d7f65a
children 52e1ab99d25e
comparison
equal deleted inserted replaced
4383:1e7406b85add 4384:205a027d86f3
1 local st = require "util.stanza"; 1 local st = require "util.stanza";
2 local jid_split = require "util.jid".split; 2 local jid_split = require "util.jid".split;
3 local jid_bare = require "util.jid".bare; 3 local jid_bare = require "util.jid".bare;
4 local rostermanager = require "core.rostermanager"; 4 local rostermanager = require "core.rostermanager";
5
6 local mod_groups = module:depends("groups_internal");
5 7
6 local require_encryption = module:get_option_boolean("c2s_require_encryption", 8 local require_encryption = module:get_option_boolean("c2s_require_encryption",
7 module:get_option_boolean("require_encryption", false)); 9 module:get_option_boolean("require_encryption", false));
8 local invite_only = module:get_option_boolean("registration_invite_only", true); 10 local invite_only = module:get_option_boolean("registration_invite_only", true);
9 11
146 148
147 local groups = validated_invite.additional_data.groups; 149 local groups = validated_invite.additional_data.groups;
148 if groups then 150 if groups then
149 module:log("Adding to groups..."); 151 module:log("Adding to groups...");
150 for _, group in ipairs(groups) do 152 for _, group in ipairs(groups) do
151 module:open_store("groups", "map"):set(group, contact_username, true); 153 mod_groups.add_member(group, contact_username);
152 end 154 end
153 end 155 end
154 end 156 end
155 end); 157 end);
156 158