more recent changes
This commit is contained in:
@@ -22,7 +22,7 @@ CXXFLAGS := -std=c++14 -Wall -Wextra $(INC_FLAGS) -g
|
||||
all: $(EXE) $(TOOL)
|
||||
|
||||
$(EXE): $(OBJECTS)
|
||||
$(CXX) -o $(EXE) $(LD_FLAGS) $(OBJECTS) $(CXXFLAGS) nntpchan.cpp
|
||||
$(CXX) -o $(EXE) $(LD_FLAGS) $(OBJECTS) $(CXXFLAGS) nntpd.cpp
|
||||
|
||||
$(TOOL): $(OBJECTS)
|
||||
$(CXX) -o $(TOOL) $(LD_FLAGS) $(OBJECTS) $(CXXFLAGS) tool.cpp
|
||||
|
@@ -3,6 +3,7 @@
|
||||
#include "storage.hpp"
|
||||
#include "nntp_server.hpp"
|
||||
#include "event.hpp"
|
||||
#include "exec_frontend.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
@@ -57,8 +58,28 @@ int main(int argc, char * argv[]) {
|
||||
nntp.SetLoginDB(nntpconf["authdb"]);
|
||||
}
|
||||
|
||||
auto & a = nntpconf["bind"];
|
||||
if ( level.sections.find("frontend") != level.sections.end()) {
|
||||
// frontend enabled
|
||||
auto & frontconf = level.sections["frontend"];
|
||||
if (frontconf.find("type") == frontconf.end()) {
|
||||
std::cerr << "frontend section provided but 'type' value not provided" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
auto & ftype = frontconf.find("type");
|
||||
if (ftype == "exec") {
|
||||
if (frontconf.find("exec") == frontconf.end()) {
|
||||
std::cerr << "exec frontend specified but no 'exec' value provided" << std::endl;
|
||||
return 1;
|
||||
}
|
||||
nntp.SetFrontend(new nntpchan::ExecFrontend(loop, frontconf["exec"]));
|
||||
} else {
|
||||
std::cerr << "unknown frontend type '" << ftype << "'" << std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
auto & a = nntpconf["bind"];
|
||||
|
||||
try {
|
||||
nntp.Bind(a);
|
||||
} catch ( std::exception & ex ) {
|
9
contrib/backends/nntpchan-daemon/src/exec_frontend.hpp
Normal file
9
contrib/backends/nntpchan-daemon/src/exec_frontend.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#ifndef NNTPCHAN_EXEC_FRONTEND_HPP
|
||||
#define NNTPCHAN_EXEC_FRONTEND_HPP
|
||||
|
||||
namespace nntpchan
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endif
|
25
contrib/backends/nntpchan-daemon/src/frontend.hpp
Normal file
25
contrib/backends/nntpchan-daemon/src/frontend.hpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef NNTPCHAN_FRONTEND_HPP
|
||||
#define NNTPCHAN_FRONTEND_HPP
|
||||
|
||||
namespace nntpchan
|
||||
{
|
||||
/** @brief nntpchan frontend ui interface */
|
||||
class Frontend
|
||||
{
|
||||
public:
|
||||
virtual ~Frontend() {}
|
||||
|
||||
/** @brief process an inbound message stored at fpath that we have accepted. */
|
||||
void ProcessNewMessage(const std::string & fpath) = 0;
|
||||
|
||||
/** @brief return true if we take posts in a newsgroup */
|
||||
bool AcceptsNewsgroup(const std::string & newsgroup) = 0;
|
||||
|
||||
/** @brief return true if we will accept a message given its message-id */
|
||||
bool AcceptsMessage(const std::string & msgid) = 0;
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user