summaryrefslogtreecommitdiff
path: root/src/managment/settings.cpp
blob: 860e7dba64d30da69b7bbe3e120b2e5ba7b9c03a (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
42
43
44
45
46
47
48
49
50
51
52
#include "settings.hpp"
#include "converter/string.hpp"

namespace smtp::manage
{
    Settings::Settings( file::Settings const& file_reader )
        : mFileReader( file_reader )
    {
        mSettingsFields = file_reader.Read();
    }

    bool Settings::SetSettings( manage::SettingsFields const& settings_fields )const
    {
        return mFileReader.Write( settings_fields );
    }

    std::string Settings::GetSettings()
    {
        mSettingsFields = mFileReader.Read();
        return converter::String{}.Convert(mSettingsFields);
    }

    bool Settings::IsNeedAuth() const noexcept
    {
        return mSettingsFields.is_need_auth;
    }

    bool Settings::IsNeedSsl() const noexcept
    {
        return mSettingsFields.is_need_ssl;
    }

    std::string Settings::GetUserName() const
    {
        return mSettingsFields.username;
    }

    std::string Settings::GetPassword() const
    {
        return mSettingsFields.password;
    }

    std::string Settings::GetHost() const
    {
        return mSettingsFields.host;
    }

    std::string Settings::GetPort() const
    {
        return mSettingsFields.port;
    }
}