Software /
code /
prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
439:6608ad3a72f3 | 440:dee02bf4656a |
---|---|
35 | 35 |
36 if not session then | 36 if not session then |
37 -- Handle new connection | 37 -- Handle new connection |
38 session = console:new_session(conn); | 38 session = console:new_session(conn); |
39 sessions[conn] = session; | 39 sessions[conn] = session; |
40 session.print("Welcome to the lxmppd admin console!"); | 40 printbanner(session); |
41 end | 41 end |
42 if data then | 42 if data then |
43 -- Handle data | 43 -- Handle data |
44 | 44 |
45 if data:match("[!.]$") then | 45 if data:match("[!.]$") then |
127 dofile "main.lua" | 127 dofile "main.lua" |
128 return true, "Server reloaded"; | 128 return true, "Server reloaded"; |
129 end | 129 end |
130 | 130 |
131 def_env.module = {}; | 131 def_env.module = {}; |
132 function def_env.module:load(name) | 132 function def_env.module:load(name, host) |
133 local mm = require "modulemanager"; | 133 local mm = require "modulemanager"; |
134 local ok, err = mm.load(name); | 134 local ok, err = mm.load(host or self.env.host, name); |
135 if not ok then | 135 if not ok then |
136 return false, err or "Unknown error loading module"; | 136 return false, err or "Unknown error loading module"; |
137 end | 137 end |
138 return true, "Module loaded"; | 138 return true, "Module loaded"; |
139 end | 139 end |
161 return true, "Done"; | 161 return true, "Done"; |
162 end | 162 end |
163 | 163 |
164 function def_env.hosts:add(name) | 164 function def_env.hosts:add(name) |
165 end | 165 end |
166 | |
167 ------------- | |
168 | |
169 function printbanner(session) | |
170 session.print [[ | |
171 ____ \ / _ | |
172 | _ \ _ __ ___ ___ _-_ __| |_ _ | |
173 | |_) | '__/ _ \/ __|/ _ \ / _` | | | | | |
174 | __/| | | (_) \__ \ |_| | (_| | |_| | | |
175 |_| |_| \___/|___/\___/ \__,_|\__, | | |
176 A study in simplicity |___/ | |
177 | |
178 ]] | |
179 session.print("Welcome to the Prosody administration console. For a list of commands, type: help"); | |
180 session.print("You may find more help on using this console in our online documentation at "); | |
181 session.print("http://prosody.im/doc/console\n"); | |
182 end |