From 7c0446bf791919beb3416f235941e2c126d392fb Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 5 Jul 2015 23:16:22 -0600 Subject: [PATCH] * Fixed some logging of client IP addresses/etc. * Some updates to FSE work for position and edit mode display * Use cursor save/restore for some things vs internal tracking --- core/bbs.js | 20 ++++++------------ core/multi_line_edit_text_view.js | 20 +++++++++++++----- core/servers/telnet.js | 9 +++++++- mods/art/demo_fse_netmail_footer_edit.ans | Bin 300 -> 391 bytes mods/fse.js | 24 ++++++++++++++++++++-- 5 files changed, 51 insertions(+), 22 deletions(-) diff --git a/core/bbs.js b/core/bbs.js index a24271ec..d591b72d 100644 --- a/core/bbs.js +++ b/core/bbs.js @@ -159,8 +159,6 @@ function startListening() { addNewClient(client); - //logger.log.info({ clientId : client.runtime.id, from : client.address(), server : module.moduleInfo.name }, 'Client connected'); - client.on('ready', function onClientReady() { // Go to module -- use default error handler prepareClient(client, function onPrepared() { @@ -198,20 +196,14 @@ function addNewClient(client) { // Create a client specific logger client.log = logger.log.child( { clientId : id } ); - // :TODO: if client.log concept is kept, clean this up to use it: + var connInfo = { ip : client.input.remoteAddress }; - var connInfo = { - connectionCount : clientConnections.length, - clientId : client.runtime.id, - }; - - if(logger.log.debug()) { - connInfo.address = client.address(); - } else { - connInfo.ip = client.address().address; + if(client.log.debug()) { + connInfo.port = client.input.localPort; + connInfo.family = client.input.localFamily; } - - logger.log.info(connInfo, 'Client connected'); + + client.log.info(connInfo, 'Client connected'); return id; } diff --git a/core/multi_line_edit_text_view.js b/core/multi_line_edit_text_view.js index 89f05876..c0de5ee0 100644 --- a/core/multi_line_edit_text_view.js +++ b/core/multi_line_edit_text_view.js @@ -780,8 +780,7 @@ function MultiLineEditTextView(options) { }; this.keyPressInsert = function() { - // :TODO: emit event - self.overtypeMode = !self.overtypeMode; + self.toggleTextEditMode(); }; this.keyPressTab = function() { @@ -1006,11 +1005,13 @@ function MultiLineEditTextView(options) { }; this.emitPosition = function() { - self.emit( - 'cursor position', - { row : self.getTextLinesIndex(self.cursorPos.row), col : self.cursorPos.col }); + self.emit('cursor position', self.getEditPosition()); }; + this.toggleTextEditMode = function() { + self.overtypeMode = !self.overtypeMode; + self.emit('text edit mode', self.getTextEditMode()); + }; } require('util').inherits(MultiLineEditTextView, View); @@ -1091,3 +1092,12 @@ MultiLineEditTextView.prototype.onKeyPress = function(ch, key) { MultiLineEditTextView.super_.prototype.onKeyPress.call(this, ch, key); } }; + +MultiLineEditTextView.prototype.getTextEditMode = function() { + return this.overtypeMode ? 'overtype' : 'insert'; +}; + +MultiLineEditTextView.prototype.getEditPosition = function() { + return { row : this.getTextLinesIndex(this.cursorPos.row), col : this.cursorPos.col } +}; + diff --git a/core/servers/telnet.js b/core/servers/telnet.js index cf4cde75..319ff4b7 100644 --- a/core/servers/telnet.js +++ b/core/servers/telnet.js @@ -432,8 +432,15 @@ function TelnetClient(input, output) { var i; while((i = bufs.indexOf(IAC_BUF)) >= 0) { + /* + if(bufs.length < (i + 1)) { + i = MORE_DATA_REQUIRED; + break; + } + */ // :TODO: Android client Irssi ConnectBot asserts here: - assert(bufs.length > (i + 1), 'bufs.length=' + bufs.length + ' i=' + i + ' bufs=' + bufs); + assert(bufs.length > (i + 1), + 'bufs.length=' + bufs.length + ' i=' + i + ' bufs=' + require('../string_util.js').debugEscapedString(bufs.toBuffer())) if(i > 0) { self.emit('data', bufs.splice(0, i).toBuffer()); diff --git a/mods/art/demo_fse_netmail_footer_edit.ans b/mods/art/demo_fse_netmail_footer_edit.ans index 50d90cbdbec32e3f59c1c979dccadc5b153ff15d..f5bad3539c0a7ae96592a23f68c7520bc12b6407 100644 GIT binary patch literal 391 zcmb1+Hn29dHZia^Hptc1r6$nk<*Jd6Hpo?wjyAM5HqDI&GJw{Y=BkGH7(xWWl0cDI z>1d$!3RYG?VIbEv*cqx6rpy+m*Ecn<6sX1=YAR3@5I_|J?J)sr1WE!~mOvKRTA;jd zeo89T2AEo)8;rmTfF{)Na!Ca{hB~_%7=TQp5->6_G&L|cFlA$8U|?hnU|?bZ17S}m NUxhGtM+gs20svY+NS*)y delta 90 zcmZo?Uc)pYc4C~2m9crQf^@W@wXtb#taP+Nu5`4SfiqOVS326*AXmW(sK5ZEKsCh2 lh?h$$*fG@E)xcn~AfpGbf`WpPfuX5^xq<0whRMl{DgYwR70&