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

A class for forwarding messages from a message store that manages a GSmtp::Client instance, connecting and disconnecting as necessary to do routing and re-authentication. More...

#include <gsmtpforward.h>

Public Types

using Config = GSmtp::Client::Config
 

Public Member Functions

 Forward (GNet::ExceptionSink, GStore::MessageStore &store, FilterFactoryBase &, const GNet::Location &forward_to_default, const GAuth::SaslClientSecrets &, const Config &config)
 Constructor. More...
 
 Forward (GNet::ExceptionSink, FilterFactoryBase &, const GNet::Location &forward_to_default, const GAuth::SaslClientSecrets &, const Config &config)
 Constructor. More...
 
virtual ~Forward ()
 Destructor. More...
 
void sendMessage (std::unique_ptr< GStore::StoredMessage > message)
 Starts sending the given message. More...
 
void quitAndFinish ()
 Finishes a sendMessage() sequence. More...
 
G::Slot::Signal< const Client::MessageDoneInfo & > & messageDoneSignal () noexcept
 Returns a signal that indicates that sendMessage() has completed or failed. More...
 
G::Slot::Signal< const std::string &, const std::string &, const std::string & > & eventSignal () noexcept
 See GNet::Client::eventSignal() More...
 
void doOnDelete (const std::string &reason, bool done)
 Used by owning ClientPtr when handling an exception. More...
 
bool finished () const
 Returns true after quitAndFinish(). More...
 
std::string peerAddressString () const
 Returns the Client's peerAddressString() if currently connected. More...
 
 Forward (const Forward &)=delete
 
 Forward (Forward &&)=delete
 
Forwardoperator= (const Forward &)=delete
 
Forwardoperator= (Forward &&)=delete
 

Detailed Description

A class for forwarding messages from a message store that manages a GSmtp::Client instance, connecting and disconnecting as necessary to do routing and re-authentication.

Definition at line 54 of file gsmtpforward.h.

Member Typedef Documentation

◆ Config

Definition at line 57 of file gsmtpforward.h.

Constructor & Destructor Documentation

◆ Forward() [1/2]

GSmtp::Forward::Forward ( GNet::ExceptionSink  es,
GStore::MessageStore store,
FilterFactoryBase ff,
const GNet::Location forward_to_default,
const GAuth::SaslClientSecrets secrets,
const Config config 
)

Constructor.

Starts sending the first message from the message store.

Once all messages have been sent the client will throw GNet::Done. See GNet::ClientPtr.

Do not use sendMessage(). The messageDoneSignal() is not emitted.

Definition at line 27 of file gsmtpforward.cpp.

◆ Forward() [2/2]

GSmtp::Forward::Forward ( GNet::ExceptionSink  es,
FilterFactoryBase ff,
const GNet::Location forward_to_default,
const GAuth::SaslClientSecrets secrets,
const Config config 
)

Constructor.

Use sendMessage() immediately after construction.

A messageDoneSignal() is emitted when the message has been sent, allowing the next sendMessage().

Use quitAndFinish() at the end.

Definition at line 37 of file gsmtpforward.cpp.

◆ ~Forward()

GSmtp::Forward::~Forward ( )
virtual

Destructor.

Definition at line 58 of file gsmtpforward.cpp.

Member Function Documentation

◆ doOnDelete()

void GSmtp::Forward::doOnDelete ( const std::string &  reason,
bool  done 
)

Used by owning ClientPtr when handling an exception.

Definition at line 303 of file gsmtpforward.cpp.

◆ eventSignal()

G::Slot::Signal< const std::string &, const std::string &, const std::string & > & GSmtp::Forward::eventSignal ( )
noexcept

See GNet::Client::eventSignal()

Definition at line 366 of file gsmtpforward.cpp.

◆ finished()

bool GSmtp::Forward::finished ( ) const

Returns true after quitAndFinish().

Definition at line 326 of file gsmtpforward.cpp.

◆ messageDoneSignal()

G::Slot::Signal< const GSmtp::Client::MessageDoneInfo & > & GSmtp::Forward::messageDoneSignal ( )
noexcept

Returns a signal that indicates that sendMessage() has completed or failed.

Definition at line 361 of file gsmtpforward.cpp.

◆ peerAddressString()

std::string GSmtp::Forward::peerAddressString ( ) const

Returns the Client's peerAddressString() if currently connected.

Definition at line 320 of file gsmtpforward.cpp.

◆ quitAndFinish()

void GSmtp::Forward::quitAndFinish ( )

Finishes a sendMessage() sequence.

Definition at line 235 of file gsmtpforward.cpp.

◆ sendMessage()

void GSmtp::Forward::sendMessage ( std::unique_ptr< GStore::StoredMessage message)

Starts sending the given message.

Cannot be called if there is a message already in the pipeline.

The messageDoneSignal() is used to indicate that the message filtering has finished or failed.

The message is fail()ed if it cannot be sent. If this Client object is deleted before the message is sent the message is neither fail()ed or destroy()ed.

Does nothing if there are no message recipients.

Definition at line 110 of file gsmtpforward.cpp.


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