E-MailRelay

Public Types | Public Member Functions | Static Public Member Functions | List of all members
GSmtp::ClientReply Class Reference

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 Types
enum class | Value { Invalid = 0 , Internal_start = 1 , Internal_filter_ok = 2 , Internal_filter_abandon = 3 , Internal_filter_error = 4 , Internal_secure = 5 , ServiceReady_220 = 220 , Ok_250 = 250 , Authenticated_235 = 235 , Challenge_334 = 334 , OkForData_354 = 354 , SyntaxError_500 = 500 , SyntaxError_501 = 501 , NotImplemented_502 = 502 , BadSequence_503 = 503 , NotAuthenticated_535 = 535 , NotAvailable_454 = 454 }

## 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...

## Detailed Description

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.

## Member Enumeration Documentation

## ◆ Value

enum class GSmtp::ClientReply::Value
| strong

Definition at line 40 of file gsmtpclientreply.h.

## Constructor & Destructor Documentation

## ◆ ClientReply()

GSmtp::ClientReply::ClientReply | ( | const G::StringArray & | text,
|  | char | sep = `'\n'`
| ) |  |
| 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.

## Member Function Documentation

## ◆ complete()

bool GSmtp::ClientReply::complete | ( | const G::StringArray & | lines | ) |
| static

Returns true if the reply text is valid() and complete.

Definition at line 123 of file gsmtpclientreply.cpp.

## ◆ doneCode()

int GSmtp::ClientReply::doneCode | ( |  | ) | const

Returns -1 for filterAbandon() or -2 for filterError() or zero if less than 100 or value().

See also
  GSmtp::ClientProtocol::doneSignal()

Definition at line 173 of file gsmtpclientreply.cpp.

## ◆ errorText()

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.

## ◆ filterAbandon()

GSmtp::ClientReply GSmtp::ClientReply::filterAbandon | ( |  | ) |
| static

Factory function for Internal_filter_abandon.

Definition at line 68 of file gsmtpclientreply.cpp.

## ◆ filterError()

GSmtp::ClientReply GSmtp::ClientReply::filterError | ( | const std::string & | response,
|  | const std::string & | filter_reason
| ) |  |
| static

Factory function for Internal_filter_error.

Definition at line 73 of file gsmtpclientreply.cpp.

## ◆ filterOk()

GSmtp::ClientReply GSmtp::ClientReply::filterOk | ( |  | ) |
| static

Factory function for Internal_filter_ok.

Definition at line 63 of file gsmtpclientreply.cpp.

## ◆ is()

bool GSmtp::ClientReply::is | ( | Value | v | ) | const

Returns true if the value() is as given.

Definition at line 168 of file gsmtpclientreply.cpp.

## ◆ ok()

GSmtp::ClientReply GSmtp::ClientReply::ok | ( |  | ) |
| static

Factory function returning a generic 'Ok' reply object with a value() of 250.

Definition at line 33 of file gsmtpclientreply.cpp.

## ◆ positive()

bool GSmtp::ClientReply::positive | ( |  | ) | const

Returns true if value() is between 100 and 399.

Definition at line 153 of file gsmtpclientreply.cpp.

## ◆ positiveCompletion()

bool GSmtp::ClientReply::positiveCompletion | ( |  | ) | const

Returns true if value() is between 200 and 299.

Definition at line 158 of file gsmtpclientreply.cpp.

## ◆ reason()

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.

## ◆ secure()

GSmtp::ClientReply GSmtp::ClientReply::secure | ( |  | ) |
| static

Factory function for Internal_secure.

Definition at line 53 of file gsmtpclientreply.cpp.

## ◆ start()

GSmtp::ClientReply GSmtp::ClientReply::start | ( |  | ) |
| static

Factory function for Internal_start.

Definition at line 58 of file gsmtpclientreply.cpp.

## ◆ text()

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.

## ◆ valid()

bool GSmtp::ClientReply::valid | ( | const G::StringArray & | lines | ) |
| static

Returns true if the reply text is syntactivally valid but possibly incomplete.

Definition at line 109 of file gsmtpclientreply.cpp.

## ◆ value()

int GSmtp::ClientReply::value | ( |  | ) | const

Returns the numeric value of the reply.

Definition at line 163 of file gsmtpclientreply.cpp.

The documentation for this class was generated from the following files:

- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gsmtp/gsmtpclientreply.h
- /tmp/slackdce/slackrepo.HKsbdz/build_emailrelay/emailrelay-2.6/src/gsmtp/gsmtpclientreply.cpp