summaryrefslogtreecommitdiff
path: root/src/management/builder/mail.cpp
diff options
context:
space:
mode:
authorclaiff <claiff@mail.ru>2022-10-06 12:26:45 +0300
committerclaiff <claiff@mail.ru>2022-10-06 12:26:45 +0300
commitda5f91a0ce15351a82beb061c3ccc965164529bc (patch)
tree1f4cd2d1e2f8cf2442d055c519d06c6e0692febc /src/management/builder/mail.cpp
parent8edef99a5b52643e0b919c424357752cbbc9a8dd (diff)
downloadobmc-sila-smtp-da5f91a0ce15351a82beb061c3ccc965164529bc.tar.xz
create settings on startbugfix/proxy_file_reader
Diffstat (limited to 'src/management/builder/mail.cpp')
-rw-r--r--src/management/builder/mail.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/management/builder/mail.cpp b/src/management/builder/mail.cpp
index a96fd33..7a8aa42 100644
--- a/src/management/builder/mail.cpp
+++ b/src/management/builder/mail.cpp
@@ -7,6 +7,8 @@
#include "file/mail/checker_decorator.hpp"
#include "file/mail/sort_decorator.hpp"
+#include "file/errors/not_create.hpp"
+
namespace smtp::manage::builder
{
smtp::manage::Mail Mail::Build() const
@@ -18,12 +20,20 @@ namespace smtp::manage::builder
{
static const std::string PATH = {"/var/lib/smtp/mails.txt"};
auto result = std::make_shared<file::mail::SortDecorator>() ;
- result->Apply(std::make_shared<file::mail::CheckerDecorator>( BuildErrorRegistrator() ))
- .Apply(std::make_shared<file::mail::FileDecorator>( PATH ));
+ result->Apply(std::make_shared<file::mail::CheckerDecorator>( BuildSettingsErrorRegistrator() ))
+ .Apply(std::make_shared<file::mail::FileDecorator>( PATH, BuildFileErrorRegistrator(PATH) ));
+ return result;
+ }
+
+ file::errors::Registrator Mail::BuildFileErrorRegistrator( std::string const& path ) const
+ {
+ file::errors::Registrator result;
+ auto not_created_file_error = std::make_shared<file::errors::NotCreatedFile>(path);
+ result.Add(not_created_file_error, ENOENT);
return result;
}
- checker::RegistratorMails Mail::BuildErrorRegistrator() const
+ checker::RegistratorMails Mail::BuildSettingsErrorRegistrator() const
{
checker::RegistratorMails result;
result.Add( std::make_shared < checker::errors::mail::Empty >());