QXmpp Version: 1.10.0
QXmppE2eeExtension.h
1// SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im>
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4
5#ifndef QXMPPE2EEEXTENSION_H
6#define QXMPPE2EEEXTENSION_H
7
8#include "QXmppError.h"
9#include "QXmppExtension.h"
10#include "QXmppSendResult.h"
11#include "QXmppSendStanzaParams.h"
12
13#include <memory>
14#include <optional>
15
16class QDomElement;
17class QXmppMessage;
18class QXmppIq;
19template<typename T>
20class QXmppTask;
21
22class QXmppE2eeExtension : public QXmppExtension
23{
24public:
25 struct NotEncrypted { };
26
27 using MessageEncryptResult = std::variant<std::unique_ptr<QXmppMessage>, QXmppError>;
28 using MessageDecryptResult = std::variant<QXmppMessage, NotEncrypted, QXmppError>;
29 using IqEncryptResult = std::variant<std::unique_ptr<QXmppIq>, QXmppError>;
30 using IqDecryptResult = std::variant<QDomElement, NotEncrypted, QXmppError>;
31
32 virtual QXmppTask<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) = 0;
34 virtual QXmppTask<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) = 0;
35 virtual QXmppTask<IqDecryptResult> decryptIq(const QDomElement &) = 0;
36 virtual bool isEncrypted(const QDomElement &) = 0;
37 virtual bool isEncrypted(const QXmppMessage &) = 0;
38};
39
40#endif // QXMPPE2EEEXTENSION_H
Definition: QXmppE2eeExtension.h:23
virtual bool isEncrypted(const QXmppMessage &)=0
virtual QXmppTask< IqEncryptResult > encryptIq(QXmppIq &&, const std::optional< QXmppSendStanzaParams > &)=0
std::variant< QXmppMessage, NotEncrypted, QXmppError > MessageDecryptResult
Definition: QXmppE2eeExtension.h:28
virtual bool isEncrypted(const QDomElement &)=0
virtual QXmppTask< IqDecryptResult > decryptIq(const QDomElement &)=0
std::variant< std::unique_ptr< QXmppIq >, QXmppError > IqEncryptResult
Definition: QXmppE2eeExtension.h:29
virtual QXmppTask< MessageDecryptResult > decryptMessage(QXmppMessage &&)=0
std::variant< std::unique_ptr< QXmppMessage >, QXmppError > MessageEncryptResult
Definition: QXmppE2eeExtension.h:27
virtual QXmppTask< MessageEncryptResult > encryptMessage(QXmppMessage &&, const std::optional< QXmppSendStanzaParams > &)=0
std::variant< QDomElement, NotEncrypted, QXmppError > IqDecryptResult
Definition: QXmppE2eeExtension.h:30
The QXmppIq class is the base class for all IQs.
Definition: QXmppIq.h:23
The QXmppMessage class represents an XMPP message.
Definition: QXmppMessage.h:64
Definition: QXmppTask.h:62
Definition: QXmppE2eeExtension.h:25
Definition: QXmppError.h:17