33 const std::string & domain ,
const GNet::Address & peer_address ) :
34 m_code_ident(code_ident) ,
35 m_anonymous(anonymous) ,
36 m_with_received_line(with_received_line) ,
38 m_peer_address(peer_address)
40 G_ASSERT( !domain.empty() ) ;
45std::string GSmtp::ServerText::greeting()
const
47 std::string greeting_domain = m_domain ;
50 std::string(
"greeting") :
51 greeting_domain.append(
" -- ",4U).append(m_code_ident).append(
" -- Service ready") ;
54std::string GSmtp::ServerText::hello(
const std::string & )
const
56 std::string greeting_domain = m_domain ;
59 std::string(
"smtp says hello") :
60 greeting_domain.append(
" says hello") ;
63std::string GSmtp::ServerText::received(
const std::string & smtp_peer_name ,
64 bool authenticated ,
bool secure ,
const std::string & protocol ,
const std::string & cipher )
const
66 return m_with_received_line ? receivedLine( smtp_peer_name , m_peer_address.hostPartString() , m_domain ,
67 authenticated , secure , protocol , cipher ) :
std::string() ;
70std::string GSmtp::ServerText::receivedLine(
const std::string & smtp_peer_name ,
71 const std::string & peer_address ,
const std::string & receivedline_domain ,
72 bool authenticated ,
bool secure ,
const std::string & ,
const std::string & cipher_in )
79 const std::string esmtp = std::string(
"ESMTP") + (secure?
"S":
"") + (authenticated?
"A":
"") ;
82 std::string cipher = secure ?
87 std::ostringstream ss ;
89 <<
"Received: from " << peer_name
91 <<
"[" << peer_address <<
"]"
92 <<
") by " << receivedline_domain <<
" with " << esmtp
93 << (cipher.empty()?
"":
" tls ") << cipher
95 << date.weekdayName(
true) <<
", "
96 << date.monthday() <<
" "
97 << date.monthName(
true) <<
" "
99 << time.hhmmss(
":") <<
" "
The GNet::Address class encapsulates a TCP/UDP transport address.
static std::string canonicalName()
Returns the canonical network name assiciated with hostname().
ServerText(const std::string &code_ident, bool anonymous, bool with_received_line, const std::string &greeting_and_receivedline_domain, const GNet::Address &peer_address)
Constructor.
An encapsulation of 'struct std::tm'.
static Offset offset(SystemTime)
Returns the offset in seconds between UTC and localtime as at the given system time.
static std::string offsetString(Offset offset)
Converts the given utc/localtime offset into a five-character "+/-hhmm" string.
A day-month-year date class.
static std::string replaced(const std::string &s, char from, char to)
Returns the string 's' with all occurrences of 'from' replaced by 'to'.
static std::string toPrintableAscii(const std::string &in, char escape='\\')
Returns a 7-bit printable representation of the given input string.
static string_view alnum_() noexcept
Returns alnum() with an additional trailing underscore character.
static std::string only(string_view allow_chars, string_view s)
Returns the 's' with all occurrences of the characters not appearing in the first string deleted.
Represents a unix-epoch time with microsecond resolution.
static SystemTime now()
Factory function for the current time.
BrokenDownTime local() const
Returns the locale-dependent local broken-down time.
A simple time-of-day (hh/mm/ss) class.