File indexing completed on 2024-10-06 04:34:12
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 #include "libruqola_private_export.h" 0009 #include <QObject> 0010 class RocketChatAccount; 0011 class MessagesModel; 0012 class LIBRUQOLACORE_TESTS_EXPORT ManageLocalDatabase : public QObject 0013 { 0014 Q_OBJECT 0015 public: 0016 struct ManageLoadHistoryInfo { 0017 MessagesModel *roomModel = nullptr; 0018 QString roomName; 0019 QString roomId; 0020 bool initial = false; 0021 qint64 timeStamp = -1; 0022 qint64 lastSeenAt = -1; 0023 }; 0024 0025 explicit ManageLocalDatabase(RocketChatAccount *account, QObject *parent = nullptr); 0026 ~ManageLocalDatabase() override; 0027 0028 void loadMessagesHistory(const ManageLocalDatabase::ManageLoadHistoryInfo &info); 0029 0030 void loadAccountSettings(); 0031 0032 private: 0033 void syncMessage(const QString &roomId, qint64 lastSeenAt); 0034 void slotSyncMessages(const QJsonObject &obj, const QString &roomId); 0035 RocketChatAccount *const mRocketChatAccount; 0036 }; 0037 Q_DECLARE_TYPEINFO(ManageLocalDatabase::ManageLoadHistoryInfo, Q_RELOCATABLE_TYPE); 0038 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const ManageLocalDatabase::ManageLoadHistoryInfo &t);