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() {
|
||||
log_level_printf(4, "PrepareResponse Hook-List Start\n");
|
||||
outType = checkOutput();
|
||||
outType = getOutType();
|
||||
THandleStatus _status = HANDLED_NONE;
|
||||
THookList::iterator i = HookList.begin();
|
||||
for (; i != HookList.end(); ++i) {
|
||||
@@ -392,28 +392,24 @@ void CyhookHandler::printf(const char *fmt, ...) {
|
||||
Write(outbuf);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
TOutType CyhookHandler::checkOutput() {
|
||||
// get outType
|
||||
outType = plain; // plain
|
||||
TOutType CyhookHandler::getOutType() {
|
||||
TOutType _outType = plain;
|
||||
if(!(ParamList.empty())) {
|
||||
if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "json")
|
||||
|| (ParamList.find("json") != ParamList.end() && !(ParamList["json"].empty())) )
|
||||
outType = json;
|
||||
_outType = json;
|
||||
else if ((ParamList.find("format") != ParamList.end() && ParamList["format"] == "xml")
|
||||
|| (ParamList.find("xml") != ParamList.end() && !(ParamList["xml"].empty())) )
|
||||
outType = xml;
|
||||
_outType = xml;
|
||||
}
|
||||
return outType;
|
||||
return _outType;
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
TOutType CyhookHandler::outStart(bool single) {
|
||||
outSingle = single; // for compatibility
|
||||
// for compatibility
|
||||
outSingle = single;
|
||||
// get outType
|
||||
outType = plain; // plain
|
||||
if (ParamList["format"] == "json")
|
||||
outType = json;
|
||||
else if (ParamList["format"] == "xml" || !(ParamList["xml"].empty()) )
|
||||
outType = xml;
|
||||
outType = getOutType();
|
||||
// set response header
|
||||
if (outType == xml)
|
||||
SetHeader(HTTP_OK, "text/xml; charset=UTF-8");
|
||||
|
@@ -202,7 +202,7 @@ public:
|
||||
int _outIndent;
|
||||
TOutType outType; // Outputtpe = plain (default)|xml|json
|
||||
TOutType outStart(bool single = false);
|
||||
TOutType checkOutput();
|
||||
TOutType getOutType();
|
||||
std::string outIndent();
|
||||
std::string outPair(std::string _key, std::string _content, bool _next);
|
||||
std::string outArray(std::string _key, std::string _content);
|
||||
|
Reference in New Issue
Block a user