log A record for block list
[ghsmtp.git] / Reply.hpp
blobdea1fcf4d362cb32c267ec274e78391f3209812b
1 #ifndef REPLY_DOT_HPP
2 #define REPLY_DOT_HPP
4 #include <optional>
5 #include <string>
6 #include <string_view>
8 #include "fs.hpp"
10 // sender rewriting scheme complaint
12 class Reply {
13 public:
14 struct from_to {
15 std::string mail_from; // from
16 std::string rcpt_to_local_part; // @our-domain.com
18 inline bool operator==(from_to const& rhs) const;
19 inline bool empty() const;
20 inline void clear();
23 static std::string enc_reply(from_to const& reply_info,
24 std::string_view secret);
26 static std::optional<from_to> dec_reply(std::string_view addr,
27 std::string_view secret);
30 inline bool Reply::from_to::operator==(from_to const& rhs) const
32 return (mail_from == rhs.mail_from) &&
33 (rcpt_to_local_part == rhs.rcpt_to_local_part);
36 inline bool Reply::from_to::empty() const
38 return mail_from.empty() && rcpt_to_local_part.empty();
41 inline void Reply::from_to::clear()
43 mail_from.clear();
44 rcpt_to_local_part.clear();
47 #endif // REPLY_DOT_HPP