E-MailRelay
Public Types | Public Member Functions | Static Public Member Functions | List of all members
GSmtp::ClientProtocolReply Class Reference

A private implementation class used by ClientProtocol. More...

#include <gsmtpclientprotocol.h>

Public Types

enum class  Type {
  PositivePreliminary = 1 , PositiveCompletion = 2 , PositiveIntermediate = 3 , TransientNegative = 4 ,
  PermanentNegative = 5
}
 
enum class  SubType {
  Syntax = 0 , Information = 1 , Connections = 2 , MailSystem = 3 ,
  Invalid_SubType = 4
}
 
enum class  Value {
  Internal_filter_ok = 222 , Internal_filter_abandon = 223 , Internal_secure = 224 , 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 ,
  Internal_filter_error = 590 , NotAuthenticated_535 = 535 , NotAvailable_454 = 454 , Invalid = 0
}
 

Public Member Functions

 ClientProtocolReply (const std::string &line=std::string())
 Constructor for one line of text. More...
 
bool add (const ClientProtocolReply &other)
 Adds more lines to this reply. More...
 
bool incomplete () const
 Returns true if the reply is incomplete. More...
 
bool validFormat () const
 Returns true if a valid format. More...
 
bool positive () const
 Returns true if the numeric value of the reply is less than four hundred. More...
 
bool is (Value v) const
 Returns true if the reply value is 'v'. More...
 
int value () const
 Returns the numeric value of the reply. More...
 
std::string text () const
 Returns the text of the reply, excluding the numeric part, and with embedded newlines. More...
 
std::string errorText () const
 Returns the text() string, plus any error reason, but with the guarantee that the returned string is empty if and only if the reply value is 2xx. More...
 
std::string errorReason () const
 Returns an error reason string, as passed to error(). More...
 
bool textContains (std::string s) const
 Returns true if the text() contains the given substring. More...
 
std::string textLine (const std::string &prefix) const
 Returns a line of text() which starts with prefix. More...
 
Type type () const
 Returns the reply type (category). More...
 
SubType subType () const
 Returns the reply sub-type. More...
 

Static Public Member Functions

static ClientProtocolReply ok ()
 Factory function for an ok reply. More...
 
static ClientProtocolReply ok (Value, const std::string &=std::string())
 Factory function for an ok reply with a specific 2xx value. More...
 
static ClientProtocolReply error (Value, const std::string &response, const std::string &error_reason)
 Factory function for an error reply with a specific 5xx value. More...
 

Detailed Description

A private implementation class used by ClientProtocol.

Definition at line 45 of file gsmtpclientprotocol.h.

Member Enumeration Documentation

◆ SubType

enum class GSmtp::ClientProtocolReply::SubType
strong

Definition at line 56 of file gsmtpclientprotocol.h.

◆ Type

enum class GSmtp::ClientProtocolReply::Type
strong

Definition at line 48 of file gsmtpclientprotocol.h.

◆ Value

enum class GSmtp::ClientProtocolReply::Value
strong

Definition at line 64 of file gsmtpclientprotocol.h.

Constructor & Destructor Documentation

◆ ClientProtocolReply()

GSmtp::ClientProtocolReply::ClientProtocolReply ( const std::string &  line = std::string())
explicit

Constructor for one line of text.

Definition at line 663 of file gsmtpclientprotocol.cpp.

Member Function Documentation

◆ add()

bool GSmtp::ClientProtocolReply::add ( const ClientProtocolReply other)

Adds more lines to this reply.

Returns false if the numeric values are different.

Definition at line 786 of file gsmtpclientprotocol.cpp.

◆ error()

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::error ( Value  v,
const std::string &  response,
const std::string &  error_reason 
)
static

Factory function for an error reply with a specific 5xx value.

Definition at line 699 of file gsmtpclientprotocol.cpp.

◆ errorReason()

std::string GSmtp::ClientProtocolReply::errorReason ( ) const

Returns an error reason string, as passed to error().

Definition at line 740 of file gsmtpclientprotocol.cpp.

◆ errorText()

std::string GSmtp::ClientProtocolReply::errorText ( ) const

Returns the text() string, plus any error reason, but with the guarantee that the returned string is empty if and only if the reply value is 2xx.

Definition at line 734 of file gsmtpclientprotocol.cpp.

◆ incomplete()

bool GSmtp::ClientProtocolReply::incomplete ( ) const

Returns true if the reply is incomplete.

Definition at line 714 of file gsmtpclientprotocol.cpp.

◆ is()

bool GSmtp::ClientProtocolReply::is ( Value  v) const

Returns true if the reply value is 'v'.

Definition at line 729 of file gsmtpclientprotocol.cpp.

◆ ok() [1/2]

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::ok ( )
static

Factory function for an ok reply.

Definition at line 684 of file gsmtpclientprotocol.cpp.

◆ ok() [2/2]

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::ok ( Value  v,
const std::string &  text = std::string() 
)
static

Factory function for an ok reply with a specific 2xx value.

Definition at line 689 of file gsmtpclientprotocol.cpp.

◆ positive()

bool GSmtp::ClientProtocolReply::positive ( ) const

Returns true if the numeric value of the reply is less than four hundred.

Definition at line 719 of file gsmtpclientprotocol.cpp.

◆ subType()

GSmtp::ClientProtocolReply::SubType GSmtp::ClientProtocolReply::subType ( ) const

Returns the reply sub-type.

Definition at line 776 of file gsmtpclientprotocol.cpp.

◆ text()

std::string GSmtp::ClientProtocolReply::text ( ) const

Returns the text of the reply, excluding the numeric part, and with embedded newlines.

Definition at line 745 of file gsmtpclientprotocol.cpp.

◆ textContains()

bool GSmtp::ClientProtocolReply::textContains ( std::string  s) const

Returns true if the text() contains the given substring.

Definition at line 797 of file gsmtpclientprotocol.cpp.

◆ textLine()

std::string GSmtp::ClientProtocolReply::textLine ( const std::string &  prefix) const

Returns a line of text() which starts with prefix.

Definition at line 750 of file gsmtpclientprotocol.cpp.

◆ type()

GSmtp::ClientProtocolReply::Type GSmtp::ClientProtocolReply::type ( ) const

Returns the reply type (category).

Definition at line 770 of file gsmtpclientprotocol.cpp.

◆ validFormat()

bool GSmtp::ClientProtocolReply::validFormat ( ) const

Returns true if a valid format.

Definition at line 709 of file gsmtpclientprotocol.cpp.

◆ value()

int GSmtp::ClientProtocolReply::value ( ) const

Returns the numeric value of the reply.

Definition at line 724 of file gsmtpclientprotocol.cpp.


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