diff options
author | Oleg Zhurakivskyy <oleg.zhurakivskyy@intel.com> | 2012-02-29 11:37:46 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-03-04 14:45:58 -0600 |
commit | 8b90f28159c5982bb226fcf3f9692c95ab93683a (patch) | |
tree | c203780b7c2ec4ed378f552f7182d7ed52279b7a | |
parent | 6c2f3769e5ff496614c3ffe687ecb3044f0116ee (diff) | |
download | phonesim-8b90f28159c5982bb226fcf3f9692c95ab93683a.tar.gz |
phonesim: Minor reflow in SimChat::command()
Preparation in order to set the variable with the delay,
call setVariable() just from one place.
-rw-r--r-- | src/phonesim.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/phonesim.cpp b/src/phonesim.cpp index 09d6306..6931317 100644 --- a/src/phonesim.cpp +++ b/src/phonesim.cpp @@ -331,22 +331,24 @@ bool SimChat::command( const QString& cmd ) for ( int varNum = 0; varNum < variables.size(); ++varNum ) { QString variable = variables[varNum]; QString value = values[varNum]; - if ( value != "*" ) { + QString val; + + if ( value == "*" ) + val = wild; + else { int index = value.indexOf( "${*}" ); - if ( index == -1 ) { - state()->rules()->setVariable( variable, value ); - } else { + if ( index != -1 ) { if ( wild.length() > 0 && wild[wild.length() - 1] == 0x1A ) { // Strip the terminating ^Z from SMS PDU's. wild = wild.left( wild.length() - 1 ); } - state()->rules()->setVariable - ( variable, value.left( index ) + wild + - value.mid( index + 4 ) ); - } - } else { - state()->rules()->setVariable( variable, wild ); + + val = value.left( index ) + wild + value.mid( index + 4 ); + } else + val = value; } + + state()->rules()->setVariable( variable, val ); } // Switch to the new state. |