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/KMimeMessage>
13 namespace MessageComposer
14 {
15 class MessageSender
16 {
17 protected:
18  virtual ~MessageSender() = 0;
19 
20 public:
21  enum SendMethod { SendDefault = -1, SendImmediate = true, SendLater = false };
22  enum SaveIn {
23  SaveInNone,
24  SaveInDrafts,
25  SaveInTemplates,
26  SaveInOutbox,
27  };
28  /**
29  Send given message.
30 
31  The message is either queued (@p method == SendLater) or sent
32  immediately (@p method = SendImmediate). The default behaviour,
33  as selected with setSendImmediate(), can be overwritten with the
34  parameter @p method. The sender takes ownership of the given
35  message on success, so DO NOT DELETE OR MODIFY the message
36  further.
37 
38  @return true on success.
39  */
40  Q_REQUIRED_RESULT bool send(const KMime::Message::Ptr &msg, SendMethod method = SendDefault)
41  {
42  return doSend(msg, method);
43  }
44 
45  /**
46  Start sending all queued messages.
47 
48  FIXME: what does success mean here, if it's only _start_ sending?
49 
50  Optionally a transport can be specified that will be used as the
51  default transport.
52 
53  @return true on success.
54  */
55  Q_REQUIRED_RESULT bool sendQueued(int transportId = -1)
56  {
57  return doSendQueued(transportId);
58  }
59 
60 protected:
61  Q_REQUIRED_RESULT virtual bool doSend(const KMime::Message::Ptr &msg, short sendNow) = 0;
62  Q_REQUIRED_RESULT virtual bool doSendQueued(int transportId) = 0;
63 };
64 
65 inline MessageSender::~MessageSender() = default;
66 }
67 
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-2021 The KDE developers.
Generated on Mon Dec 6 2021 23:04:57 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.