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 "job.h"
0014 
0015 namespace KSmtp
0016 {
0017 class LoginJobPrivate;
0018 /**
0019  * @brief The LoginJob class
0020  */
0021 class KSMTP_EXPORT LoginJob : public Job
0022 {
0023     Q_OBJECT
0024     Q_DECLARE_PRIVATE(LoginJob)
0025 
0026 public:
0027     enum AuthMode { UnknownAuth, Plain, Login, CramMD5, DigestMD5, NTLM, GSSAPI, Anonymous, XOAuth2 };
0028 
0029     enum LoginError { TokenExpired = KJob::UserDefinedError + 1 };
0030 
0031     explicit LoginJob(Session *session);
0032     ~LoginJob() override;
0033 
0034     void setUserName(const QString &userName);
0035     void setPassword(const QString &password);
0036 
0037     void setPreferedAuthMode(AuthMode mode);
0038     [[nodiscard]] AuthMode usedAuthMode() const;
0039 
0040 protected:
0041     void doStart() override;
0042     void handleResponse(const ServerResponse &r) override;
0043 };
0044 }