File indexing completed on 2025-01-19 04:46:49

0001 /*
0002   SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include <MimeTreeParser/MessagePart>
0010 
0011 #include <QString>
0012 
0013 namespace MimeTreeParser
0014 {
0015 namespace Interface
0016 {
0017 class BodyPart;
0018 }
0019 }
0020 
0021 namespace KMime
0022 {
0023 class Content;
0024 }
0025 
0026 class GnuPGWKSMessagePart : public MimeTreeParser::MessagePart
0027 {
0028     Q_OBJECT
0029 public:
0030     enum ConfirmationType {
0031         UnknownType,
0032         ConfirmationRequest,
0033         ConfirmationResponse,
0034     };
0035 
0036     explicit GnuPGWKSMessagePart(MimeTreeParser::Interface::BodyPart *part);
0037 
0038     ~GnuPGWKSMessagePart() override = default;
0039 
0040     [[nodiscard]] ConfirmationType confirmationType() const;
0041     [[nodiscard]] QString sender() const;
0042     [[nodiscard]] QString address() const;
0043     [[nodiscard]] QString fingerprint() const;
0044     [[nodiscard]] QString nonce() const;
0045 
0046 protected:
0047     void parseContent(KMime::Content *node);
0048     [[nodiscard]] ConfirmationType stringToType(const QStringView &str);
0049     QString mSender;
0050     QString mAddress;
0051     QString mFingerprint;
0052     QString mNonce;
0053     ConfirmationType mType = UnknownType;
0054 };