diff options
Diffstat (limited to 'Swiften/AdHoc/OutgoingAdHocCommandSession.cpp')
| -rw-r--r-- | Swiften/AdHoc/OutgoingAdHocCommandSession.cpp | 25 | 
1 files changed, 24 insertions, 1 deletions
diff --git a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp index 40b17e7..edacf94 100644 --- a/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp +++ b/Swiften/AdHoc/OutgoingAdHocCommandSession.cpp @@ -19,8 +19,27 @@ void OutgoingAdHocCommandSession::handleResponse(boost::shared_ptr<Command> payl  	if (error) {  		onError(error);  	} else { -		sessionID_ = payload->getSessionID();  		const std::vector<Command::Action> actions = payload->getAvailableActions(); +		actionStates_.clear(); +		actionStates_[Command::Cancel] = EnabledAndPresent; +		actionStates_[Command::Complete] = Present; +		if (std::find(actions.begin(), actions.end(), Command::Complete) != actions.end()) { +			actionStates_[Command::Complete] = EnabledAndPresent; +		} + +		if (getIsMultiStage()) { +			actionStates_[Command::Next] = Present; +			actionStates_[Command::Prev] = Present; +		} + +		if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()) { +			actionStates_[Command::Next] = EnabledAndPresent; +		} +		if (std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) { +			actionStates_[Command::Prev] = EnabledAndPresent; +		} + +		sessionID_ = payload->getSessionID();  		if (std::find(actions.begin(), actions.end(), Command::Next) != actions.end()  				|| std::find(actions.begin(), actions.end(), Command::Prev) != actions.end()) {  			isMultiStage_ = true; @@ -74,4 +93,8 @@ void OutgoingAdHocCommandSession::goNext(Form::ref form) {  	commandRequest->send();  } +OutgoingAdHocCommandSession::ActionState OutgoingAdHocCommandSession::getActionState(Command::Action action) { +	return actionStates_[action]; +} +  }  | 
 Swift