From bb8780ecdbfe7eddb8280e696871e71b744d0bff Mon Sep 17 00:00:00 2001 From: Melvin Keskin Date: Sat, 28 Aug 2021 14:39:02 +0200 Subject: Add QXmppAtmManager --- src/client/QXmppAtmManager.h | 68 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/client/QXmppAtmManager.h (limited to 'src/client/QXmppAtmManager.h') diff --git a/src/client/QXmppAtmManager.h b/src/client/QXmppAtmManager.h new file mode 100644 index 00000000..2df2dfce --- /dev/null +++ b/src/client/QXmppAtmManager.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2008-2021 The QXmpp developers + * + * Author: + * Melvin Keskin + * + * Source: + * https://github.com/qxmpp-project/qxmpp + * + * This file is a part of QXmpp library. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + */ + +#ifndef QXMPPATMMANAGER_H +#define QXMPPATMMANAGER_H + +#include "QXmppClientExtension.h" +#include "QXmppMessage.h" +#include "QXmppSendResult.h" +#include "QXmppTrustMessageKeyOwner.h" +#include "QXmppTrustStorage.h" + +class QXMPP_EXPORT QXmppAtmManager : public QXmppClientExtension +{ + Q_OBJECT + +public: + QXmppAtmManager(QXmppTrustStorage *trustStorage); + QFuture makeTrustDecisions(const QString &encryption, const QString &keyOwnerJid, const QList &keyIdsForAuthentication, const QList &keyIdsForDistrusting = {}); + + /// \cond + bool handleStanza(const QDomElement &stanza) override; + +protected: + void setClient(QXmppClient *client) override; + +private slots: + void handleMessageReceived(const QXmppMessage &message); + /// \endcond + +private: + QFuture makeTrustDecisions(const QString &encryption, const QMultiHash &keyIdsForAuthentication, const QMultiHash &keyIdsForDistrusting); + QFuture handleMessage(const QXmppMessage &message); + + QFuture authenticate(const QString &encryption, const QMultiHash &keyIds); + QFuture distrust(const QString &encryption, const QMultiHash &keyIds); + + QFuture distrustAutomaticallyTrustedKeys(const QString &encryption, const QList &keyOwnerJids); + QFuture makePostponedTrustDecisions(const QString &encryption, const QList &senderKeyIds); + + QFuture sendTrustMessage(const QString &encryption, const QList &keyOwners, const QString &recipientJid); + + QXmppTrustStorage *m_trustStorage; + + friend class tst_QXmppAtmManager; +}; + +#endif // QXMPPATMMANAGER_H -- cgit v1.2.3