From 5045ec9e3ef9236916a08b07e69a156b1e5b4717 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 25 Apr 2014 09:42:12 +0200 Subject: [PATCH] fixed a bug in status notification (first status was sent always) --- src/link/statusnotifiercommand.cpp | 6 +++++- src/link/statusnotifiercommand.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/src/link/statusnotifiercommand.cpp b/src/link/statusnotifiercommand.cpp index 84887fd..3b9cb51 100644 --- a/src/link/statusnotifiercommand.cpp +++ b/src/link/statusnotifiercommand.cpp @@ -42,7 +42,8 @@ const string StatusNotifierCommand::StatusToken = "${status}"; StatusNotifierCommand::StatusNotifierCommand( const string &status_notifier_cmd ) : - CommandStr( status_notifier_cmd ) + CommandStr( status_notifier_cmd ), + CommandStrOriginal( status_notifier_cmd ) { } @@ -67,6 +68,9 @@ bool StatusNotifierCommand::set_token_value( BOOST_ASSERT( !token.empty() ); BOOST_ASSERT( !value.empty() ); + // use a fresh copy of the original string where token is not replaced yet + CommandStr = CommandStrOriginal; + const size_t token_begin_pos = CommandStr.find( token ); if ( token_begin_pos == string::npos ) { diff --git a/src/link/statusnotifiercommand.h b/src/link/statusnotifiercommand.h index 7fecb8e..2ff6047 100644 --- a/src/link/statusnotifiercommand.h +++ b/src/link/statusnotifiercommand.h @@ -56,6 +56,9 @@ private: /// The command string used to notify the status std::string CommandStr; + /// The original command before token replacement + std::string CommandStrOriginal; + }; //----------------------------------------------------------------------------- -- 1.7.1