Leosac  0.7.0
OpenSourceAccessControl
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 
80  void server_add(SMTPServerInfo);
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 }
std::vector< SMTPServerInfo > servers_
Definition: SMTPConfig.hpp:89
bool enabled
Should this server be used to send email ?
Definition: SMTPConfig.hpp:64
This is the header file for a generated source file, GitSHA1.cpp.
unsigned long SMTPConfigId
Definition: SMTPFwd.hpp:35
Wrapper around the SMTP module configuration.
Definition: SMTPConfig.hpp:73
int ms_timeout
Timeout in millisecond for an operation against this server.
Definition: SMTPConfig.hpp:55