Comparison

plugins/mod_invites.lua @ 12977:74b9e05af71e

plugins: Prefix module imports with prosody namespace
author Kim Alvefur <zash@zash.se>
date Fri, 24 Mar 2023 13:15:28 +0100
parent 12834:dcbff9f038a0
child 13012:c2616274bef7
comparison
equal deleted inserted replaced
12976:a187600ec7d6 12977:74b9e05af71e
1 local id = require "util.id"; 1 local id = require "prosody.util.id";
2 local it = require "util.iterators"; 2 local it = require "prosody.util.iterators";
3 local url = require "socket.url"; 3 local url = require "socket.url";
4 local jid_node = require "util.jid".node; 4 local jid_node = require "prosody.util.jid".node;
5 local jid_split = require "util.jid".split; 5 local jid_split = require "prosody.util.jid".split;
6 6
7 local default_ttl = module:get_option_number("invite_expiry", 86400 * 7); 7 local default_ttl = module:get_option_number("invite_expiry", 86400 * 7);
8 8
9 local token_storage; 9 local token_storage;
10 if prosody.process_type == "prosody" or prosody.shutdown then 10 if prosody.process_type == "prosody" or prosody.shutdown then
203 --- shell command 203 --- shell command
204 do 204 do
205 -- Since the console is global this overwrites the command for 205 -- Since the console is global this overwrites the command for
206 -- each host it's loaded on, but this should be fine. 206 -- each host it's loaded on, but this should be fine.
207 207
208 local get_module = require "core.modulemanager".get_module; 208 local get_module = require "prosody.core.modulemanager".get_module;
209 209
210 local console_env = module:shared("/*/admin_shell/env"); 210 local console_env = module:shared("/*/admin_shell/env");
211 211
212 -- luacheck: ignore 212/self 212 -- luacheck: ignore 212/self
213 console_env.invite = {}; 213 console_env.invite = {};
236 print("usage: prosodyctl mod_"..module.name.." generate example.com"); 236 print("usage: prosodyctl mod_"..module.name.." generate example.com");
237 return 2; 237 return 2;
238 end 238 end
239 table.remove(arg, 1); -- pop command 239 table.remove(arg, 1); -- pop command
240 240
241 local sm = require "core.storagemanager"; 241 local sm = require "prosody.core.storagemanager";
242 local mm = require "core.modulemanager"; 242 local mm = require "prosody.core.modulemanager";
243 243
244 local host = arg[1]; 244 local host = arg[1];
245 assert(prosody.hosts[host], "Host "..tostring(host).." does not exist"); 245 assert(prosody.hosts[host], "Host "..tostring(host).." does not exist");
246 sm.initialize_host(host); 246 sm.initialize_host(host);
247 table.remove(arg, 1); -- pop host 247 table.remove(arg, 1); -- pop host
286 print("--group can be specified multiple times; the user will be added to all groups.") 286 print("--group can be specified multiple times; the user will be added to all groups.")
287 print() 287 print()
288 print("--reset and the other options cannot be mixed.") 288 print("--reset and the other options cannot be mixed.")
289 return 2 289 return 2
290 elseif value == "--reset" then 290 elseif value == "--reset" then
291 local nodeprep = require "util.encodings".stringprep.nodeprep; 291 local nodeprep = require "prosody.util.encodings".stringprep.nodeprep;
292 local username = nodeprep(arg[1]) 292 local username = nodeprep(arg[1])
293 table.remove(arg, 1); 293 table.remove(arg, 1);
294 if not username then 294 if not username then
295 print("Please supply a valid username to generate a reset link for"); 295 print("Please supply a valid username to generate a reset link for");
296 return 2; 296 return 2;