More ANSI-BBS compliant... still some to go

This commit is contained in:
Bryan Ashby 2020-05-21 19:16:40 -06:00
parent bbae082f7d
commit 1e6c577cd3
No known key found for this signature in database
GPG Key ID: B49EB437951D2542
1 changed files with 10 additions and 9 deletions

View File

@ -42,7 +42,7 @@ class TelnetClient {
this.socket.on('data', this.dataHandler); this.socket.on('data', this.dataHandler);
this.socket.on('error', err => { this.socket.on('error', err => {
this._logDebug( { error : err.message }, 'Socket error'); this._logDebug({ error : err.message }, 'Socket error');
return this.emit('end'); return this.emit('end');
}); });
@ -50,12 +50,17 @@ class TelnetClient {
this.emit('end'); this.emit('end');
}); });
// :TODO: handle 'command error' event this.socket.on('command error', (command, err) => {
this._logDebug({ command, error : err.message }, 'Command error');
});
this.socket.on('DO', command => { this.socket.on('DO', command => {
switch (command.option) { switch (command.option) {
case Options.ECHO : case Options.SGA :
return this.socket.will.echo(); return this.socket.will.sga();
case Options.TRANSMIT_BINARY :
return this.socket.will.transmit_binary();
default : default :
return this.socket.command(Commands.WONT, command.option); return this.socket.command(Commands.WONT, command.option);
@ -68,9 +73,6 @@ class TelnetClient {
this.socket.on('WILL', command => { this.socket.on('WILL', command => {
switch (command.option) { switch (command.option) {
case Options.LINEMODE :
return this.socket.dont.linemode();
case Options.TTYPE : case Options.TTYPE :
return this.socket.sb.send.ttype(); return this.socket.sb.send.ttype();
@ -197,8 +199,7 @@ class TelnetClient {
} }
banner() { banner() {
this.socket.do.echo(); this.socket.will.echo(); // we'll echo back
this.socket.will.echo(); // we'll echo back
this.socket.will.sga(); this.socket.will.sga();
this.socket.do.sga(); this.socket.do.sga();