QXmpp: QXmppE2eeExtension.h Source File

QXmpp Version: 1.14.2

Loading...
Searching...
No Matches
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
22 class 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;
33 virtual QXmppTask<MessageDecryptResult> decryptMessage(QXmppMessage &&) = 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
QXmppE2eeExtension
Definition QXmppE2eeExtension.h:23
QXmppE2eeExtension::isEncrypted
virtual bool isEncrypted(const QXmppMessage &)=0
QXmppE2eeExtension::isEncrypted
virtual bool isEncrypted(const QDomElement &)=0
QXmppE2eeExtension::encryptIq
virtual QXmppTask< IqEncryptResult > encryptIq(QXmppIq &&, const std::optional< QXmppSendStanzaParams > &)=0
QXmppE2eeExtension::decryptIq
virtual QXmppTask< IqDecryptResult > decryptIq(const QDomElement &)=0
QXmppE2eeExtension::MessageEncryptResult
std::variant< std::unique_ptr< QXmppMessage >, QXmppError > MessageEncryptResult
Definition QXmppE2eeExtension.h:27
QXmppE2eeExtension::IqEncryptResult
std::variant< std::unique_ptr< QXmppIq >, QXmppError > IqEncryptResult
Definition QXmppE2eeExtension.h:29
QXmppE2eeExtension::IqDecryptResult
std::variant< QDomElement, NotEncrypted, QXmppError > IqDecryptResult
Definition QXmppE2eeExtension.h:30
QXmppE2eeExtension::encryptMessage
virtual QXmppTask< MessageEncryptResult > encryptMessage(QXmppMessage &&, const std::optional< QXmppSendStanzaParams > &)=0
QXmppE2eeExtension::MessageDecryptResult
std::variant< QXmppMessage, NotEncrypted, QXmppError > MessageDecryptResult
Definition QXmppE2eeExtension.h:28
QXmppE2eeExtension::decryptMessage
virtual QXmppTask< MessageDecryptResult > decryptMessage(QXmppMessage &&)=0
QXmppIq
The QXmppIq class is the base class for all IQs.
Definition QXmppIq.h:23
QXmppMessage
The QXmppMessage class represents an XMPP message.
Definition QXmppMessage.h:64
QXmppTask
Definition QXmppTask.h:46
QXmppE2eeExtension::NotEncrypted
Definition QXmppE2eeExtension.h:25
QXmppError
Definition QXmppError.h:17