E-MailRelay
gmessageidfilter.h
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2023 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 gmessageidfilter.h
19///
20
21#ifndef G_MESSAGE_ID_FILTER_H
22#define G_MESSAGE_ID_FILTER_H
23
24#include "gdef.h"
25#include "gsimplefilterbase.h"
26#include "gfilestore.h"
27#include "gexception.h"
28
29namespace GFilters
30{
31 class MessageIdFilter ;
32}
33
34//| \class GFilters::MessageIdFilter
35/// A filter that adds a RFC-822 Message-ID to the message content if
36/// it does not have one already.
37///
39{
40public:
41 G_EXCEPTION( Error , tx("failed to add message id to content file") ) ;
42
44 Filter::Type , const Filter::Config & , const std::string & spec ) ;
45 ///< Constructor.
46
47 static std::string process( const G::Path & , const std::string & domain ) ;
48 ///< Edits a content file by adding a message-id if necessary.
49 ///< Returns an error message on error.
50
51private: // overrides
52 Result run( const GStore::MessageId & , bool & , GStore::FileStore::State ) override ;
53
54private:
55 static bool isId( G::string_view ) noexcept ;
56 static std::string newId( const std::string & ) ;
57
58private:
59 GStore::FileStore & m_store ;
60 std::string m_domain ;
61} ;
62
63#endif
A filter that adds a RFC-822 Message-ID to the message content if it does not have one already.
static std::string process(const G::Path &, const std::string &domain)
Edits a content file by adding a message-id if necessary.
MessageIdFilter(GNet::ExceptionSink, GStore::FileStore &, Filter::Type, const Filter::Config &, const std::string &spec)
Constructor.
A GSmtp::Filter base class for filters that run synchronously.
A tuple containing an ExceptionHandler interface pointer and a bound 'exception source' pointer.
A concrete implementation of the MessageStore interface dealing in paired flat files.
Definition: gfilestore.h:56
A somewhat opaque identifer for a GStore::MessageStore message id.
Definition: gmessagestore.h:43
A Path object represents a file system path.
Definition: gpath.h:73
A class like c++17's std::string_view.
Definition: gstringview.h:51
Message filter classes.
Definition: gcopyfilter.h:31
constexpr const char * tx(const char *p)
A briefer alternative to G::gettext_noop().
Definition: ggettext.h:84