mirror of
https://github.com/Palakis/obs-websocket.git
synced 2024-08-30 18:12:16 +00:00
Revert "Requests: Add Compare"
This reverts commit 3687086ce0
.
I realized that I'm adding too much too fast, and that we should
focus on getting v5 out first.
This commit is contained in:
parent
3687086ce0
commit
1b25e98dc2
@ -12,7 +12,6 @@ const std::map<std::string, RequestMethodHandler> RequestHandler::_handlerMap
|
||||
{"GetStudioModeEnabled", &RequestHandler::GetStudioModeEnabled},
|
||||
{"SetStudioModeEnabled", &RequestHandler::SetStudioModeEnabled},
|
||||
{"Sleep", &RequestHandler::Sleep},
|
||||
{"Compare", &RequestHandler::Compare},
|
||||
|
||||
// Config
|
||||
{"GetPersistentData", &RequestHandler::GetPersistentData},
|
||||
|
@ -33,7 +33,6 @@ class RequestHandler {
|
||||
RequestResult GetStudioModeEnabled(const Request&);
|
||||
RequestResult SetStudioModeEnabled(const Request&);
|
||||
RequestResult Sleep(const Request&);
|
||||
RequestResult Compare(const Request&);
|
||||
|
||||
// Config
|
||||
RequestResult GetPersistentData(const Request&);
|
||||
|
@ -165,32 +165,3 @@ RequestResult RequestHandler::Sleep(const Request& request)
|
||||
return RequestResult::Error(RequestStatus::UnsupportedRequestBatchExecutionType);
|
||||
}
|
||||
}
|
||||
|
||||
RequestResult RequestHandler::Compare(const Request& request)
|
||||
{
|
||||
RequestStatus::RequestStatus statusCode;
|
||||
std::string comment;
|
||||
if (!(request.ValidateBasic("compareValueOne", statusCode, comment) && request.ValidateBasic("compareValueTwo", statusCode, comment) && request.ValidateNumber("newRequestIndex", statusCode, comment, 0)))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
|
||||
if (!(request.RequestBatchExecutionType == OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_REALTIME || request.RequestBatchExecutionType == OBS_WEBSOCKET_REQUEST_BATCH_EXECUTION_TYPE_SERIAL_FRAME))
|
||||
return RequestResult::Error(RequestStatus::UnsupportedRequestBatchExecutionType);
|
||||
|
||||
bool invert = false;
|
||||
if (request.Contains("compareInvert")) {
|
||||
if (!request.ValidateOptionalBoolean("compareInvert", statusCode, comment))
|
||||
return RequestResult::Error(statusCode, comment);
|
||||
invert = request.RequestData["compareInvert"];
|
||||
}
|
||||
|
||||
bool result = (request.RequestData["compareValueOne"] == request.RequestData["compareValueTwo"]);
|
||||
if (invert)
|
||||
result = !result;
|
||||
|
||||
json responseData;
|
||||
responseData["compareResult"] = result;
|
||||
RequestResult ret = RequestResult::Success(responseData);
|
||||
if (result)
|
||||
ret.NewRequestIndex = request.RequestData["newRequestIndex"];
|
||||
return ret;
|
||||
}
|
||||
|
@ -4,8 +4,7 @@ RequestResult::RequestResult(RequestStatus::RequestStatus statusCode, json respo
|
||||
StatusCode(statusCode),
|
||||
ResponseData(responseData),
|
||||
Comment(comment),
|
||||
SleepFrames(0),
|
||||
NewRequestIndex(0)
|
||||
SleepFrames(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,5 +12,4 @@ struct RequestResult
|
||||
json ResponseData;
|
||||
std::string Comment;
|
||||
size_t SleepFrames;
|
||||
size_t NewRequestIndex;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user