File indexing completed on 2024-12-08 10:25:50
0001 /* 0002 0003 * SPDX-FileCopyrightText: 2016 Riccardo Iaconelli <riccardo@kde.org> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 * 0007 */ 0008 0009 #pragma once 0010 0011 #include <QObject> 0012 class RocketChatAccount; 0013 class MessageQueue : public QObject 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit MessageQueue(RocketChatAccount *account, QObject *parent = nullptr); 0018 ~MessageQueue() override; 0019 0020 /** 0021 * @brief Retry to send unsent messages in DDPClient's abstract message queue 0022 */ 0023 void processQueue(); 0024 0025 /** 0026 * @brief Constructs QPair<QString,QJsonDocument> object from QJsonObject 0027 * 0028 * @param object The Json containing message attributes 0029 * @return QPair<QString,QJsonDocument>, The pair containing the method and params 0030 */ 0031 [[nodiscard]] static QPair<QString, QJsonDocument> fromJson(const QJsonObject &object); 0032 0033 /** 0034 * @brief Constructs QBytearray from QPair<QString,QJsonDocument> object 0035 * 0036 * @param pair The pair containing method and params 0037 * @return QByteArray, The Json containing message attributes 0038 */ 0039 [[nodiscard]] static QByteArray serialize(const QPair<QString, QJsonDocument> &pair); 0040 0041 void loadCache(); 0042 0043 private: 0044 void onLoginStatusChanged(); 0045 RocketChatAccount *const mRocketChatAccount; 0046 };