mirror of
https://github.com/KingDuckZ/kamokan.git
synced 2024-11-27 00:43:47 +00:00
Rename submit form to submit paste.
This commit is contained in:
parent
dbd1a3a90a
commit
33c52b88d5
4 changed files with 9 additions and 9 deletions
|
@ -10,7 +10,7 @@ add_executable(${PROJECT_NAME}
|
|||
main.cpp
|
||||
split_get_vars.cpp
|
||||
response.cpp
|
||||
submit_form_response.cpp
|
||||
submit_paste_response.cpp
|
||||
get_env.cpp
|
||||
envy.cpp
|
||||
cgi_env.cpp
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include "incredis/incredis.hpp"
|
||||
#include "submit_form_response.hpp"
|
||||
#include "submit_paste_response.hpp"
|
||||
#include "index_response.hpp"
|
||||
#include "cgi_env.hpp"
|
||||
#include <iostream>
|
||||
|
@ -22,7 +22,7 @@ int main() {
|
|||
resp.send();
|
||||
}
|
||||
else if (cgi_env.path_info() == "/paste.cgi") {
|
||||
tawashi::SubmitFormResponse resp(incredis);
|
||||
tawashi::SubmitPasteResponse resp(incredis);
|
||||
resp.send();
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include "submit_form_response.hpp"
|
||||
#include "submit_paste_response.hpp"
|
||||
#include "incredis/incredis.hpp"
|
||||
#include "cgi_post.hpp"
|
||||
#include "num_to_token.hpp"
|
||||
|
@ -9,13 +9,13 @@ namespace tawashi {
|
|||
const char g_post_key[] = "pastie";
|
||||
} //unnamed namespace
|
||||
|
||||
SubmitFormResponse::SubmitFormResponse (redis::IncRedis& parRedis) :
|
||||
SubmitPasteResponse::SubmitPasteResponse (redis::IncRedis& parRedis) :
|
||||
Response("text/plain"),
|
||||
m_redis(parRedis)
|
||||
{
|
||||
}
|
||||
|
||||
void SubmitFormResponse::on_send (std::ostream& parStream) {
|
||||
void SubmitPasteResponse::on_send (std::ostream& parStream) {
|
||||
auto post = cgi::read_post(cgi_env());
|
||||
auto post_data_it = post.find(g_post_key);
|
||||
if (post.end() == post_data_it) {
|
||||
|
@ -29,7 +29,7 @@ namespace tawashi {
|
|||
}
|
||||
}
|
||||
|
||||
bool SubmitFormResponse::submit_to_redis (const std::string& parText) const {
|
||||
bool SubmitPasteResponse::submit_to_redis (const std::string& parText) const {
|
||||
if (not m_redis.is_connected()) {
|
||||
m_redis.connect();
|
||||
m_redis.wait_for_connect();
|
|
@ -8,9 +8,9 @@ namespace redis {
|
|||
} //namespace redis
|
||||
|
||||
namespace tawashi {
|
||||
class SubmitFormResponse : public Response {
|
||||
class SubmitPasteResponse : public Response {
|
||||
public:
|
||||
explicit SubmitFormResponse (redis::IncRedis& parRedis);
|
||||
explicit SubmitPasteResponse (redis::IncRedis& parRedis);
|
||||
|
||||
private:
|
||||
virtual void on_send (std::ostream& parStream) override;
|
Loading…
Reference in a new issue