E-MailRelay

gsplitfilter.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 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/// \file gsplitfilter.h
19///
20
21#ifndef G_SPLIT_FILTER_H
22#define G_SPLIT_FILTER_H
23
24#include "gdef.h"
25#include "gsimplefilterbase.h"
26
27 namespace GFilters
28{
29 class SplitFilter ;
30}
31
32//| \class GFilters::SplitFilter
33/// A concrete GSmtp::Filter class for message routing: if the
34/// message has recipients for multiple domains then it is
35/// split up into a separate message for each domain, with the
36/// forward-to envelope field containing the domain name.
37///
38 class GFilters::SplitFilter : public SimpleFilterBase
39{
40 public:
41 SplitFilter( GNet::EventState es , GStore::FileStore & ,
42 Filter::Type , const Filter::Config & , const std::string & spec ) ;
43 ///< Constructor.
44
45 private: // overrides
46 Result run( const GStore::MessageId & , bool & , GStore::FileStore::State ) override ; // GFilters::SimpleFilterBase
47
48 private:
49 G::StringArray matching( const G::StringArray & , const std::string & ) const ;
50 std::string forwardTo( const std::string & ) const ;
51 static bool match( const std::string & , const std::string & , bool raw ) ;
52 static void normalise( std::string & , bool raw ) ;
53
54 private:
55 using FileOp = GStore::FileStore::FileOp ;
56 GStore::FileStore & m_store ;
57 Filter::Config m_filter_config ;
58 bool m_raw {false} ;
59 std::string m_port ;
60} ;
61
62#endif
GFilters::SimpleFilterBase
A GSmtp::Filter base class for filters that run synchronously.
Definition: gsimplefilterbase.h:43
GFilters::SplitFilter
A concrete GSmtp::Filter class for message routing: if the message has recipients for multiple domain...
Definition: gsplitfilter.h:39
GFilters::SplitFilter::SplitFilter
SplitFilter(GNet::EventState es, GStore::FileStore &, Filter::Type, const Filter::Config &, const std::string &spec)
Constructor.
Definition: gsplitfilter.cpp:34
GNet::EventState
A lightweight object containing an ExceptionHandler pointer, optional ExceptionSource pointer and opt...
Definition: geventstate.h:131
GStore::FileStore
A concrete implementation of the MessageStore interface dealing in paired flat files.
Definition: gfilestore.h:56
GStore::MessageId
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
gsimplefilterbase.h
GFilters
Message filter classes.
Definition: gcopyfilter.h:31
G::StringArray
std::vector< std::string > StringArray
A std::vector of std::strings.
Definition: gstringarray.h:30
GStore::FileStore::FileOp
Low-level file-system operations for GStore::FileStore.
Definition: gfilestore.h:76