Mercurial > prosody-modules
changeset 4077:f85ea76447dd
mod_invites: Allow inclusion of 'additional data' in invites (from Snikket)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 07 Sep 2020 12:59:00 +0100 |
parents | f1f796e551f1 |
children | 2f0c8670d2fa |
files | mod_invites/mod_invites.lua |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_invites/mod_invites.lua Tue Aug 25 13:13:56 2020 +0100 +++ b/mod_invites/mod_invites.lua Mon Sep 07 12:59:00 2020 +0100 @@ -14,7 +14,7 @@ }); end -local function create_invite(invite_action, invite_jid, allow_registration) +local function create_invite(invite_action, invite_jid, allow_registration, additional_data) local token = id.medium(); local created_at = os.time(); @@ -28,6 +28,7 @@ token = token; allow_registration = allow_registration; + additional_data = additional_data; uri = get_uri(invite_action, invite_jid, token, invite_params); @@ -58,14 +59,14 @@ end -- Create invitation to register an account (optionally restricted to the specified username) -function create_account(account_username) --luacheck: ignore 131/create_account +function create_account(account_username, additional_data) --luacheck: ignore 131/create_account local jid = account_username and (account_username.."@"..module.host) or module.host; - return create_invite("register", jid, true); + return create_invite("register", jid, true, additional_data); end -- Create invitation to become a contact of a local user -function create_contact(username, allow_registration) --luacheck: ignore 131/create_contact - return create_invite("roster", username.."@"..module.host, allow_registration); +function create_contact(username, allow_registration, additional_data) --luacheck: ignore 131/create_contact + return create_invite("roster", username.."@"..module.host, allow_registration, additional_data); end local valid_invite_methods = {}; @@ -120,6 +121,7 @@ token = token; username = username; inviter = inviter; + additional_data = token_info and token_info.additional_data or nil; }, valid_invite_mt); end