controlapi: use getOutType() function

Origin commit data
------------------
Branch: ni/coolstream
Commit: 7b1b9afba8
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-02-21 (Sun, 21 Feb 2016)

Origin message was:
------------------
- controlapi: use getOutType() function

------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
vanhofen
2016-02-21 21:41:25 +01:00
parent 2943c2d1dc
commit 744cd7a9a5

View File

@@ -264,7 +264,7 @@ void CControlAPI::Execute(CyhookHandler *hh)
else if(std::string(yCgiCallList[index].mime_type).empty()) // decide in function else if(std::string(yCgiCallList[index].mime_type).empty()) // decide in function
; ;
else if(std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml? else if(std::string(yCgiCallList[index].mime_type) == "+xml") // Parameter xml?
if ((!hh->ParamList["xml"].empty()) ||(hh->ParamList["format"] == "xml")) if (hh->getOutType() == xml)
hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
else else
hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8");
@@ -314,7 +314,7 @@ void CControlAPI::TimerCGI(CyhookHandler *hh)
} }
} }
else { else {
if (hh->ParamList["format"] == "xml") if (hh->getOutType() == xml)
SendTimersXML(hh); SendTimersXML(hh);
else else
SendTimers(hh); SendTimers(hh);
@@ -400,9 +400,9 @@ void CControlAPI::ExecCGI(CyhookHandler *hh)
bool res = false; bool res = false;
std::string script, result; std::string script, result;
// override standard header // override standard header
if (hh->ParamList.size() > 1 && hh->ParamList["xml"].empty()) if (hh->ParamList.size() > 1 && (hh->getOutType() != xml))
hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/html; charset=UTF-8");
else if (hh->ParamList.size() > 1 && !hh->ParamList["xml"].empty()) else if (hh->ParamList.size() > 1 && (hh->getOutType() == xml))
hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
else else
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8");
@@ -1608,7 +1608,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
bool param_empty = hh->ParamList.empty(); bool param_empty = hh->ParamList.empty();
hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); // default hh->SetHeader(HTTP_OK, "text/plain; charset=UTF-8"); // default
// Detailed EPG list in XML or JSON // Detailed EPG list in XML or JSON
if (!hh->ParamList["xml"].empty() || !hh->ParamList["json"].empty() || !hh->ParamList["detaillist"].empty()) { if (hh->getOutType() == xml || hh->getOutType() == json || !hh->ParamList["detaillist"].empty()) {
epgDetailList(hh); epgDetailList(hh);
} }
// Standard list normal or extended // Standard list normal or extended
@@ -1639,7 +1639,7 @@ void CControlAPI::EpgCGI(CyhookHandler *hh) {
} }
else if (!hh->ParamList["search"].empty()) else if (!hh->ParamList["search"].empty())
{ {
SendFoundEvents(hh, (!hh->ParamList["xml"].empty() || hh->ParamList["format"] == "xml")); SendFoundEvents(hh, (hh->getOutType() == xml));
} }
// query details for given eventid // query details for given eventid
else if (!hh->ParamList["eventid"].empty()) { else if (!hh->ParamList["eventid"].empty()) {