GSmtp::ClientProtocolReply Class Reference

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

#include <gclientprotocol.h>

List of all members.

Public Types

enum  Type {
  PositivePreliminary = 1, PositiveCompletion = 2, PositiveIntermediate = 3, TransientNegative = 4,
  PermanentNegative = 5
}
enum  SubType {
  Syntax = 0, Information = 1, Connections = 2, MailSystem = 3,
  Invalid_SubType = 4
}
enum  Value {
  Internal_2xx = 222, Internal_2yy = 223, 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, Invalid = 0
}

Public Member Functions

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

Static Public Member Functions

static ClientProtocolReply ok ()
 Factory function for an ok reply.
static ClientProtocolReply ok (Value)
 Factory function for an ok reply with a specific 2xx value.
static ClientProtocolReply error (const std::string &reason)
 Factory function for a generalised error reply.


Detailed Description

A private implementation class used by ClientProtocol.

Definition at line 48 of file gclientprotocol.h.


Member Enumeration Documentation

Enumerator:
PositivePreliminary 
PositiveCompletion 
PositiveIntermediate 
TransientNegative 
PermanentNegative 

Definition at line 51 of file gclientprotocol.h.

Enumerator:
Syntax 
Information 
Connections 
MailSystem 
Invalid_SubType 

Definition at line 59 of file gclientprotocol.h.

Enumerator:
Internal_2xx 
Internal_2yy 
ServiceReady_220 
Ok_250 
Authenticated_235 
Challenge_334 
OkForData_354 
SyntaxError_500 
SyntaxError_501 
NotImplemented_502 
BadSequence_503 
NotAuthenticated_535 
NotAvailable_454 
Invalid 

Definition at line 67 of file gclientprotocol.h.


Constructor & Destructor Documentation

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

Constructor for one line of text.

Definition at line 563 of file gclientprotocol.cpp.

References G::Str::replaceAll(), G::Str::toUInt(), and G::Str::trimLeft().


Member Function Documentation

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::ok (  )  [static]

Factory function for an ok reply.

Definition at line 586 of file gclientprotocol.cpp.

References errorText(), G_ASSERT, incomplete(), and positive().

Referenced by GSmtp::ClientProtocol::preprocessorDone(), and GSmtp::ClientProtocol::secure().

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::ok ( Value  v  )  [static]

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

Definition at line 595 of file gclientprotocol.cpp.

References G_ASSERT.

GSmtp::ClientProtocolReply GSmtp::ClientProtocolReply::error ( const std::string &  reason  )  [static]

Factory function for a generalised error reply.

Definition at line 608 of file gclientprotocol.cpp.

References errorText(), G_ASSERT, incomplete(), positive(), and G::Str::printable().

Referenced by GSmtp::ClientProtocol::preprocessorDone().

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

Adds more lines to this reply.

Returns false if the numeric values are different.

Definition at line 688 of file gclientprotocol.cpp.

References G_ASSERT, m_complete, m_valid, text(), and value().

bool GSmtp::ClientProtocolReply::incomplete (  )  const

Returns true if the reply is incomplete.

Definition at line 622 of file gclientprotocol.cpp.

Referenced by error(), and ok().

bool GSmtp::ClientProtocolReply::validFormat (  )  const

Returns true if a valid format.

Definition at line 617 of file gclientprotocol.cpp.

bool GSmtp::ClientProtocolReply::positive (  )  const

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

Definition at line 627 of file gclientprotocol.cpp.

Referenced by error(), and ok().

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

Returns true if the reply value is 'v'.

Definition at line 637 of file gclientprotocol.cpp.

References value().

unsigned int GSmtp::ClientProtocolReply::value (  )  const

Returns the numeric value of the reply.

Definition at line 632 of file gclientprotocol.cpp.

Referenced by add(), and is().

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

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

Definition at line 648 of file gclientprotocol.cpp.

Referenced by add(), and textContains().

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

Returns the text() string but with the guarantee that the returned string is empty if and only if the reply value is exactly 250.

Definition at line 642 of file gclientprotocol.cpp.

References PositiveCompletion, and type().

Referenced by error(), and ok().

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

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

Definition at line 699 of file gclientprotocol.cpp.

References text(), and G::Str::toUpper().

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

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

Definition at line 653 of file gclientprotocol.cpp.

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

Returns the reply type (category).

Definition at line 673 of file gclientprotocol.cpp.

References G_ASSERT.

Referenced by errorText().

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

Returns the reply sub-type.

Definition at line 679 of file gclientprotocol.cpp.

References Invalid_SubType.


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

Generated on Fri Apr 18 15:56:13 2008 for E-MailRelay by  doxygen 1.5.5