Leosac  0.8.0
Open Source Access Control
SMTPConfig.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #define ODB_NO_BASE_VERSION
23 #include "SMTPFwd.hpp"
24 #include "tools/db/database.hpp"
25 
26 #pragma db model version(1, 1, open)
27 
28 namespace Leosac
29 {
30 namespace Module
31 {
32 namespace SMTP
33 {
34 
35 #pragma db value
37 {
39  : ms_timeout(30 * 1000)
40  , verify_host(false)
41  , verify_peer(false)
42  , enabled(true){};
43 
44  SMTPServerInfo(const SMTPServerInfo &) = default;
45 
46  std::string url;
47  std::string from;
48  std::string username;
49  std::string password;
50 
56 
59  std::string CA_info_file_;
60 
64  bool enabled;
65 };
66 
72 #pragma db object table("SMTP_Config")
74 {
75  public:
76  SMTPConfig();
77 
78  SMTPConfigId id() const;
79 
81  void server_clear();
82  const std::vector<SMTPServerInfo> &servers() const;
83 
84  private:
85 #pragma db id auto
87 
88 #pragma db value_not_null id_column("smtpconfig_id")
89  std::vector<SMTPServerInfo> servers_;
90 
91  friend class odb::access;
92 };
93 }
94 }
95 }
Leosac::Module::SMTP::SMTPConfig::server_clear
void server_clear()
Definition: SMTPConfig.cpp:35
database.hpp
Leosac::Module::SMTP::SMTPServerInfo::url
std::string url
Definition: SMTPConfig.hpp:46
Leosac::Module::SMTP::SMTPServerInfo::verify_peer
bool verify_peer
Definition: SMTPConfig.hpp:58
Leosac::Module::SMTP::SMTPServerInfo::CA_info_file_
std::string CA_info_file_
Definition: SMTPConfig.hpp:59
Leosac::Module::SMTP::SMTPConfig
Wrapper around the SMTP module configuration.
Definition: SMTPConfig.hpp:73
Leosac::Module::SMTP::SMTPServerInfo::verify_host
bool verify_host
Definition: SMTPConfig.hpp:57
Leosac::Module::SMTP::SMTPServerInfo::username
std::string username
Definition: SMTPConfig.hpp:48
Leosac::Module::SMTP::SMTPConfigId
unsigned long SMTPConfigId
Definition: SMTPFwd.hpp:35
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::SMTP::SMTPServerInfo::SMTPServerInfo
SMTPServerInfo()
Definition: SMTPConfig.hpp:38
Leosac::Module::SMTP::SMTPServerInfo::enabled
bool enabled
Should this server be used to send email ?
Definition: SMTPConfig.hpp:64
Leosac::Module::SMTP::SMTPConfig::SMTPConfig
SMTPConfig()
Definition: SMTPConfig.cpp:25
Leosac::Module::SMTP::SMTPServerInfo
Definition: SMTPConfig.hpp:36
Leosac::Module::SMTP::SMTPConfig::server_add
void server_add(SMTPServerInfo)
Definition: SMTPConfig.cpp:30
Leosac::Module::SMTP::SMTPServerInfo::ms_timeout
int ms_timeout
Timeout in millisecond for an operation against this server.
Definition: SMTPConfig.hpp:55
Leosac::Module::SMTP::SMTPServerInfo::password
std::string password
Definition: SMTPConfig.hpp:49
Leosac::Module::SMTP::SMTPConfig::id_
SMTPConfigId id_
Definition: SMTPConfig.hpp:86
SMTPFwd.hpp
Leosac::Module::SMTP::SMTPConfig::servers_
std::vector< SMTPServerInfo > servers_
Definition: SMTPConfig.hpp:89
Leosac::Module::SMTP::SMTPConfig::id
SMTPConfigId id() const
Definition: SMTPConfig.cpp:45
Leosac::Module::SMTP::SMTPConfig::access
friend class odb::access
Definition: SMTPConfig.hpp:91
Leosac::Module::SMTP::SMTPServerInfo::from
std::string from
Definition: SMTPConfig.hpp:47
Leosac::Module::SMTP::SMTPConfig::servers
const std::vector< SMTPServerInfo > & servers() const
Definition: SMTPConfig.cpp:40