Comparison

plugins/mod_admin_telnet.lua @ 4550:1c41e4a846a2

mod_admin_telnet: Port to portmanager
author Matthew Wild <mwild1@gmail.com>
date Mon, 23 Jan 2012 01:05:32 +0000
parent 4540:ddce5b1bdfca
child 4571:32d532b95dc7
comparison
equal deleted inserted replaced
4549:15fe442e70c5 4550:1c41e4a846a2
10 10
11 local _G = _G; 11 local _G = _G;
12 12
13 local prosody = _G.prosody; 13 local prosody = _G.prosody;
14 local hosts = prosody.hosts; 14 local hosts = prosody.hosts;
15 local connlisteners_register = require "net.connlisteners".register; 15
16 16 local console_listener = { default_port = 5582; default_mode = "*l"; interface = "127.0.0.1" };
17 local console_listener = { default_port = 5582; default_mode = "*l"; default_interface = "127.0.0.1" };
18 17
19 require "util.iterators"; 18 require "util.iterators";
20 local jid_bare = require "util.jid".bare; 19 local jid_bare = require "util.jid".bare;
21 local set, array = require "util.set", require "util.array"; 20 local set, array = require "util.set", require "util.array";
22 local cert_verify_identity = require "util.x509".verify_identity; 21 local cert_verify_identity = require "util.x509".verify_identity;
144 if session then 143 if session then
145 session.disconnect(); 144 session.disconnect();
146 sessions[conn] = nil; 145 sessions[conn] = nil;
147 end 146 end
148 end 147 end
149
150 connlisteners_register('console', console_listener);
151 148
152 -- Console commands -- 149 -- Console commands --
153 -- These are simple commands, not valid standalone in Lua 150 -- These are simple commands, not valid standalone in Lua
154 151
155 function commands.bye(session) 152 function commands.bye(session)
774 pcall(option, session); 771 pcall(option, session);
775 end 772 end
776 end 773 end
777 end 774 end
778 775
779 prosody.net_activate_ports("console", "console", {5582}, "tcp"); 776 require "core.portmanager".register_service("console", {
777 listener = console_listener;
778 default_port = 5582;
779 });