aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/stable/protocoltelnet.cpp15
-rw-r--r--src/stable/protocoltelnet.h4
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
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() );
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}