From 61165ba36ee0cbada8a97d075bdaaf13cb5c5a4a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 22 Aug 2015 18:27:31 +0000 Subject: Added some handy functions to inject data back into the telnet buffer. This is great if you want to pre-fill a field, say. --- src/stable/protocoltelnet.cpp | 10 ++++++++++ src/stable/protocoltelnet.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/stable/protocoltelnet.cpp b/src/stable/protocoltelnet.cpp index f6fbd4b..51e33a8 100644 --- a/src/stable/protocoltelnet.cpp +++ b/src/stable/protocoltelnet.cpp @@ -347,6 +347,16 @@ void Bu::ProtocolTelnet::close() pClient->close(); } +void Bu::ProtocolTelnet::setBuffer( const Bu::String &sNewBuffer ) +{ + sDataBuf = sNewBuffer; +} + +void Bu::ProtocolTelnet::appendBuffer( const Bu::String &sNewData ) +{ + sDataBuf += sNewData; +} + void Bu::ProtocolTelnet::onWill( char cCode ) { Bu::MutexLocker l( mWrite ); diff --git a/src/stable/protocoltelnet.h b/src/stable/protocoltelnet.h index efc8889..23a2ee0 100644 --- a/src/stable/protocoltelnet.h +++ b/src/stable/protocoltelnet.h @@ -128,6 +128,8 @@ namespace Bu void close(); const Bu::String &getBuffer() { return sDataBuf; } + void setBuffer( const Bu::String &sNewBuffer ); + void appendBuffer( const Bu::String &sNewData ); public: /** -- cgit v1.2.3