# HG changeset patch # User Kim Alvefur # Date 1705139892 -3600 # Node ID 7efdd143fdfc9b72f75bd7453bbf85cdf06be114 # Parent 95d8875c90dc9ac9d8f0e7a90ac8c7ba222bf89a mod_invites: Allow specifying invite ttl on command line Was missing a way to pass TTL via command or shell. diff -r 95d8875c90dc -r 7efdd143fdfc plugins/mod_invites.lua --- a/plugins/mod_invites.lua Sun Dec 17 19:02:56 2023 +0100 +++ b/plugins/mod_invites.lua Sat Jan 13 10:58:12 2024 +0100 @@ -4,6 +4,7 @@ local jid_node = require "prosody.util.jid".node; local jid_split = require "prosody.util.jid".split; local argparse = require "prosody.util.argparse"; +local human_io = require "prosody.util.human.io"; local default_ttl = module:get_option_period("invite_expiry", "1 week"); @@ -283,6 +284,7 @@ print(" --role ROLE Grant the given ROLE to the new user") print(" --group GROUPID Add the user to the group with the given ID") print(" Can be specified multiple times") + print(" --expires-after T Time until the invite expires (e.g. '1 week')") print() print("--group can be specified multiple times; the user will be added to all groups.") print() @@ -332,7 +334,7 @@ invite = assert(invites.create_account(nil, { roles = roles, groups = groups - })); + }, opts.expires_after and human_io.parse_duration(opts.expires_after))); end print(invite.landing_page or invite.uri);