File indexing completed on 2025-02-16 04:55:53
0001 /* 0002 SPDX-FileCopyrightText: 2016-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "ksievecore_export.h" 0010 #include <QDebug> 0011 namespace KSieveCore 0012 { 0013 /** 0014 * @brief The SieveImapAccountSettings class 0015 * @author Laurent Montel <montel@kde.org> 0016 */ 0017 class KSIEVECORE_EXPORT SieveImapAccountSettings 0018 { 0019 public: 0020 // Keep sync with KIMAP settings. 0021 enum EncryptionMode { 0022 Unencrypted = 0, 0023 SSLorTLS, /*!< Use SSL/TLS encryption, KIMAP will automatically negotiate 0024 the best supported encryption protocol. */ 0025 STARTTLS /*!< Use STARTTLS to upgrade an initially plaintext connection to 0026 encrypted connection. KIMAP will automatically negotiate 0027 the best supported encryption protocol. */ 0028 }; 0029 0030 enum AuthenticationMode { ClearText = 0, Login, Plain, CramMD5, DigestMD5, NTLM, GSSAPI, Anonymous, XOAuth2 }; 0031 SieveImapAccountSettings(); 0032 0033 [[nodiscard]] QString identifier() const; 0034 0035 void setServerName(const QString &serverName); 0036 [[nodiscard]] QString serverName() const; 0037 0038 void setPort(int port); 0039 [[nodiscard]] int port() const; 0040 0041 void setUserName(const QString &userName); 0042 [[nodiscard]] QString userName() const; 0043 0044 void setPassword(const QString &password); 0045 [[nodiscard]] QString password() const; 0046 0047 void setAuthenticationType(KSieveCore::SieveImapAccountSettings::AuthenticationMode type); 0048 [[nodiscard]] AuthenticationMode authenticationType() const; 0049 [[nodiscard]] bool operator==(const SieveImapAccountSettings &other) const; 0050 0051 [[nodiscard]] bool isValid() const; 0052 0053 [[nodiscard]] SieveImapAccountSettings::EncryptionMode encryptionMode() const; 0054 void setEncryptionMode(EncryptionMode encryptionMode); 0055 0056 private: 0057 QString mServerName; 0058 QString mUserName; 0059 QString mPassword; 0060 SieveImapAccountSettings::AuthenticationMode mAuthenticationType = Plain; 0061 SieveImapAccountSettings::EncryptionMode mEncryptionMode = Unencrypted; 0062 int mPort = -1; 0063 }; 0064 } 0065 Q_DECLARE_METATYPE(KSieveCore::SieveImapAccountSettings) 0066 KSIEVECORE_EXPORT QDebug operator<<(QDebug d, const KSieveCore::SieveImapAccountSettings &settings);