Software /
code /
prosody
Comparison
plugins/mod_admin_telnet.lua @ 5278:f79be67e5666
mod_admin_telnet: Stop processing lines when session is closed
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 28 Dec 2012 14:32:22 +0100 |
parent | 5270:20e14961f630 |
child | 5520:75230be5be58 |
comparison
equal
deleted
inserted
replaced
5277:8585f3cc4976 | 5278:f79be67e5666 |
---|---|
147 if partial then | 147 if partial then |
148 data = partial..data; | 148 data = partial..data; |
149 end | 149 end |
150 | 150 |
151 for line in data:gmatch("[^\n]*[\n\004]") do | 151 for line in data:gmatch("[^\n]*[\n\004]") do |
152 if session.closed then return end | |
152 console:process_line(session, line); | 153 console:process_line(session, line); |
153 session.send(string.char(0)); | 154 session.send(string.char(0)); |
154 end | 155 end |
155 session.partial_data = data:match("[^\n]+$"); | 156 session.partial_data = data:match("[^\n]+$"); |
156 end | 157 end |
166 -- Console commands -- | 167 -- Console commands -- |
167 -- These are simple commands, not valid standalone in Lua | 168 -- These are simple commands, not valid standalone in Lua |
168 | 169 |
169 function commands.bye(session) | 170 function commands.bye(session) |
170 session.print("See you! :)"); | 171 session.print("See you! :)"); |
172 session.closed = true; | |
171 session.disconnect(); | 173 session.disconnect(); |
172 end | 174 end |
173 commands.quit, commands.exit = commands.bye, commands.bye; | 175 commands.quit, commands.exit = commands.bye, commands.bye; |
174 | 176 |
175 commands["!"] = function (session, data) | 177 commands["!"] = function (session, data) |