diff options
author | claiff <claiff@mail.ru> | 2022-09-19 14:03:14 +0300 |
---|---|---|
committer | claiff <claiff@mail.ru> | 2022-09-21 14:28:10 +0300 |
commit | 7a446d48b9270dbe2628b462a54a7a23ff43c572 (patch) | |
tree | 8e677b755c3cb529a40ee17078828bc8cc73bf31 /src/file/mail.cpp | |
parent | 629929ebbe386277c25740bc0f4971aac38444d0 (diff) | |
download | obmc-sila-smtp-7a446d48b9270dbe2628b462a54a7a23ff43c572.tar.xz |
temp
Diffstat (limited to 'src/file/mail.cpp')
-rw-r--r-- | src/file/mail.cpp | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/file/mail.cpp b/src/file/mail.cpp index 5452136..c728edc 100644 --- a/src/file/mail.cpp +++ b/src/file/mail.cpp @@ -5,8 +5,9 @@ namespace smtp::file { - Mail::Mail( std::string const& path_file ) + Mail::Mail( std::string const& path_file, checker::RegistratorMails const& registrator_errors ) : mPathFile( path_file ) + , mRegistratorErrors( registrator_errors ) { } @@ -23,11 +24,10 @@ namespace smtp::file while ( std::getline( mail_file, line ) ) { - auto parsed_data = GetMailFromLine( line ); - if( parsed_data ) - { - result.push_back( *parsed_data ); - } + if( mRegistratorErrors.Check( line ) ) + { + result.push_back( line ); + } } mail_file.close(); return result; @@ -41,23 +41,14 @@ namespace smtp::file manage::Logger::LogError( "Unable to open file to write " + mPathFile ); return false; } - for( const auto& pair : data ) + for( const auto& mail : data ) { - mail_file << pair << "\n"; + if( mRegistratorErrors.Check( mail ) ) + { + mail_file << mail << "\n"; + } } mail_file.close(); return true; } - - std::optional<std::string> Mail::GetMailFromLine( std::string const& line ) const - { - //TODO registrator if checking parsing - auto pos = line.find('@'); - if(pos == std::string::npos) - { - return {}; - } - return line; - } - } |