yhook: add SendResult() function to simplify result output

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

Origin message was:
------------------
- yhook: add SendResult() function to simplify result output

------------------
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 00:16:15 +01:00
parent 312afea2b8
commit 1a6b32e5ec
2 changed files with 17 additions and 0 deletions

View File

@@ -579,3 +579,19 @@ void CyhookHandler::SendError(std::string error) {
}
Write(result);
}
//-----------------------------------------------------------------------------
void CyhookHandler::SendResult(std::string _content) {
std::string result = "";
switch (outType) {
case xml:
result = _content;
break;
case json:
result = json_out_success(_content);
break;
default:
result = _content;
break;
}
WriteLn(result);
}

View File

@@ -194,6 +194,7 @@ public:
void SendHTMLFooter(void);
void SendOk(void);
void SendError(std::string error = "");
void SendResult(std::string _content);
void SendFile(const std::string& url) {NewURL = url; status = HANDLED_SENDFILE;}
void SendRedirect(const std::string& url) {httpStatus=HTTP_MOVED_TEMPORARILY; NewURL = url; status = HANDLED_REDIRECTION;}
void SendRewrite(const std::string& url) {NewURL = url; status = HANDLED_REWRITE;}