aboutsummaryrefslogtreecommitdiff
path: root/src/stable/protocoltelnet.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2013-02-17 02:46:00 +0000
committerMike Buland <eichlan@xagasoft.com>2013-02-17 02:46:00 +0000
commit032f6b43efd27585c30de7dfd48ad15247ed6a03 (patch)
treef5deac52f73fffbdcebaadb24fabbb1c33a6a808 /src/stable/protocoltelnet.cpp
parentc74da8dee7207a81c7e37339f0d3cdb8b5eb37e4 (diff)
downloadlibbu++-032f6b43efd27585c30de7dfd48ad15247ed6a03.tar.gz
libbu++-032f6b43efd27585c30de7dfd48ad15247ed6a03.tar.bz2
libbu++-032f6b43efd27585c30de7dfd48ad15247ed6a03.tar.xz
libbu++-032f6b43efd27585c30de7dfd48ad15247ed6a03.zip
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.
Diffstat (limited to 'src/stable/protocoltelnet.cpp')
-rw-r--r--src/stable/protocoltelnet.cpp15
1 files changed, 13 insertions, 2 deletions
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() :
70 oNAWS( *this, OPT_NAWS ), 70 oNAWS( *this, OPT_NAWS ),
71 oSuppressGA(*this, OPT_SUPGA ), 71 oSuppressGA(*this, OPT_SUPGA ),
72 bCanonical( true ), 72 bCanonical( true ),
73 bEcho( true ),
73 bSubOpt( false ) 74 bSubOpt( false )
74{ 75{
75} 76}
@@ -230,7 +231,7 @@ void Bu::ProtocolTelnet::onNewData( Bu::Client *pClient )
230 else 231 else
231 { 232 {
232 sDataBuf += bc; 233 sDataBuf += bc;
233 if( oEcho.isLocalSet() ) 234 if( oEcho.isLocalSet() && bEcho )
234 { 235 {
235 pClient->write( &bc, 1 ); 236 pClient->write( &bc, 1 );
236#ifdef __TELNET_DEBUG 237#ifdef __TELNET_DEBUG
@@ -243,7 +244,7 @@ void Bu::ProtocolTelnet::onNewData( Bu::Client *pClient )
243 else 244 else
244 { 245 {
245 sDataBuf += bc; 246 sDataBuf += bc;
246 if( oEcho.isLocalSet() ) 247 if( oEcho.isLocalSet() && bEcho )
247 { 248 {
248 pClient->write( &bc, 1 ); 249 pClient->write( &bc, 1 );
249 } 250 }
@@ -273,6 +274,16 @@ bool Bu::ProtocolTelnet::isCanonical()
273 return bCanonical; 274 return bCanonical;
274} 275}
275 276
277void Bu::ProtocolTelnet::setEcho( bool bOpt )
278{
279 bEcho = bOpt;
280}
281
282bool Bu::ProtocolTelnet::isEchoEnabled()
283{
284 return bEcho;
285}
286
276void Bu::ProtocolTelnet::write( const Bu::String &sData ) 287void Bu::ProtocolTelnet::write( const Bu::String &sData )
277{ 288{
278 write( sData.getStr(), sData.getSize() ); 289 write( sData.getStr(), sData.getSize() );