From 1252713d89dcd2f17d68ce27d1bb45daf5f313c8 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 13 Jan 2024 10:58:12 +0100 Subject: mod_invites: Allow specifying invite ttl on command line Was missing a way to pass TTL via command or shell. --- plugins/mod_invites.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_invites.lua b/plugins/mod_invites.lua index 04265070..d49d5d36 100644 --- a/plugins/mod_invites.lua +++ b/plugins/mod_invites.lua @@ -4,6 +4,7 @@ local url = require "socket.url"; 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 @@ function subcommands.generate(arg) 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 @@ function subcommands.generate(arg) 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); -- cgit v1.2.3