diff mod_lastlog/mod_lastlog.lua @ 1103:59657e03c25c

mod_lastlog: Make the command show a help message instead of a traceback when no user given
author Kim Alvefur <zash@zash.se>
date Tue, 09 Jul 2013 09:38:10 +0200
parents 59f031d1cd38
children 1e8b793d8ff9
line wrap: on
line diff
--- a/mod_lastlog/mod_lastlog.lua	Mon Jul 08 12:26:19 2013 +0200
+++ b/mod_lastlog/mod_lastlog.lua	Tue Jul 09 09:38:10 2013 +0200
@@ -48,6 +48,10 @@
 end
 
 function module.command(arg)
+	if not arg[1] or arg[1] == "--help" then
+		require"util.prosodyctl".show_usage([[mod_lastlog <user@host>]], [[Show when user last logged in or out]]);
+		return 1;
+	end
 	local user, host = jid.prepped_split(table.remove(arg, 1));
 	require"core.storagemanager".initialize_host(host);
 	local lastlog = assert(datamanager.load(user, host, "lastlog"));