E-MailRelay
|
Encapsulates SMTP replies from a remote client, or replies from a client filter, or the result of a TLS handshake. More...
#include <gsmtpclientreply.h>
Public Member Functions | |
ClientReply (const G::StringArray &text, char sep='\n') | |
Constructor taking lines of text from the remote SMTP client. More... | |
bool | positive () const |
Returns true if value() is between 100 and 399. More... | |
bool | positiveCompletion () const |
Returns true if value() is between 200 and 299. More... | |
bool | is (Value v) const |
Returns true if the value() is as given. More... | |
int | value () const |
Returns the numeric value of the reply. More... | |
std::string | text () const |
Returns the text of the reply, with some whitespace normalisation and no tabs. More... | |
int | doneCode () const |
Returns -1 for filterAbandon() or -2 for filterError() or zero if less than 100 or value(). More... | |
std::string | errorText () const |
Returns the empty string if positiveCompletion() or non-empty text() or "error". More... | |
std::string | reason () const |
Returns the filter-reason text from a filterError() reply or the empty string. More... | |
Static Public Member Functions | |
static bool | valid (const G::StringArray &) |
Returns true if the reply text is syntactivally valid but possibly incomplete. More... | |
static bool | complete (const G::StringArray &) |
Returns true if the reply text is valid() and complete. More... | |
static ClientReply | ok () |
Factory function returning a generic 'Ok' reply object with a value() of 250. More... | |
static ClientReply | secure () |
Factory function for Internal_secure. More... | |
static ClientReply | filterOk () |
Factory function for Internal_filter_ok. More... | |
static ClientReply | filterAbandon () |
Factory function for Internal_filter_abandon. More... | |
static ClientReply | filterError (const std::string &response, const std::string &filter_reason) |
Factory function for Internal_filter_error. More... | |
static ClientReply | start () |
Factory function for Internal_start. More... | |
Encapsulates SMTP replies from a remote client, or replies from a client filter, or the result of a TLS handshake.
Definition at line 37 of file gsmtpclientreply.h.
|
strong |
Definition at line 40 of file gsmtpclientreply.h.
|
explicit |
Constructor taking lines of text from the remote SMTP client.
If there is more than one line in the SMTP response (eg. in the EHLO response) then the resulting text() value is a concatenation using the given separator.
Precondition: complete(text)
Definition at line 84 of file gsmtpclientreply.cpp.
|
static |
Returns true if the reply text is valid() and complete.
Definition at line 123 of file gsmtpclientreply.cpp.
int GSmtp::ClientReply::doneCode | ( | ) | const |
Returns -1 for filterAbandon() or -2 for filterError() or zero if less than 100 or value().
Definition at line 173 of file gsmtpclientreply.cpp.
std::string GSmtp::ClientReply::errorText | ( | ) | const |
Returns the empty string if positiveCompletion() or non-empty text() or "error".
Definition at line 178 of file gsmtpclientreply.cpp.
|
static |
Factory function for Internal_filter_abandon.
Definition at line 68 of file gsmtpclientreply.cpp.
|
static |
Factory function for Internal_filter_error.
Definition at line 73 of file gsmtpclientreply.cpp.
|
static |
Factory function for Internal_filter_ok.
Definition at line 63 of file gsmtpclientreply.cpp.
bool GSmtp::ClientReply::is | ( | Value | v | ) | const |
Returns true if the value() is as given.
Definition at line 168 of file gsmtpclientreply.cpp.
|
static |
Factory function returning a generic 'Ok' reply object with a value() of 250.
Definition at line 33 of file gsmtpclientreply.cpp.
bool GSmtp::ClientReply::positive | ( | ) | const |
Returns true if value() is between 100 and 399.
Definition at line 153 of file gsmtpclientreply.cpp.
bool GSmtp::ClientReply::positiveCompletion | ( | ) | const |
Returns true if value() is between 200 and 299.
Definition at line 158 of file gsmtpclientreply.cpp.
std::string GSmtp::ClientReply::reason | ( | ) | const |
Returns the filter-reason text from a filterError() reply or the empty string.
Definition at line 183 of file gsmtpclientreply.cpp.
|
static |
Factory function for Internal_secure.
Definition at line 53 of file gsmtpclientreply.cpp.
|
static |
Factory function for Internal_start.
Definition at line 58 of file gsmtpclientreply.cpp.
std::string GSmtp::ClientReply::text | ( | ) | const |
Returns the text of the reply, with some whitespace normalisation and no tabs.
Definition at line 188 of file gsmtpclientreply.cpp.
|
static |
Returns true if the reply text is syntactivally valid but possibly incomplete.
Definition at line 109 of file gsmtpclientreply.cpp.
int GSmtp::ClientReply::value | ( | ) | const |
Returns the numeric value of the reply.
Definition at line 163 of file gsmtpclientreply.cpp.