mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 16:01:20 +02:00
- yhook: add SendResult() function to simplify result output
This commit is contained in:
@@ -579,3 +579,19 @@ void CyhookHandler::SendError(std::string error) {
|
|||||||
}
|
}
|
||||||
Write(result);
|
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);
|
||||||
|
}
|
||||||
|
@@ -194,6 +194,7 @@ public:
|
|||||||
void SendHTMLFooter(void);
|
void SendHTMLFooter(void);
|
||||||
void SendOk(void);
|
void SendOk(void);
|
||||||
void SendError(std::string error = "");
|
void SendError(std::string error = "");
|
||||||
|
void SendResult(std::string _content);
|
||||||
void SendFile(const std::string& url) {NewURL = url; status = HANDLED_SENDFILE;}
|
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 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;}
|
void SendRewrite(const std::string& url) {NewURL = url; status = HANDLED_REWRITE;}
|
||||||
|
Reference in New Issue
Block a user