E-MailRelay

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

gnullfilter.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2018 Graeme Walker <graeme_walker@users.sourceforge.net>
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 // ===
17 //
18 // gnullfilter.cpp
19 //
20
21 #include "gdef.h"
22 #include "gsmtp.h"
23 #include "gnullfilter.h"
24 #include "gstr.h"
25
26 GSmtp::NullFilter::NullFilter( GNet::ExceptionHandler & eh , bool server_side ) :
27 m_exit(0,server_side) ,
28 m_id("none") ,
29 m_timer(*this,&NullFilter::onTimeout,eh)
30 {
31 }
32
33 GSmtp::NullFilter::NullFilter( GNet::ExceptionHandler & eh , bool server_side , unsigned int exit_code ) :
34 m_exit(exit_code,server_side) ,
35 m_id("exit:"+G::Str::fromUInt(exit_code)) ,
36 m_timer(*this,&NullFilter::onTimeout,eh)
37 {
38 }
39
40 GSmtp::NullFilter::~NullFilter()
41 {
42 }
43
44 std::string GSmtp::NullFilter::id() const
45 {
46 return m_id ;
47 }
48
49 bool GSmtp::NullFilter::simple() const
50 {
51 return true ;
52 }
53
54 bool GSmtp::NullFilter::special() const
55 {
56 return m_exit.special ;
57 }
58
59 std::string GSmtp::NullFilter::response() const
60 {
61 return ( m_exit.ok() || m_exit.abandon() ) ? std::string() : std::string("rejected") ;
62 }
63
64 std::string GSmtp::NullFilter::reason() const
65 {
66 return ( m_exit.ok() || m_exit.abandon() ) ? std::string() : m_id ;
67 }
68
69 G::Slot::Signal1<int> & GSmtp::NullFilter::doneSignal()
70 {
71 return m_done_signal ;
72 }
73
74 void GSmtp::NullFilter::cancel()
75 {
76 }
77
78 void GSmtp::NullFilter::start( const std::string & )
79 {
80 m_timer.startTimer( 0U ) ;
81 }
82
83 void GSmtp::NullFilter::onTimeout()
84 {
85 m_done_signal.emit( m_exit.result ) ;
86 }
87
88 bool GSmtp::NullFilter::abandoned() const
89 {
90 return m_exit.abandon() ;
91 }
92
93 /// \file gnullfilter.cpp
GSmtp::NullFilter::cancel
virtual void cancel() override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:74
GSmtp::NullFilter::simple
virtual bool simple() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:49
GSmtp::NullFilter::special
virtual bool special() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:54
GNet::ExceptionHandler
An abstract interface for handling exceptions thrown out of event-loop callbacks (socket events...
Definition: gexceptionhandler.h:44
GSmtp::NullFilter::start
virtual void start(const std::string &path) override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:78
GSmtp::NullFilter::NullFilter
NullFilter(GNet::ExceptionHandler &, bool server_side)
Constructor.
Definition: gnullfilter.cpp:26
GSmtp::NullFilter::doneSignal
virtual G::Slot::Signal1< int > & doneSignal() override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:69
gstr.h
G
Low-level classes.
Definition: garg.h:29
GSmtp::NullFilter::~NullFilter
virtual ~NullFilter()
Destructor.
Definition: gnullfilter.cpp:40
GSmtp::NullFilter
A Filter class that does nothing.
Definition: gnullfilter.h:37
GSmtp::NullFilter::reason
virtual std::string reason() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:64
GSmtp::NullFilter::abandoned
virtual bool abandoned() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:88
GSmtp::NullFilter::response
virtual std::string response() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:59
gsmtp.h
GSmtp::NullFilter::id
virtual std::string id() const override
Override from from GSmtp::Filter.
Definition: gnullfilter.cpp:44
G::Slot::Signal1< int >
gnullfilter.h