2023-12-30 22:42:11 +00:00
|
|
|
//SPDX-FileCopyrightText: 2023 Yury Gubich <blue@macaw.me>
|
|
|
|
//SPDX-License-Identifier: GPL-3.0-or-later
|
2023-12-28 20:26:08 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2024-01-09 17:02:56 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2023-12-28 20:26:08 +00:00
|
|
|
#include "handler.h"
|
|
|
|
#include "request/request.h"
|
|
|
|
#include "response/response.h"
|
|
|
|
|
|
|
|
class Server;
|
|
|
|
namespace Handler {
|
|
|
|
|
|
|
|
class Poll : public Handler {
|
|
|
|
public:
|
2024-01-11 21:33:46 +00:00
|
|
|
Poll (std::weak_ptr<Server> server);
|
|
|
|
void handle (Request& request) override;
|
2023-12-28 20:26:08 +00:00
|
|
|
|
|
|
|
enum class Result {
|
|
|
|
success,
|
|
|
|
tokenProblem,
|
|
|
|
replace,
|
|
|
|
timeout,
|
|
|
|
unknownError
|
|
|
|
};
|
2024-01-11 21:33:46 +00:00
|
|
|
|
|
|
|
static void error (Request& request, Result result, Response::Status status);
|
|
|
|
|
2023-12-28 20:26:08 +00:00
|
|
|
private:
|
2024-01-09 17:02:56 +00:00
|
|
|
std::weak_ptr<Server> server;
|
2023-12-28 20:26:08 +00:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2023-12-30 22:42:11 +00:00
|
|
|
}
|