diff options
-rw-r--r-- | src/protocoltelnet.cpp | 35 | ||||
-rw-r--r-- | src/protocoltelnet.h | 2 |
2 files changed, 31 insertions, 6 deletions
diff --git a/src/protocoltelnet.cpp b/src/protocoltelnet.cpp index e4fc926..5361a61 100644 --- a/src/protocoltelnet.cpp +++ b/src/protocoltelnet.cpp | |||
@@ -268,17 +268,42 @@ bool Bu::ProtocolTelnet::isCanonical() | |||
268 | 268 | ||
269 | void Bu::ProtocolTelnet::write( const Bu::FString &sData ) | 269 | void Bu::ProtocolTelnet::write( const Bu::FString &sData ) |
270 | { | 270 | { |
271 | pClient->write( sData ); | 271 | write( sData.getStr(), sData.getSize() ); |
272 | } | 272 | } |
273 | 273 | #include "bu/logger.h" | |
274 | void Bu::ProtocolTelnet::write( char *pData, int iSize ) | 274 | void Bu::ProtocolTelnet::write( const char *pData, int iSize ) |
275 | { | 275 | { |
276 | pClient->write( pData, iSize ); | 276 | int iLast = 0, j; |
277 | for( j = iLast; j < iSize; j++ ) | ||
278 | { | ||
279 | if( pData[j] == '\n' ) | ||
280 | { | ||
281 | if( j+1 >= iSize || | ||
282 | (pData[j+1] != '\r' && pData[j+1] != '\0') ) | ||
283 | { | ||
284 | logHexDump( 1, pData+iLast, j-iLast, "bo" ); | ||
285 | pClient->write( pData+iLast, j-iLast ); | ||
286 | logHexDump( 1, "\n\r", 2, "ba" ); | ||
287 | pClient->write( "\n\r", 2 ); | ||
288 | iLast = j+1; | ||
289 | } | ||
290 | else | ||
291 | { | ||
292 | j++; | ||
293 | } | ||
294 | } | ||
295 | } | ||
296 | if( j > iLast ) | ||
297 | { | ||
298 | logHexDump( 1, pData+iLast, iSize-iLast, "bl" ); | ||
299 | pClient->write( pData+iLast, iSize-iLast ); | ||
300 | } | ||
301 | //pClient->write( pData, iSize ); | ||
277 | } | 302 | } |
278 | 303 | ||
279 | void Bu::ProtocolTelnet::write( char cData ) | 304 | void Bu::ProtocolTelnet::write( char cData ) |
280 | { | 305 | { |
281 | pClient->write( &cData, 1 ); | 306 | write( &cData, 1 ); |
282 | } | 307 | } |
283 | 308 | ||
284 | void Bu::ProtocolTelnet::onWill( char cCode ) | 309 | void Bu::ProtocolTelnet::onWill( char cCode ) |
diff --git a/src/protocoltelnet.h b/src/protocoltelnet.h index f773f1e..82d6398 100644 --- a/src/protocoltelnet.h +++ b/src/protocoltelnet.h | |||
@@ -110,7 +110,7 @@ namespace Bu | |||
110 | bool isCanonical(); | 110 | bool isCanonical(); |
111 | 111 | ||
112 | void write( const Bu::FString &sData ); | 112 | void write( const Bu::FString &sData ); |
113 | void write( char *pData, int iSize ); | 113 | void write( const char *pData, int iSize ); |
114 | void write( char cData ); | 114 | void write( char cData ); |
115 | 115 | ||
116 | public: | 116 | public: |