File indexing completed on 2024-05-12 05:21:35
0001 /* 0002 SPDX-FileCopyrightText: 2010 BetterInbox <contact@betterinbox.com> 0003 SPDX-FileContributor: Christophe Laveault <christophe@betterinbox.com> 0004 SPDX-FileContributor: Gregory Schlomoff <gregory.schlomoff@gmail.com> 0005 0006 SPDX-License-Identifier: LGPL-2.1-or-later 0007 */ 0008 0009 #pragma once 0010 0011 #include "ksmtp_export.h" 0012 0013 #include <KJob> 0014 0015 namespace KSmtp 0016 { 0017 class Session; 0018 class SessionPrivate; 0019 class JobPrivate; 0020 class ServerResponse; 0021 /** 0022 * @brief The Job class 0023 */ 0024 class KSMTP_EXPORT Job : public KJob 0025 { 0026 Q_OBJECT 0027 Q_DECLARE_PRIVATE(Job) 0028 0029 friend class SessionPrivate; 0030 0031 public: 0032 ~Job() override; 0033 0034 [[nodiscard]] Session *session() const; 0035 void start() override; 0036 0037 protected: 0038 void sendCommand(const QByteArray &cmd); 0039 virtual void doStart() = 0; 0040 virtual void handleResponse(const ServerResponse &response) = 0; 0041 void handleErrors(const ServerResponse &response); 0042 void connectionLost(); 0043 0044 explicit Job(Session *session); 0045 explicit Job(JobPrivate &dd); 0046 0047 std::unique_ptr<JobPrivate> const d_ptr; 0048 }; 0049 }