File indexing completed on 2025-02-02 05:08:35
0001 // SPDX-FileCopyrightText: 2010 Omat Holding B.V. <info@omat.nl> 0002 // SPDX-FileCopyrightText: 2014 Sandro Knauß <knauss@kolabsys.com> 0003 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0004 // SPDX-License-Identifier: LGPL-2.0-or-later 0005 0006 #pragma once 0007 0008 #include <KMime/HeaderParsing> 0009 #include <QDomElement> 0010 #include <QList> 0011 #include <QString> 0012 #include <optional> 0013 0014 enum SocketType { 0015 SSL = 0, ///< SSL socket, the most secure and the default 0016 StartTLS, 0017 None, 0018 }; 0019 0020 /// Ispdb uses custom authtyps, hence the enum here. 0021 /// @see https://wiki.mozilla.org/Thunderbird:Autoconfiguration:ConfigFileFormat 0022 /// In particular, note that Ispdb's Plain represents both Cleartext and AUTH Plain 0023 /// We will always treat it as Cleartext 0024 enum AuthType { 0025 Plain = 0, 0026 CramMD5, 0027 NTLM, 0028 GSSAPI, 0029 ClientIP, 0030 NoAuth, 0031 Basic, 0032 OAuth2, 0033 }; 0034 0035 struct Server { 0036 enum Type { 0037 IMAP, 0038 POP3, 0039 SMTP, 0040 }; 0041 Type type; 0042 QString hostname; 0043 int port = -1; 0044 QString username; 0045 SocketType socketType = SSL; 0046 AuthType authType = Plain; 0047 0048 [[nodiscard]] QStringList tags() const; 0049 0050 static std::optional<Server> fromDomElement(const QDomElement &element, const KMime::Types::AddrSpec &addrSpec); 0051 }; 0052 QDebug operator<<(QDebug d, const Server &t); 0053 Q_DECLARE_TYPEINFO(Server, Q_MOVABLE_TYPE); 0054 0055 struct EmailProvider { 0056 QStringList domains; 0057 QString displayName; 0058 QString shortDisplayName; 0059 0060 QList<Server> imapServers; 0061 QList<Server> popServers; 0062 QList<Server> smtpServers; 0063 }; 0064 QDebug operator<<(QDebug d, const EmailProvider &t); 0065 Q_DECLARE_TYPEINFO(EmailProvider, Q_MOVABLE_TYPE);