gnullprocessor.cpp
Go to the documentation of this file.
1 //
2 // Copyright (C) 2001-2013 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 // gnullprocessor.cpp
19 //
20 
21 #include "gdef.h"
22 #include "gsmtp.h"
23 #include "gnullprocessor.h"
24 
26  m_cancelled(false) ,
27  m_repoll(false) ,
28  m_ok(true)
29 {
30 }
31 
32 GSmtp::NullProcessor::NullProcessor( unsigned int exit_code ) :
33  m_cancelled(false) ,
34  m_repoll(false) ,
35  m_ok(false)
36 {
37  bool is_special = exit_code >= 100U && exit_code <= 107U ;
38  m_repoll = is_special && ((exit_code-100U)&2U) != 0U ;
39  m_cancelled = is_special && ((exit_code-100U)&1U) == 0U ;
40  m_ok = exit_code == 0 || ( is_special && !m_cancelled ) ;
41 }
42 
44 {
45 }
46 
48 {
49  return m_cancelled ;
50 }
51 
53 {
54  return m_repoll ;
55 }
56 
57 std::string GSmtp::NullProcessor::text() const
58 {
59  return m_ok ? std::string() : std::string("error") ;
60 }
61 
63 {
64  return m_done_signal ;
65 }
66 
68 {
69 }
70 
71 void GSmtp::NullProcessor::start( const std::string & )
72 {
73  m_done_signal.emit( m_ok ) ;
74 }
75 
virtual G::Signal1< bool > & doneSignal()
Final override from GSmtp::Processor.
NullProcessor()
Constructor.
virtual void start(const std::string &path)
Final override from GSmtp::Processor.
virtual void abort()
Final override from GSmtp::Processor.
virtual std::string text() const
Final override from GSmtp::Processor.
virtual bool cancelled() const
Final override from GSmtp::Processor.
virtual ~NullProcessor()
Destructor.
virtual bool repoll() const
Final override from GSmtp::Processor.