Archived
1
0
This repository has been archived on 2023-08-12. You can view files and clone it, but cannot push or open issues or pull requests.
nntpchan/contrib/backends/nntpchan-daemon/libnntpchan/staticfile_frontend.hpp
Jeff Becker e67e7a20bd
* more nntpchan-daemon code
* fix keepalive
2017-10-09 11:48:10 -04:00

45 lines
1.1 KiB
C++

#ifndef NNTPCHAN_STATICFILE_FRONTEND_HPP
#define NNTPCHAN_STATICFILE_FRONTEND_HPP
#include "frontend.hpp"
#include "template_engine.hpp"
#include "model.hpp"
#include <experimental/filesystem>
namespace nntpchan
{
namespace fs = std::experimental::filesystem;
class StaticFileFrontend : public Frontend
{
public:
StaticFileFrontend(TemplateEngine * tmpl, const std::string & templateDir, const std::string & outDir, uint32_t pages);
~StaticFileFrontend();
void ProcessNewMessage(const fs::path & fpath);
bool AcceptsNewsgroup(const std::string & newsgroup) { (void) newsgroup; return true; }
bool AcceptsMessage(const std::string & msgid) { (void) msgid; return true; }
private:
typedef nntpchan::model::Thread Thread_t;
typedef std::vector<Thread_t> Threads_t;
typedef std::vector<Threads_t> BoardPage_t;
BoardPage_t GetThreadsPaginated(const std::string & group, uint32_t perpage, uint32_t pages);
private:
TemplateEngine_ptr m_TemplateEngine;
fs::path m_TemplateDir;
fs::path m_OutDir;
uint32_t m_Pages;
};
}
#endif