summaryrefslogtreecommitdiff
path: root/src/file/mail.cpp
blob: 14e6228c325fdd2d21f7d4ce0da9e6c2d4b6382d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <fstream>

#include "mail.hpp"

namespace smtp::file
{
    Mail::Mail( std::string const& path_file )
        : PathFile( path_file )
    {

    }

    std::list<std::string> Mail::Read() const
    {
        std::ifstream mail_file{ PathFile };
        if ( !mail_file.is_open() )
        {
            //TODO new file
           // std::cerr << "Failed to open pcie_devices database \n";
        }
        std::string line{};
        std::list<std::string> result;

        while ( std::getline( mail_file, line ) )
        {
            auto parsed_data = GetMailFromLine( line );
            if( parsed_data )
            {
                result.push_back( *parsed_data );
            }
        }
        return result;
    }

    std::optional<std::string> Mail::GetMailFromLine( std::string const& line ) const
    {
        //TODO parsing
        return line;
    }

}