MailTransport

smtpjob.h
1/*
2 SPDX-FileCopyrightText: 2007 Volker Krause <vkrause@kde.org>
3
4 Based on KMail code by:
5 SPDX-FileCopyrightText: 1996-1998 Stefan Taferner <taferner@kde.org>
6
7 SPDX-License-Identifier: LGPL-2.0-or-later
8*/
9
10#pragma once
11
12#include "transportjob.h"
13#include <KSMTP/Session>
14
15#include <memory>
16
17namespace KIO
18{
19class Job;
20class Slave;
21}
22
23namespace KGAPI2
24{
25class AccountPromise;
26}
27
28class SmtpJobPrivate;
29
30namespace MailTransport
31{
32/**
33 Mail transport job for SMTP.
34 Internally, all jobs for a specific transport are queued to use the same
35 KIO::Slave. This avoids multiple simultaneous connections to the server,
36 which is not always allowed. Also, re-using an already existing connection
37 avoids the login overhead and can improve performance.
38
39 Precommands are automatically executed, once per opening a connection to the
40 server (not necessarily once per message).
41*/
42class SmtpJob : public TransportJob
43{
45public:
46 /**
47 Creates a SmtpJob.
48 @param transport The transport settings.
49 @param parent The parent object.
50 */
51 explicit SmtpJob(Transport *transport, QObject *parent = nullptr);
52
53 /**
54 Deletes this job.
55 */
56 ~SmtpJob() override;
57
58protected:
59 void doStart() override;
60 bool doKill() override;
61
62protected Q_SLOTS:
63 void slotResult(KJob *job) override;
64 void sessionStateChanged(KSmtp::Session::State state);
65
66private:
67 void startPasswordRetrieval(bool forceRefresh = false);
68 void onTokenRequestFinished(KGAPI2::AccountPromise *result);
69 void startSmtpJob();
70 void startLoginJob();
71 void startSendJob();
72
73private:
74 friend class ::SmtpJobPrivate;
75 std::unique_ptr<SmtpJobPrivate> const d;
76};
77} // namespace MailTransport
void result(KJob *job)
Mail transport job for SMTP.
Definition smtpjob.h:43
~SmtpJob() override
Deletes this job.
Definition smtpjob.cpp:92
SmtpJob(Transport *transport, QObject *parent=nullptr)
Creates a SmtpJob.
Definition smtpjob.cpp:79
void doStart() override
Do the actual work, implement in your subclass.
Definition smtpjob.cpp:105
Abstract base class for all mail transport jobs.
Transport * transport() const
Returns the Transport object containing the mail transport settings.
Represents the settings of a specific mail transport.
Definition transport.h:33
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
QObject * parent() const const
T qobject_cast(QObject *object)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:12:37 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.