fixed a bug in status notification (first status was sent always)
authorChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 25 Apr 2014 07:42:12 +0000 (09:42 +0200)
committerChristian Herdtweck <christian.herdtweck@intra2net.com>
Fri, 25 Apr 2014 07:42:12 +0000 (09:42 +0200)
src/link/statusnotifiercommand.cpp
src/link/statusnotifiercommand.h

index 84887fd..3b9cb51 100644 (file)
@@ -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 )
     {
index 7fecb8e..2ff6047 100644 (file)
@@ -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;
+
 };
 
 //-----------------------------------------------------------------------------