Messagelib

messagesender.h
1/*
2 messagesender.h
3
4 This file is part of KMail, the KDE mail client
5 SPDX-FileCopyrightText: 2005 Klarälvdalens Datakonsult AB
6
7 SPDX-License-Identifier: GPL-2.0-or-later
8*/
9
10#pragma once
11
12#include <KMime/Message>
13namespace MessageComposer
14{
15class MessageSender
16{
17protected:
18 virtual ~MessageSender() = 0;
19
20public:
21 enum SendMethod {
22 SendDefault = -1,
23 SendImmediate = true,
24 SendLater = false,
25 };
26 enum SaveIn {
27 SaveInNone,
28 SaveInDrafts,
29 SaveInTemplates,
30 SaveInOutbox,
31 };
32 /**
33 Send given message.
34
35 The message is either queued (@p method == SendLater) or sent
36 immediately (@p method = SendImmediate). The default behaviour,
37 as selected with setSendImmediate(), can be overwritten with the
38 parameter @p method. The sender takes ownership of the given
39 message on success, so DO NOT DELETE OR MODIFY the message
40 further.
41
42 @return true on success.
43 */
44 [[nodiscard]] bool send(const KMime::Message::Ptr &msg, SendMethod method = SendDefault)
45 {
46 return doSend(msg, method);
47 }
48
49 /**
50 Start sending all queued messages.
51
52 FIXME: what does success mean here, if it's only _start_ sending?
53
54 Optionally a transport can be specified that will be used as the
55 default transport.
56
57 @return true on success.
58 */
59 [[nodiscard]] bool sendQueued(int transportId = -1)
60 {
61 return doSendQueued(transportId);
62 }
63
64protected:
65 [[nodiscard]] virtual bool doSend(const KMime::Message::Ptr &msg, short sendNow) = 0;
66 [[nodiscard]] virtual bool doSendQueued(int transportId) = 0;
67};
68
69inline MessageSender::~MessageSender() = default;
70}
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 Mon Nov 4 2024 16:33:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.