File indexing completed on 2024-05-12 16:25:55

0001 /*
0002    SPDX-FileCopyrightText: 2021-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 #pragma once
0007 
0008 #include "libruqola_private_export.h"
0009 #include "otr.h"
0010 #include <QObject>
0011 #include <QPointer>
0012 class RocketChatAccount;
0013 class LIBRUQOLACORE_TESTS_EXPORT OtrNotificationJob : public QObject
0014 {
0015     Q_OBJECT
0016 public:
0017     explicit OtrNotificationJob(QObject *parent = nullptr);
0018     ~OtrNotificationJob() override;
0019 
0020     [[nodiscard]] bool canStart() const;
0021 
0022     void start();
0023     [[nodiscard]] const Otr &otr() const;
0024     void setOtr(const Otr &newOtr);
0025 
0026     void setRocketChatAccount(RocketChatAccount *account);
0027 
0028 Q_SIGNALS:
0029     void acceptOtr(const Otr &t);
0030     void rejectOtr(const Otr &t);
0031     void acknowLedgeOtr(const Otr &t);
0032     void endOtr(const Otr &t);
0033 
0034 private:
0035     void slotAcceptOtr();
0036     void slotRejectOtr();
0037     [[nodiscard]] QString generateText();
0038     Otr mOtr;
0039     QPointer<RocketChatAccount> mRocketChatAccount;
0040 };