# HG changeset patch # User Matthew Wild # Date 1599480171 -3600 # Node ID b68b917e568f0a5e245f73b66f6fd585f35d5ded # Parent 2f0c8670d2fabdfe87b836cd9213b977c2387810 mod_invites: Include invite type and uri in validated invites (from Snikket) diff -r 2f0c8670d2fa -r b68b917e568f mod_invites/mod_invites.lua --- a/mod_invites/mod_invites.lua Mon Sep 07 13:00:43 2020 +0100 +++ b/mod_invites/mod_invites.lua Mon Sep 07 13:02:51 2020 +0100 @@ -101,12 +101,13 @@ local valid_until, inviter; + -- Fetch from host store (account invite) + local token_info = token_storage:get(nil, token); + if username then -- token being used for subscription -- Fetch from user store (subscription invite) valid_until = token_storage:get(username, token); else -- token being used for account creation - -- Fetch from host store (account invite) - local token_info = token_storage:get(nil, token); valid_until = token_info and token_info.expires; if token_info.type == "roster" then username = jid_node(token_info.jid); @@ -126,6 +127,8 @@ token = token; username = username; inviter = inviter; + type = token_info and token_info.type or "roster"; + uri = token_info and token_info.uri or get_uri("roster", username.."@"..module.host, token); additional_data = token_info and token_info.additional_data or nil; }, valid_invite_mt); end