mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
yhook: rename unused checkOutput() -> getOutType() and use it
Origin commit data
------------------
Commit: 3d78e7d657
Author: vanhofen <vanhofen@gmx.de>
Date: 2016-02-21 (Sun, 21 Feb 2016)
Origin message was:
------------------
- yhook: rename unused checkOutput() -> getOutType() and use it
This commit is contained in:
@@ -73,7 +73,7 @@ THandleStatus CyhookHandler::Hooks_SendResponse() {
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
THandleStatus CyhookHandler::Hooks_PrepareResponse() {
|
THandleStatus CyhookHandler::Hooks_PrepareResponse() {
|
||||||
log_level_printf(4, "PrepareResponse Hook-List Start\n");
|
log_level_printf(4, "PrepareResponse Hook-List Start\n");
|
||||||
outType = checkOutput();
|
outType = getOutType();
|
||||||
THandleStatus _status = HANDLED_NONE;
|
THandleStatus _status = HANDLED_NONE;
|
||||||
THookList::iterator i = HookList.begin();
|
THookList::iterator i = HookList.begin();
|
||||||
for (; i != HookList.end(); ++i) {
|
for (; i != HookList.end(); ++i) {
|
||||||
@@ -392,28 +392,24 @@ void CyhookHandler::printf(const char *fmt, ...) {
|
|||||||
Write(outbuf);
|
Write(outbuf);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
TOutType CyhookHandler::checkOutput() {
|
TOutType CyhookHandler::getOutType() {
|
||||||
// get outType
|
TOutType _outType = plain;
|
||||||
outType = plain; // plain
|
|
||||||
if(!(ParamList.empty())) {
|
if(!(ParamList.empty())) {
|
||||||
if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "json")
|
if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "json")
|
||||||
|| (ParamList.find("json") != ParamList.end() && !(ParamList["json"].empty())) )
|
|| (ParamList.find("json") != ParamList.end() && !(ParamList["json"].empty())) )
|
||||||
outType = json;
|
_outType = json;
|
||||||
else if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "xml")
|
else if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "xml")
|
||||||
|| (ParamList.find("xml") != ParamList.end() && !(ParamList["xml"].empty())) )
|
|| (ParamList.find("xml") != ParamList.end() && !(ParamList["xml"].empty())) )
|
||||||
outType = xml;
|
_outType = xml;
|
||||||
}
|
}
|
||||||
return outType;
|
return _outType;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
TOutType CyhookHandler::outStart(bool single) {
|
TOutType CyhookHandler::outStart(bool single) {
|
||||||
outSingle = single; // for compatibility
|
// for compatibility
|
||||||
|
outSingle = single;
|
||||||
// get outType
|
// get outType
|
||||||
outType = plain; // plain
|
outType = getOutType();
|
||||||
if (ParamList["format"] == "json")
|
|
||||||
outType = json;
|
|
||||||
else if (ParamList["format"] == "xml" || !(ParamList["xml"].empty()) )
|
|
||||||
outType = xml;
|
|
||||||
// set response header
|
// set response header
|
||||||
if (outType == xml)
|
if (outType == xml)
|
||||||
SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
|
SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
|
||||||
|
@@ -202,7 +202,7 @@ public:
|
|||||||
int _outIndent;
|
int _outIndent;
|
||||||
TOutType outType; // Outputtpe = plain (default)|xml|json
|
TOutType outType; // Outputtpe = plain (default)|xml|json
|
||||||
TOutType outStart(bool single = false);
|
TOutType outStart(bool single = false);
|
||||||
TOutType checkOutput();
|
TOutType getOutType();
|
||||||
std::string outIndent();
|
std::string outIndent();
|
||||||
std::string outPair(std::string _key, std::string _content, bool _next);
|
std::string outPair(std::string _key, std::string _content, bool _next);
|
||||||
std::string outArray(std::string _key, std::string _content);
|
std::string outArray(std::string _key, std::string _content);
|
||||||
|
Reference in New Issue
Block a user