Loading...
Searching...
No Matches
QXmppE2eeExtension.h
// SPDX-FileCopyrightText: 2021 Linus Jahn <lnj@kaidan.im>
//
// SPDX-License-Identifier: LGPL-2.1-or-later
#ifndef QXMPPE2EEEXTENSION_H
#define QXMPPE2EEEXTENSION_H
#include "QXmppError.h"
#include "QXmppExtension.h"
#include "QXmppSendResult.h"
#include "QXmppSendStanzaParams.h"
#include <memory>
#include <optional>
class QDomElement;
class QXmppMessage;
class QXmppIq;
template<typename T>
class QXmppTask;
class QXmppE2eeExtension : public QXmppExtension
{
public:
struct NotEncrypted
{
};
using MessageEncryptResult = std::variant<std::unique_ptr<QXmppMessage>, QXmppError>;
using MessageDecryptResult = std::variant<QXmppMessage, NotEncrypted, QXmppError>;
using IqEncryptResult = std::variant<std::unique_ptr<QXmppIq>, QXmppError>;
using IqDecryptResult = std::variant<QDomElement, NotEncrypted, QXmppError>;
virtual QXmppTask<MessageEncryptResult> encryptMessage(QXmppMessage &&, const std::optional<QXmppSendStanzaParams> &) = 0;
virtual QXmppTask<MessageDecryptResult> decryptMessage(QXmppMessage &&) = 0;
virtual QXmppTask<IqEncryptResult> encryptIq(QXmppIq &&, const std::optional<QXmppSendStanzaParams> &) = 0;
virtual QXmppTask<IqDecryptResult> decryptIq(const QDomElement &) = 0;
virtual bool isEncrypted(const QDomElement &) = 0;
virtual bool isEncrypted(const QXmppMessage &) = 0;
};
#endif // QXMPPE2EEEXTENSION_H
QXmppE2eeExtension
Definition QXmppE2eeExtension.h:23
QXmppE2eeExtension::isEncrypted
virtual bool isEncrypted(const QXmppMessage &)=0
QXmppE2eeExtension::encryptIq
virtual QXmppTask< IqEncryptResult > encryptIq(QXmppIq &&, const std::optional< QXmppSendStanzaParams > &)=0
QXmppE2eeExtension::MessageDecryptResult
std::variant< QXmppMessage, NotEncrypted, QXmppError > MessageDecryptResult
Definition QXmppE2eeExtension.h:30
QXmppE2eeExtension::isEncrypted
virtual bool isEncrypted(const QDomElement &)=0
QXmppE2eeExtension::decryptIq
virtual QXmppTask< IqDecryptResult > decryptIq(const QDomElement &)=0
QXmppE2eeExtension::IqEncryptResult
std::variant< std::unique_ptr< QXmppIq >, QXmppError > IqEncryptResult
Definition QXmppE2eeExtension.h:31
QXmppE2eeExtension::decryptMessage
virtual QXmppTask< MessageDecryptResult > decryptMessage(QXmppMessage &&)=0
QXmppE2eeExtension::MessageEncryptResult
std::variant< std::unique_ptr< QXmppMessage >, QXmppError > MessageEncryptResult
Definition QXmppE2eeExtension.h:29
QXmppE2eeExtension::encryptMessage
virtual QXmppTask< MessageEncryptResult > encryptMessage(QXmppMessage &&, const std::optional< QXmppSendStanzaParams > &)=0
QXmppE2eeExtension::IqDecryptResult
std::variant< QDomElement, NotEncrypted, QXmppError > IqDecryptResult
Definition QXmppE2eeExtension.h:32
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:35
QXmppTask
Definition QXmppTask.h:62
QXmppE2eeExtension::NotEncrypted
Definition QXmppE2eeExtension.h:26
QXmppError
Definition QXmppError.h:18