From 032f6b43efd27585c30de7dfd48ad15247ed6a03 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sun, 17 Feb 2013 02:46:00 +0000 Subject: Bu::ProtocolTelnet can now disable echoing if echoing is being controlled by the server anyway. It needs a bunch more work to handle things like special characters better, but overall it's really pretty good. --- src/stable/protocoltelnet.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/stable/protocoltelnet.cpp') diff --git a/src/stable/protocoltelnet.cpp b/src/stable/protocoltelnet.cpp index 4259fc7..f8a3906 100644 --- a/src/stable/protocoltelnet.cpp +++ b/src/stable/protocoltelnet.cpp @@ -70,6 +70,7 @@ Bu::ProtocolTelnet::ProtocolTelnet() : oNAWS( *this, OPT_NAWS ), oSuppressGA(*this, OPT_SUPGA ), bCanonical( true ), + bEcho( true ), bSubOpt( false ) { } @@ -230,7 +231,7 @@ void Bu::ProtocolTelnet::onNewData( Bu::Client *pClient ) else { sDataBuf += bc; - if( oEcho.isLocalSet() ) + if( oEcho.isLocalSet() && bEcho ) { pClient->write( &bc, 1 ); #ifdef __TELNET_DEBUG @@ -243,7 +244,7 @@ void Bu::ProtocolTelnet::onNewData( Bu::Client *pClient ) else { sDataBuf += bc; - if( oEcho.isLocalSet() ) + if( oEcho.isLocalSet() && bEcho ) { pClient->write( &bc, 1 ); } @@ -273,6 +274,16 @@ bool Bu::ProtocolTelnet::isCanonical() return bCanonical; } +void Bu::ProtocolTelnet::setEcho( bool bOpt ) +{ + bEcho = bOpt; +} + +bool Bu::ProtocolTelnet::isEchoEnabled() +{ + return bEcho; +} + void Bu::ProtocolTelnet::write( const Bu::String &sData ) { write( sData.getStr(), sData.getSize() ); -- cgit v1.2.3