diff options
author | Mike Buland <eichlan@xagasoft.com> | 2013-02-17 02:46:00 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2013-02-17 02:46:00 +0000 |
commit | 032f6b43efd27585c30de7dfd48ad15247ed6a03 (patch) | |
tree | f5deac52f73fffbdcebaadb24fabbb1c33a6a808 | |
parent | c74da8dee7207a81c7e37339f0d3cdb8b5eb37e4 (diff) | |
download | libbu++-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.
-rw-r--r-- | src/stable/protocoltelnet.cpp | 15 | ||||
-rw-r--r-- | src/stable/protocoltelnet.h | 4 |
2 files changed, 17 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 | ||
277 | void Bu::ProtocolTelnet::setEcho( bool bOpt ) | ||
278 | { | ||
279 | bEcho = bOpt; | ||
280 | } | ||
281 | |||
282 | bool Bu::ProtocolTelnet::isEchoEnabled() | ||
283 | { | ||
284 | return bEcho; | ||
285 | } | ||
286 | |||
276 | void Bu::ProtocolTelnet::write( const Bu::String &sData ) | 287 | void Bu::ProtocolTelnet::write( const Bu::String &sData ) |
277 | { | 288 | { |
278 | write( sData.getStr(), sData.getSize() ); | 289 | write( sData.getStr(), sData.getSize() ); |
diff --git a/src/stable/protocoltelnet.h b/src/stable/protocoltelnet.h index 9686974..a620a02 100644 --- a/src/stable/protocoltelnet.h +++ b/src/stable/protocoltelnet.h | |||
@@ -117,6 +117,9 @@ namespace Bu | |||
117 | void setCanonical( bool bCon=true ); | 117 | void setCanonical( bool bCon=true ); |
118 | bool isCanonical(); | 118 | bool isCanonical(); |
119 | 119 | ||
120 | void setEcho( bool bOpt=true ); | ||
121 | bool isEchoEnabled(); | ||
122 | |||
120 | void write( const Bu::String &sData ); | 123 | void write( const Bu::String &sData ); |
121 | void write( const char *pData, int iSize ); | 124 | void write( const char *pData, int iSize ); |
122 | void write( char cData ); | 125 | void write( char cData ); |
@@ -213,6 +216,7 @@ namespace Bu | |||
213 | char cSubOpt; /**< Which suboption are we processing. */ | 216 | char cSubOpt; /**< Which suboption are we processing. */ |
214 | 217 | ||
215 | bool bCanonical; /**< Are we canonicalizing incoming data? */ | 218 | bool bCanonical; /**< Are we canonicalizing incoming data? */ |
219 | bool bEcho; /**< Should chars be echoed? */ | ||
216 | bool bSubOpt; /**< Are we processing a suboption right now? */ | 220 | bool bSubOpt; /**< Are we processing a suboption right now? */ |
217 | }; | 221 | }; |
218 | } | 222 | } |