Comparison

prosodyctl @ 6326:a3b9496673ee

Merge 0.9->0.10
author Matthew Wild <mwild1@gmail.com>
date Thu, 31 Jul 2014 07:11:54 +0100
parent 6162:fbc3b195dab8
parent 6325:13a43fe90d9f
child 6367:769a3577dd85
comparison
equal deleted inserted replaced
6320:17344d25a0f6 6326:a3b9496673ee
266 local getchar, getpass = prosodyctl.getchar, prosodyctl.getpass; 266 local getchar, getpass = prosodyctl.getchar, prosodyctl.getpass;
267 local show_yesno = prosodyctl.show_yesno; 267 local show_yesno = prosodyctl.show_yesno;
268 local show_prompt = prosodyctl.show_prompt; 268 local show_prompt = prosodyctl.show_prompt;
269 local read_password = prosodyctl.read_password; 269 local read_password = prosodyctl.read_password;
270 270
271 local jid_split = require "util.jid".prepped_split;
272
271 local prosodyctl_timeout = (config.get("*", "prosodyctl_timeout") or 5) * 2; 273 local prosodyctl_timeout = (config.get("*", "prosodyctl_timeout") or 5) * 2;
272 ----------------------- 274 -----------------------
273 local commands = {}; 275 local commands = {};
274 local command = arg[1]; 276 local command = arg[1];
275 277
276 function commands.adduser(arg) 278 function commands.adduser(arg)
277 local jid_split = require "util.jid".split;
278 if not arg[1] or arg[1] == "--help" then 279 if not arg[1] or arg[1] == "--help" then
279 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]); 280 show_usage([[adduser JID]], [[Create the specified user account in Prosody]]);
280 return 1; 281 return 1;
281 end 282 end
282 local user, host = jid_split(arg[1]); 283 local user, host = jid_split(arg[1]);
312 show_message(msg) 313 show_message(msg)
313 return 1; 314 return 1;
314 end 315 end
315 316
316 function commands.passwd(arg) 317 function commands.passwd(arg)
317 local jid_split = require "util.jid".split;
318 if not arg[1] or arg[1] == "--help" then 318 if not arg[1] or arg[1] == "--help" then
319 show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]); 319 show_usage([[passwd JID]], [[Set the password for the specified user account in Prosody]]);
320 return 1; 320 return 1;
321 end 321 end
322 local user, host = jid_split(arg[1]); 322 local user, host = jid_split(arg[1]);
352 show_message(error_messages[msg]) 352 show_message(error_messages[msg])
353 return 1; 353 return 1;
354 end 354 end
355 355
356 function commands.deluser(arg) 356 function commands.deluser(arg)
357 local jid_split = require "util.jid".split;
358 if not arg[1] or arg[1] == "--help" then 357 if not arg[1] or arg[1] == "--help" then
359 show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]); 358 show_usage([[deluser JID]], [[Permanently remove the specified user account from Prosody]]);
360 return 1; 359 return 1;
361 end 360 end
362 local user, host = jid_split(arg[1]); 361 local user, host = jid_split(arg[1]);
371 return 1; 370 return 1;
372 end 371 end
373 372
374 if not hosts[host] then 373 if not hosts[host] then
375 show_warning("The host '%s' is not listed in the configuration file (or is not enabled).", host) 374 show_warning("The host '%s' is not listed in the configuration file (or is not enabled).", host)
376 show_warning("The user will not be able to log in until this is changed.");
377 hosts[host] = make_host(host); 375 hosts[host] = make_host(host);
378 end 376 end
379 377
380 if not prosodyctl.user_exists { user = user, host = host } then 378 if not prosodyctl.user_exists { user = user, host = host } then
381 show_message [[That user does not exist on this server]] 379 show_message [[That user does not exist on this server]]