Messagelib

aliasesexpandjob.h
1/*
2 * This file is part of KMail.
3 *
4 * SPDX-FileCopyrightText: 2010 KDAB
5 * SPDX-FileContributor: Tobias Koenig <tokoe@kde.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#pragma once
11
12#include "messagecomposer_export.h"
13
14#include <KJob>
15
16#include <QMap>
17#include <QStringList>
18
19namespace MessageComposer
20{
21/**
22 * @short A job to expand aliases to email addresses.
23 *
24 * Expands aliases (distribution lists and nick names) and appends a
25 * domain part to all email addresses which are missing the domain part.
26 */
27class MESSAGECOMPOSER_EXPORT AliasesExpandJob : public KJob
28{
29 Q_OBJECT
30
31public:
32 /**
33 * Creates a new aliases expand job.
34 *
35 * @param recipients The comma separated list of recipient.
36 * @param defaultDomain The default domain that shall be used when expanding aliases.
37 * @param parent The parent object.
38 */
39 explicit AliasesExpandJob(const QString &recipients, const QString &defaultDomain, QObject *parent = nullptr);
40
41 /**
42 * Destroys the aliases expand job.
43 */
45
46 /**
47 * Starts the job.
48 */
49 void start() override;
50
51 /**
52 * Returns the expanded email addresses.
53 */
54 [[nodiscard]] QString addresses() const;
55
56 /**
57 * Returns the list of distribution lists that resolved to an empty member list.
58 */
59 [[nodiscard]] QStringList emptyDistributionLists() const;
60
61 [[nodiscard]] QStringList emailAddressOnly() const;
62
63private:
64 MESSAGECOMPOSER_NO_EXPORT void slotDistributionListExpansionDone(KJob *);
65 MESSAGECOMPOSER_NO_EXPORT void slotNicknameExpansionDone(KJob *);
66 MESSAGECOMPOSER_NO_EXPORT void finishExpansion();
67
68 QStringList mEmailAddressOnly;
69
70 const QStringList mRecipients;
71 const QString mDefaultDomain;
72
73 QString mEmailAddresses;
74 QStringList mEmptyDistributionLists;
75
76 uint mDistributionListExpansionJobs = 0;
77 uint mNicknameExpansionJobs = 0;
78
79 struct DistributionListExpansionResult {
80 QString addresses;
81 bool isEmpty = false;
82 };
83 QMap<QString, DistributionListExpansionResult> mDistListExpansionResults;
84 QMap<QString, QString> mNicknameExpansionResults;
85};
86}
A job to expand aliases to email addresses.
~AliasesExpandJob() override
Destroys the aliases expand job.
Q_SCRIPTABLE Q_NOREPLY void start()
Simple interface that both EncryptJob and SignEncryptJob implement so the composer can extract some e...
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.