Diff

plugins/mod_console.lua @ 440:dee02bf4656a

Some mod_console updates
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Nov 2008 17:09:21 +0000
parent 411:64982773cc15
child 444:77485b9b840c
line wrap: on
line diff
--- a/plugins/mod_console.lua	Thu Nov 27 16:52:30 2008 +0000
+++ b/plugins/mod_console.lua	Thu Nov 27 17:09:21 2008 +0000
@@ -37,7 +37,7 @@
 		-- Handle new connection
 		session = console:new_session(conn);
 		sessions[conn] = session;
-		session.print("Welcome to the lxmppd admin console!");
+		printbanner(session);
 	end
 	if data then
 		-- Handle data
@@ -129,9 +129,9 @@
 end
 
 def_env.module = {};
-function def_env.module:load(name)
+function def_env.module:load(name, host)
 	local mm = require "modulemanager";
-	local ok, err = mm.load(name);
+	local ok, err = mm.load(host or self.env.host, name);
 	if not ok then
 		return false, err or "Unknown error loading module";
 	end
@@ -163,3 +163,20 @@
 
 function def_env.hosts:add(name)
 end
+
+-------------
+
+function printbanner(session)
+session.print [[
+                   ____                \   /     _       
+                    |  _ \ _ __ ___  ___  _-_   __| |_   _ 
+                    | |_) | '__/ _ \/ __|/ _ \ / _` | | | |
+                    |  __/| | | (_) \__ \ |_| | (_| | |_| |
+                    |_|   |_|  \___/|___/\___/ \__,_|\__, |
+                    A study in simplicity            |___/ 
+
+]]
+session.print("Welcome to the Prosody administration console. For a list of commands, type: help");
+session.print("You may find more help on using this console in our online documentation at ");
+session.print("http://prosody.im/doc/console\n");
+end