File indexing completed on 2024-12-08 10:25:52

0001 /*
0002    SPDX-FileCopyrightText: 2017-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "authenticationinfo.h"
0010 #include "bannerinfo/bannerinfos.h"
0011 #include "channelgroupbasejob.h"
0012 #include "commands/runcommandjob.h"
0013 #include "createchannelteaminfo.h"
0014 #include "custom/customuserstatuscreatejob.h"
0015 #include "custom/customuserstatusupdatejob.h"
0016 #include "customusers/customuserstatuses.h"
0017 #include "ddpapi/ddpauthenticationmanager.h"
0018 #include "ddpapi/ddpclient.h"
0019 #include "inputtextmanager.h"
0020 #include "libruqolacore_export.h"
0021 #include "licenses/licensesmanager.h"
0022 #include "messages/message.h"
0023 #include "model/listmessagesmodel.h"
0024 #include "model/roommodel.h"
0025 #include "notificationinfo.h"
0026 #include "ownuser/ownuser.h"
0027 #include "ownuser/ownuserpreferences.h"
0028 #include "parsemessageurlutils.h"
0029 #include "permissions/permissionmanager.h"
0030 #include "rocketchataccountsettings.h"
0031 #include "roles/rolesmanager.h"
0032 #include "room.h"
0033 #include "rooms/roomscleanhistoryjob.h"
0034 #include "rooms/roomsexportjob.h"
0035 #include "ruqolaserverconfig.h"
0036 #include "serverconfiginfo.h"
0037 #include "users/registeruserjob.h"
0038 #include "users/userssetpreferencesjob.h"
0039 #include "users/usersupdateownbasicinfojob.h"
0040 #include "utils.h"
0041 #include <QObject>
0042 #include <QUrl>
0043 #include <TextEmoticonsCore/CustomEmoji>
0044 class TypingNotification;
0045 class UsersModel;
0046 class RoomModel;
0047 class MessagesModel;
0048 class DDPClient;
0049 class MessageQueue;
0050 class RocketChatBackend;
0051 class RuqolaLogger;
0052 class RuqolaServerConfig;
0053 class UserCompleterModel;
0054 class UserCompleterFilterProxyModel;
0055 class StatusModel;
0056 class RocketChatCache;
0057 class EmojiManager;
0058 class OtrManager;
0059 class FilesForRoomFilterProxyModel;
0060 class FilesForRoomModel;
0061 class InputTextManager;
0062 class PluginAuthenticationInterface;
0063 class Room;
0064 class CommonMessagesModel;
0065 class CommonMessageFilterProxyModel;
0066 class ReceiveTypingNotificationManager;
0067 class EmoticonModel;
0068 class DiscussionsFilterProxyModel;
0069 class DiscussionsModel;
0070 class ThreadMessageModel;
0071 class ListMessagesModel;
0072 class ListMessagesFilterProxyModel;
0073 class AutotranslateLanguagesModel;
0074 class CommandsModel;
0075 class DownloadAppsLanguagesManager;
0076 class UsersForRoomModel;
0077 class MessageCache;
0078 class ManageChannels;
0079 class CustomSoundsManager;
0080 class AwayManager;
0081 class SwitchChannelHistoryModel;
0082 class UploadFileManager;
0083 class VideoConferenceManager;
0084 class VideoConferenceMessageInfoManager;
0085 class LocalDatabaseManager;
0086 class ManageLocalDatabase;
0087 class AccountRoomSettings;
0088 class PreviewUrlCacheManager;
0089 
0090 namespace RocketChatRestApi
0091 {
0092 class Connection;
0093 }
0094 
0095 class LIBRUQOLACORE_EXPORT RocketChatAccount : public QObject
0096 {
0097     Q_OBJECT
0098 public:
0099     explicit RocketChatAccount(const QString &accountName = QString(), QObject *parent = nullptr);
0100     ~RocketChatAccount() override;
0101 
0102     enum ChannelTypeInfo {
0103         RoomId,
0104         RoomName,
0105     };
0106     Q_ENUM(ChannelTypeInfo)
0107 
0108     enum RoomInfoType {
0109         Announcement,
0110         Description,
0111         Name,
0112         Topic,
0113         ReadOnly,
0114         Archive,
0115         RoomType,
0116         Encrypted,
0117         Password,
0118     };
0119     Q_ENUM(RoomInfoType)
0120 
0121     enum NotificationOptionsType {
0122         DisableNotifications,
0123         HideUnreadStatus,
0124         DesktopNotifications,
0125         DesktopDurationNotifications,
0126         DesktopSoundNotifications,
0127         EmailNotifications,
0128         MobilePushNotifications,
0129         UnreadAlert,
0130         MuteGroupMentions,
0131         HideMentionStatus,
0132     };
0133 
0134     Q_ENUM(NotificationOptionsType)
0135 
0136     enum RoleType {
0137         AddOwner,
0138         AddLeader,
0139         AddModerator,
0140         RemoveOwner,
0141         RemoveLeader,
0142         RemoveModerator,
0143     };
0144     Q_ENUM(RoleType)
0145 
0146     [[nodiscard]] QList<TextEmoticonsCore::CustomEmoji> customEmojies() const;
0147 
0148     void reconnectToServer();
0149     [[nodiscard]] Room::TeamRoomInfo roomFromTeamId(const QString &teamId) const;
0150 
0151     [[nodiscard]] QString getUserCurrentMessage(const QString &roomId);
0152     void setUserCurrentMessage(const QString &message, const QString &roomId);
0153     void textEditing(const QString &roomId, bool clearNotification);
0154     void leaveRoom(const QString &identifier, Room::RoomType channelType);
0155     void hideRoom(const QString &roomId, Room::RoomType channelType);
0156     void tryLogin();
0157     void logOut();
0158     void clearAllUnreadMessages();
0159     void markRoomAsRead(const QString &roomId);
0160     void changeFavorite(const QString &roomId, bool checked);
0161     void sendMessage(const QString &roomID, const QString &message);
0162     void updateMessage(const QString &roomID, const QString &messageId, const QString &message);
0163     void replyOnThread(const QString &roomID, const QString &threadMessageId, const QString &message);
0164     void openChannel(const QString &identifier, RocketChatAccount::ChannelTypeInfo typeInfo);
0165     void joinJitsiConfCall(const QString &roomId);
0166     void createNewChannel(const RocketChatRestApi::CreateChannelTeamInfo &info);
0167     void joinRoom(const QString &roomId, const QString &joinCode = QString());
0168     void openDirectChannel(const QString &username);
0169     void setDefaultStatus(User::PresenceStatus status, const QString &messageStatus); // Move to private no ?
0170     void createJitsiConfCall(const QString &roomId);
0171     void deleteMessage(const QString &messageId, const QString &roomId);
0172     void userAutocomplete(const QString &searchText, const QString &exception);
0173     void eraseRoom(const QString &roomId, Room::RoomType channelType);
0174     void changeNotificationsSettings(const QString &roomId, RocketChatAccount::NotificationOptionsType notificationsType, const QVariant &newValue);
0175     void downloadFile(const QString &downloadFileUrl, const QUrl &localFile);
0176     void starMessage(const QString &messageId, bool starred);
0177     void pinMessage(const QString &messageId, bool pinned);
0178     [[nodiscard]] QString avatarUrl(const Utils::AvatarInfo &info);
0179     [[nodiscard]] QUrl attachmentUrlFromLocalCache(const QString &url);
0180     void loadHistory(const QString &roomID, bool initial = false, qint64 timeStamp = 0);
0181 
0182     void roomFiles(const QString &roomId, Room::RoomType channelType = Room::RoomType::Unknown);
0183     void addUserToRoom(const QString &username, const QString &roomId, Room::RoomType channelType);
0184     void changeDefaultAuthentication(int index);
0185     void messageSearch(const QString &pattern, const QString &rid, bool userRegularExpression = false);
0186     [[nodiscard]] InputTextManager *inputTextManager() const;
0187 
0188     [[nodiscard]] InputTextManager *inputThreadMessageTextManager() const;
0189 
0190     [[nodiscard]] QVector<Permission> permissions() const;
0191 
0192     void blockUser(const QString &userId, bool block);
0193     void deleteFileMessage(const QString &roomId, const QString &fileId, Room::RoomType channelType);
0194     void openDocumentation();
0195     void clearSearchModel();
0196     void reactOnMessage(const QString &messageId, const QString &emoji, bool shouldReact);
0197     void ignoreUser(const QString &rid, const QString &userId, bool ignore);
0198     void channelInfo(const QString &roomId);
0199     void groupInfo(const QString &roomId);
0200     void switchEditingMode(bool b);
0201     void setSortUnreadOnTop(bool b);
0202     void setRoomListSortOrder(OwnUserPreferences::RoomListSortOrder roomListSortOrder);
0203     void kickUser(const QString &rid, const QString &userId, Room::RoomType channelType);
0204     void changeRoles(const QString &rid, const QString &userId, Room::RoomType channelType, RocketChatAccount::RoleType roleType);
0205     void rolesInRoom(const QString &roomId, Room::RoomType channelType);
0206     void switchingToRoom(const QString &roomID);
0207     void reportMessage(const QString &messageId, const QString &message);
0208     void getThreadMessages(const QString &threadMessageId, const Message &message);
0209     void createDiscussion(const QString &parentRoomName,
0210                           const QString &discussionName,
0211                           const QString &replyMessage,
0212                           const QString &messageId,
0213                           const QStringList &users = QStringList());
0214     void threadsInRoom(const QString &roomId, bool onlyUnread);
0215     void discussionsInRoom(const QString &roomId);
0216     void followMessage(const QString &messageId, bool follow);
0217     void loadMoreFileAttachments(const QString &roomId, Room::RoomType channelType);
0218     void loadMoreDiscussions(const QString &roomId);
0219     void loadThreadMessagesHistory(const QString &roomId);
0220     void loadMoreUsersInRoom(const QString &roomId, Room::RoomType channelType);
0221 
0222     void getPinnedMessages(const QString &roomId);
0223     void getStarredMessages(const QString &roomId);
0224     void getMentionsMessages(const QString &roomId);
0225 
0226     void autoTranslateSaveLanguageSettings(const QString &roomId, const QString &language);
0227     void autoTranslateSaveAutoTranslateSettings(const QString &roomId, bool autoTranslate);
0228 
0229     [[nodiscard]] MessagesModel *messageModelForRoom(const QString &roomID);
0230     void changeShowOriginalMessage(const QString &roomId, const QString &messageId, bool showOriginal);
0231 
0232     void loadMoreListMessages(const QString &roomId);
0233     void getListMessages(const QString &roomId, ListMessagesModel::ListMessageType type);
0234 
0235     [[nodiscard]] QUrl urlForLink(const QString &link) const;
0236     void setUserStatusChanged(const QJsonArray &array);
0237 
0238     void setShowRoomAvatar(bool checked);
0239 
0240     CommonMessageFilterProxyModel *searchMessageFilterProxyModel() const;
0241     FilesForRoomFilterProxyModel *filesForRoomFilterProxyModel() const;
0242     ReceiveTypingNotificationManager *receiveTypingNotificationManager() const;
0243     UserCompleterFilterProxyModel *userCompleterFilterProxyModel() const;
0244 
0245     UsersModel *usersModel() const;
0246     MessagesModel *threadMessageModel() const;
0247     EmoticonModel *emoticonModel() const;
0248     CommandsModel *commandsModel() const;
0249     AutotranslateLanguagesModel *autoTranslateLanguagesModel() const;
0250     DiscussionsFilterProxyModel *discussionsFilterProxyModel() const;
0251     UserCompleterModel *userCompleterModel() const;
0252     RocketChatAccountSettings *settings() const;
0253 
0254     LocalDatabaseManager *localDatabaseManager() const;
0255 
0256     DDPClient *ddp();
0257     [[nodiscard]] RoomModel *roomModel() const;
0258     [[nodiscard]] bool editingMode() const;
0259     [[nodiscard]] bool sortUnreadOnTop() const;
0260     [[nodiscard]] OwnUserPreferences::RoomListSortOrder roomListSortOrder() const;
0261 
0262     [[nodiscard]] DDPAuthenticationManager::LoginStatus loginStatus();
0263     RocketChatRestApi::Connection *restApi();
0264 
0265     [[nodiscard]] Room *room(const QString &roomId);
0266 
0267     // Make it private in future
0268     void slotInformTypingStatus(const QString &room, bool typing);
0269 
0270     [[nodiscard]] MessageQueue *messageQueue() const;
0271 
0272     [[nodiscard]] RocketChatBackend *rocketChatBackend() const;
0273 
0274     [[nodiscard]] RuqolaLogger *ruqolaLogger() const;
0275 
0276     void parsePublicSettings(const QJsonObject &obj, bool update);
0277 
0278     [[nodiscard]] RuqolaServerConfig *ruqolaServerConfig() const;
0279 
0280     void setUserName(const QString &username);
0281     [[nodiscard]] QString userName() const;
0282 
0283     void setAccountName(const QString &accountname);
0284     [[nodiscard]] QString accountName() const;
0285 
0286     void setUserId(const QString &userID);
0287     [[nodiscard]] QString userId() const;
0288 
0289     void setPassword(const QString &password);
0290     [[nodiscard]] QString password() const;
0291 
0292     void setTwoFactorAuthenticationCode(const QString &twoFactorAuthenticationCode);
0293     [[nodiscard]] QString twoFactorAuthenticationCode() const;
0294 
0295     void setAuthToken(const QString &token);
0296     [[nodiscard]] QString authToken() const;
0297 
0298     void setServerUrl(const QString &serverUrl);
0299 
0300     void sendNotification(const QJsonArray &contents);
0301     void parseOtr(const QJsonArray &contents);
0302 
0303     void setServerVersion(const QString &version);
0304     [[nodiscard]] QString serverVersion() const;
0305 
0306     [[nodiscard]] bool needAdaptNewSubscriptionRC60() const;
0307     [[nodiscard]] EmojiManager *emojiManager() const;
0308     [[nodiscard]] QString userStatusIconFileName(const QString &id);
0309 
0310     void membersInRoom(const QString &roomId, Room::RoomType channelType);
0311     void parseUsersForRooms(const QJsonObject &obj, const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0312 
0313     void insertCompleterUsers();
0314 
0315     PluginAuthenticationInterface *defaultAuthenticationInterface() const;
0316 
0317     [[nodiscard]] CommonMessagesModel *searchMessageModel() const;
0318 
0319     void updateUser(const QJsonObject &object);
0320 
0321     void removeSettings();
0322 
0323     void rolesChanged(const QJsonArray &contents);
0324 
0325     [[nodiscard]] FilesForRoomModel *filesModelForRoom() const;
0326 
0327     [[nodiscard]] DiscussionsModel *discussionsModel() const;
0328 
0329     void updateThreadMessageList(const Message &m);
0330 
0331     void initializeAccount();
0332     [[nodiscard]] bool allowEditingMessages() const;
0333     [[nodiscard]] bool isMessageEditable(const Message &message) const;
0334 
0335     [[nodiscard]] bool otrEnabled() const;
0336 
0337     [[nodiscard]] ListMessagesModel *listMessageModel() const;
0338     [[nodiscard]] ListMessagesFilterProxyModel *listMessagesFilterProxyModel() const;
0339     [[nodiscard]] ServerConfigInfo *serverConfigInfo() const;
0340     [[nodiscard]] QString serverUrl() const;
0341     [[nodiscard]] StatusModel *statusModel() const;
0342 
0343     void customUsersStatus();
0344 
0345     [[nodiscard]] bool jitsiEnabled() const;
0346     [[nodiscard]] bool allowMessagePinningEnabled() const;
0347     [[nodiscard]] bool allowMessageStarringEnabled() const;
0348     [[nodiscard]] bool allowMessageDeletingEnabled() const;
0349 
0350     [[nodiscard]] bool autoTranslateEnabled() const;
0351     [[nodiscard]] bool threadsEnabled() const;
0352 
0353     [[nodiscard]] bool discussionEnabled() const;
0354     [[nodiscard]] QString recordingVideoPath() const;
0355     [[nodiscard]] QString recordingImagePath() const;
0356 
0357     [[nodiscard]] User fullUserInfo(const QString &userName) const;
0358 
0359     void setAccountEnabled(bool enabled);
0360     [[nodiscard]] bool accountEnabled() const;
0361 
0362     void insertAvatarUrl(const QString &userId, const QUrl &url);
0363 
0364     [[nodiscard]] AccountRoomSettings *accountRoomSettings() const;
0365 
0366     [[nodiscard]] bool isMessageDeletable(const Message &message) const;
0367     void joinDiscussion(const QString &roomId, const QString &joinCode);
0368     void setNameChanged(const QJsonArray &array);
0369     void setOwnStatus(const User &user);
0370     [[nodiscard]] User::PresenceStatus presenceStatus() const;
0371 
0372     void getListCommands();
0373     [[nodiscard]] bool runCommand(const QString &msg, const QString &roomId, const QString &tmid = QString());
0374 
0375     void avatarChanged(const QJsonArray &contents);
0376     void markMessageAsUnReadFrom(const QString &messageId);
0377     void markRoomAsUnRead(const QString &roomId);
0378     void sendUserEmailCode();
0379     void requestNewPassword(const QString &email);
0380     [[nodiscard]] bool allowDeleteOwnAccount() const;
0381     [[nodiscard]] bool registrationFormEnabled() const;
0382     void registerNewUser(const RocketChatRestApi::RegisterUserJob::RegisterUserInfo &userInfo);
0383     void deleteOwnAccount(const QString &password);
0384 
0385     [[nodiscard]] bool allowEmailChange() const;
0386 
0387     [[nodiscard]] bool allowPasswordChange() const;
0388 
0389     [[nodiscard]] bool allowUsernameChange() const;
0390 
0391     void updateOwnBasicInfo(const RocketChatRestApi::UsersUpdateOwnBasicInfoJob::UpdateOwnBasicInfo &info);
0392     [[nodiscard]] RuqolaServerConfig::ServerConfigFeatureTypes serverConfigFeatureTypes() const;
0393     void parseOwnInfoDone(const QJsonObject &replyObject);
0394     [[nodiscard]] OwnUser ownUser() const;
0395 
0396     void cleanChannelHistory(const RocketChatRestApi::RoomsCleanHistoryJob::CleanHistoryInfo &info);
0397 
0398     [[nodiscard]] bool broadCastEnabled() const;
0399     [[nodiscard]] bool encryptionEnabled() const;
0400     [[nodiscard]] bool uploadFileEnabled() const;
0401     [[nodiscard]] bool isAdministrator() const;
0402     [[nodiscard]] bool allowProfileChange() const;
0403     [[nodiscard]] bool allowAvatarChanged() const;
0404 
0405     [[nodiscard]] bool audioRecorderEnabled() const;
0406     [[nodiscard]] bool videoRecorderEnabled() const;
0407 
0408     void enable2FaEmailJob(bool enable);
0409     void logoutFromOtherLocation();
0410     void createDirectMessages(const QStringList &usernames);
0411     void setDisplayName(const QString &displayName);
0412     [[nodiscard]] QString displayName() const;
0413 
0414     void deleteCustomUserStatus(const QJsonArray &replyArray);
0415 
0416     void updateCustomUserStatus(const QJsonArray &replyArray);
0417     [[nodiscard]] CustomUserStatuses customUserStatuses() const;
0418 
0419     void removeCustomUserStatus(const QString &customUserStatusId);
0420     void updateCustomUserStatus(const RocketChatRestApi::CustomUserStatusUpdateJob::StatusUpdateInfo &statusUpdateInfo);
0421     void createCustomUserStatus(const RocketChatRestApi::CustomUserStatusCreateJob::StatusCreateInfo &statusCreateInfo);
0422     void addMessage(const QJsonObject &replyObject, bool useRestApi = false, bool temporaryMessage = false);
0423     [[nodiscard]] QStringList highlightWords() const;
0424     void resetAvatar();
0425     void setAvatarUrl(const QString &url);
0426     void exportMessages(const RocketChatRestApi::RoomsExportJob::RoomsExportInfo &info);
0427     [[nodiscard]] bool hasPermission(const QString &permissionId) const;
0428     [[nodiscard]] QStringList permissions(const QString &permissionId) const;
0429     void setUserPreferences(const RocketChatRestApi::UsersSetPreferencesJob::UsersSetPreferencesInfo &info);
0430     [[nodiscard]] QStringList ownUserPermission() const;
0431     void downloadAppsLanguages();
0432     [[nodiscard]] bool hasAutotranslateSupport() const;
0433     [[nodiscard]] OwnUserPreferences ownUserPreferences() const;
0434     [[nodiscard]] bool ldapEnabled() const;
0435     UsersForRoomModel *usersModelForRoom(const QString &roomId) const;
0436 
0437     void deleteUser(const QJsonArray &replyArray);
0438     MessageCache *messageCache() const;
0439 
0440     [[nodiscard]] bool hideRoles() const;
0441     [[nodiscard]] bool displayAvatars() const;
0442     [[nodiscard]] bool teamEnabled() const;
0443     void openPrivateGroup(const QString &identifier, ChannelTypeInfo typeInfo);
0444 
0445     void deleteEmojiCustom(const QJsonArray &replyArray);
0446     void addUpdateEmojiCustomList(const QJsonArray &replyArray);
0447     void setImageUrl(const QUrl &url);
0448     void updateAvatarCache(const Utils::AvatarInfo &info);
0449     [[nodiscard]] bool userIsOffline(const QString &name);
0450     [[nodiscard]] QString userStatusStr(const QString &name);
0451     [[nodiscard]] OtrManager *otrManager() const;
0452 
0453     // Custom Sound
0454     void deleteCustomSound(const QJsonArray &replyArray);
0455     void updateCustomSound(const QJsonArray &replyArray);
0456 
0457     // stdout info
0458     void addStdoutInfo(const QJsonArray &contents);
0459 
0460     // Roles
0461     void updateRoles(const QJsonArray &contents);
0462 
0463     // Permissions
0464     void permissionUpdated(const QJsonArray &replyArray);
0465 
0466     [[nodiscard]] const QVector<RoleInfo> &roleInfo() const;
0467 
0468     [[nodiscard]] CustomSoundsManager *customSoundManager() const;
0469 
0470     [[nodiscard]] bool attachmentIsInLocalCache(const QString &url);
0471     void privateSettingsUpdated(const QJsonArray &replyArray);
0472     void updateUserInRoom(const QJsonObject &roomData);
0473     void updateUserData(const QJsonArray &contents);
0474     [[nodiscard]] bool twoFactorAuthenticationEnabled() const;
0475     [[nodiscard]] bool twoFactorAuthenticationByEmailEnabled() const;
0476     [[nodiscard]] bool twoFactorAuthenticationByTOTPEnabled() const;
0477     void generate2FaTotp(const QJsonObject &obj);
0478     void totpVerify(const QJsonObject &obj);
0479     void totpDisabledVerify(const QJsonObject &root);
0480 
0481     [[nodiscard]] const QStringList &searchListCompletion() const;
0482     void setSearchListCompletion(const QStringList &newSearchListCompletion);
0483 
0484     void setOauthAppAdded(const QJsonObject &obj);
0485 
0486     void setOauthAppUpdated(const QJsonObject &obj);
0487 
0488     [[nodiscard]] SwitchChannelHistoryModel *switchChannelHistoryModel() const;
0489 
0490     [[nodiscard]] bool twoFactorAuthenticationEnforcePasswordFallback() const;
0491     UploadFileManager *uploadFileManager() const;
0492 
0493     [[nodiscard]] int messageMaximumAllowedSize() const;
0494     [[nodiscard]] bool messageAllowConvertLongMessagesToAttachment() const;
0495 
0496     [[nodiscard]] bool allowPasswordReset() const;
0497     [[nodiscard]] const BannerInfos &bannerInfos() const;
0498 
0499     [[nodiscard]] bool useRealName() const;
0500 
0501     [[nodiscard]] bool hasLicense(const QString &name);
0502     void parseLicenses(const QJsonArray &replyArray);
0503     // Only for test
0504     void setOwnUserPreferences(const OwnUserPreferences &ownUserPreferences);
0505 
0506     [[nodiscard]] bool sortFavoriteChannels() const;
0507     void setShowFavoriteRoom(bool checked);
0508     void parseVideoConference(const QJsonArray &contents);
0509     [[nodiscard]] VideoConferenceManager *videoConferenceManager() const;
0510 
0511     [[nodiscard]] VideoConferenceMessageInfoManager *videoConferenceMessageInfoManager() const;
0512 
0513     [[nodiscard]] QUrl faviconLogoUrlFromLocalCache(const QString &url);
0514     void addMessageToDataBase(const QString &roomName, const Message &message);
0515     void deleteMessageFromDatabase(const QString &roomName, const QString &messageId);
0516     void loadAccountSettings();
0517     void parseCustomSounds(const QJsonArray &obj);
0518 
0519     [[nodiscard]] QVector<AuthenticationInfo> authenticationMethodInfos() const;
0520 
0521     [[nodiscard]] QUrl previewUrlFromLocalCache(const QString &url);
0522     [[nodiscard]] bool previewEmbed() const;
0523     [[nodiscard]] QUrl avatarUrlFromLocalCache(const QString &url);
0524 Q_SIGNALS:
0525     void roomRemoved(const QString &roomId);
0526     void disabledTotpValid(bool checked);
0527     void totpInvalid();
0528     void totpValid(const QStringList &code);
0529     void avatarWasChanged(const Utils::AvatarInfo &info);
0530     void accountInitialized();
0531     void connectedChanged();
0532     void accountNameChanged();
0533     void userNameChanged();
0534     void userIdChanged();
0535     void passwordChanged();
0536     void twoFactorAuthenticationCodeChanged();
0537     void serverUrlChanged();
0538     void loginStatusChanged();
0539     void socketError(QAbstractSocket::SocketError error, const QString &errorString);
0540     void logoutDone(const QString &accountname);
0541     void added(const QJsonObject &item);
0542     void changed(const QJsonObject &item);
0543     void removed(const QJsonObject &item);
0544     void notification(const NotificationInfo &info);
0545     void fileDownloaded(const QString &filePath, const QUrl &cacheImageUrl);
0546     void updateNotification(bool hasAlert, int nbUnread, const QString &accountName);
0547     void missingChannelPassword(const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0548     void editingModeChanged();
0549     void jobFailed(const QString &message, const QString &accountName);
0550     void switchedRooms();
0551     void userStatusUpdated(User::PresenceStatus status, const QString &customText, const QString &accountName);
0552     void publicSettingChanged();
0553     void serverVersionChanged();
0554     void openLinkRequested(const QString &link);
0555     void selectRoomByRoomIdRequested(const QString &identifier, const QString &messageId = QString());
0556     void selectRoomByRoomNameRequested(const QString &identifier);
0557     void openTeamNameRequested(const QString &identifier);
0558     void openThreadRequested(const QString &threadMessageId, const QString &threadMessagePreview, bool threadIsFollowing, const Message &message);
0559     void raiseWindow();
0560     void registerUserSuccess();
0561     void roomNeedAttention();
0562     void ownInfoChanged();
0563     void customUserStatusChanged();
0564     void ownUserPreferencesChanged();
0565     void customStatusChanged();
0566     void permissionChanged();
0567     void displayReconnectWidget(int seconds);
0568 
0569     void customSoundRemoved(const QString &identifier);
0570     void customSoundAdded(); // TODO add argument ?
0571     void customSoundUpdated(); // TODO add argument ?
0572 
0573     void insertStdOutInfo(const QString &str);
0574     void rolesUpdated();
0575     void totpResult(const QString &secret, const QString &url);
0576 
0577     void selectChannelAndMessage(const QString &messageId,
0578                                  const QString &roomId,
0579                                  ParseMessageUrlUtils::RoomIdType roomType,
0580                                  ParseMessageUrlUtils::ChannelType channelType);
0581 
0582     void oauthAppAdded(const QJsonObject &obj);
0583     void oauthAppUpdated(const QJsonObject &obj);
0584     void needUpdateMessageView();
0585     void publicSettingLoaded(const QJsonObject &obj);
0586     void bannerInfoChanged();
0587     void privateSettingsChanged();
0588     void updateMessageFailed(const QString &str);
0589     void wsClosedSocketError();
0590 
0591 private:
0592     Q_DISABLE_COPY(RocketChatAccount)
0593 
0594     LIBRUQOLACORE_NO_EXPORT void slotChannelFilesDone(const QJsonObject &obj, const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0595     LIBRUQOLACORE_NO_EXPORT void slotChannelGroupRolesDone(const QJsonObject &obj, const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0596     LIBRUQOLACORE_NO_EXPORT void slotGetThreadMessagesDone(const QJsonObject &obj, const QString &threadMessageId);
0597     LIBRUQOLACORE_NO_EXPORT void slotGetDiscussionsListDone(const QJsonObject &obj, const QString &roomId);
0598     LIBRUQOLACORE_NO_EXPORT void slotGetSupportedLanguagesDone(const QJsonObject &obj);
0599     LIBRUQOLACORE_NO_EXPORT void slotUsersPresenceDone(const QJsonObject &obj);
0600     LIBRUQOLACORE_NO_EXPORT void slotReconnectToServer();
0601 
0602     LIBRUQOLACORE_NO_EXPORT void loadEmoji(const QJsonObject &obj);
0603     LIBRUQOLACORE_NO_EXPORT void slotSearchMessages(const QJsonObject &obj);
0604     LIBRUQOLACORE_NO_EXPORT void slotNeedToUpdateNotification();
0605     LIBRUQOLACORE_NO_EXPORT void loadSettings(const QString &accountFileName);
0606     LIBRUQOLACORE_NO_EXPORT void clearModels();
0607     LIBRUQOLACORE_NO_EXPORT void fillAuthenticationModel();
0608     LIBRUQOLACORE_NO_EXPORT void initializeAuthenticationPlugins();
0609     LIBRUQOLACORE_NO_EXPORT void setDefaultAuthentication(AuthenticationManager::AuthMethodType type);
0610     LIBRUQOLACORE_NO_EXPORT void userStatusChanged(const User &user);
0611     LIBRUQOLACORE_NO_EXPORT void openArchivedRoom(const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0612     LIBRUQOLACORE_NO_EXPORT void slotChannelGetCountersDone(const QJsonObject &obj,
0613                                                             const RocketChatRestApi::ChannelGroupBaseJob::ChannelGroupInfo &channelInfo);
0614 
0615     LIBRUQOLACORE_NO_EXPORT void getSupportedLanguages();
0616     LIBRUQOLACORE_NO_EXPORT void usersPresence();
0617     LIBRUQOLACORE_NO_EXPORT void listEmojiCustom();
0618 
0619     LIBRUQOLACORE_NO_EXPORT void checkInitializedRoom(const QString &roomId);
0620     LIBRUQOLACORE_NO_EXPORT void clearTypingNotification();
0621     LIBRUQOLACORE_NO_EXPORT void
0622     inputAutocomplete(const QString &roomId, const QString &pattern, const QString &exceptions, InputTextManager::CompletionForType type, bool threadDialog);
0623     LIBRUQOLACORE_NO_EXPORT void slotGetListMessagesDone(const QJsonObject &obj, const QString &roomId, ListMessagesModel::ListMessageType type);
0624     LIBRUQOLACORE_NO_EXPORT void slotUserAutoCompleterDone(const QJsonObject &obj);
0625     LIBRUQOLACORE_NO_EXPORT void slotListCommandDone(const QJsonObject &obj);
0626     LIBRUQOLACORE_NO_EXPORT void runCommand(const RocketChatRestApi::RunCommandJob::RunCommandInfo &runCommandInfo);
0627 
0628     LIBRUQOLACORE_NO_EXPORT void slotLoginStatusChanged();
0629     LIBRUQOLACORE_NO_EXPORT void slotFileLanguagedParsed();
0630     LIBRUQOLACORE_NO_EXPORT void slotRegisterUserDone();
0631     LIBRUQOLACORE_NO_EXPORT void slotRoomNeedAttention();
0632     LIBRUQOLACORE_NO_EXPORT void slotMarkAsReadDone(const QString &roomId);
0633     LIBRUQOLACORE_NO_EXPORT void slotCustomUserStatusDone(const QJsonObject &customList);
0634     LIBRUQOLACORE_NO_EXPORT void slotPostMessageDone(const QJsonObject &replyObject);
0635     LIBRUQOLACORE_NO_EXPORT void slotRoomExportDone();
0636     LIBRUQOLACORE_NO_EXPORT void slotPermissionListAllDone(const QJsonObject &replyObject);
0637     LIBRUQOLACORE_NO_EXPORT void slotUsersSetPreferencesDone(const QJsonObject &replyObject);
0638     LIBRUQOLACORE_NO_EXPORT void slotUpdateCustomUserStatus();
0639     LIBRUQOLACORE_NO_EXPORT void updateCustomEmojiList(bool fetchListCustom);
0640     LIBRUQOLACORE_NO_EXPORT void slotLoadRoles();
0641     LIBRUQOLACORE_NO_EXPORT void slotAwayStatusChanged(bool away);
0642     LIBRUQOLACORE_NO_EXPORT void slotJobFailed(const QString &str);
0643     LIBRUQOLACORE_NO_EXPORT void checkLicenses();
0644     LIBRUQOLACORE_NO_EXPORT void parsePublicSettings();
0645 
0646     AccountRoomSettings *const mAccountRoomSettings;
0647 
0648     PluginAuthenticationInterface *mDefaultAuthenticationInterface = nullptr;
0649 
0650     QHash<AuthenticationManager::AuthMethodType, PluginAuthenticationInterface *> mLstPluginAuthenticationInterface;
0651     QVector<AuthenticationInfo> mAccountAvailableAuthenticationMethodInfos;
0652     QVector<AuthenticationInfo> mAuthenticationMethodInfos;
0653     RocketChatAccountSettings *mSettings = nullptr;
0654 
0655     EmojiManager *mEmojiManager = nullptr;
0656     TypingNotification *mTypingNotification = nullptr;
0657     UsersModel *const mUserModel;
0658     RoomModel *const mRoomModel;
0659     DDPClient *mDdp = nullptr;
0660     RocketChatRestApi::Connection *mRestApi = nullptr;
0661     MessageQueue *mMessageQueue = nullptr;
0662     RocketChatBackend *mRocketChatBackend = nullptr;
0663     RuqolaLogger *mRuqolaLogger = nullptr;
0664     RuqolaServerConfig *const mRuqolaServerConfig;
0665     UserCompleterModel *const mUserCompleterModel;
0666     UserCompleterFilterProxyModel *mUserCompleterFilterModelProxy = nullptr;
0667     StatusModel *const mStatusModel;
0668     RocketChatCache *mCache = nullptr;
0669     OtrManager *const mOtrManager;
0670     InputTextManager *const mInputTextManager;
0671 
0672     InputTextManager *const mInputThreadMessageTextManager;
0673 
0674     CommonMessagesModel *mSearchMessageModel = nullptr;
0675     CommonMessageFilterProxyModel *mSearchMessageFilterProxyModel = nullptr;
0676     ReceiveTypingNotificationManager *const mReceiveTypingNotificationManager;
0677     ServerConfigInfo *mServerConfigInfo = nullptr;
0678     FilesForRoomModel *mFilesModelForRoom = nullptr;
0679     FilesForRoomFilterProxyModel *mFilesForRoomFilterProxyModel = nullptr;
0680     DiscussionsFilterProxyModel *mDiscussionsFilterProxyModel = nullptr;
0681     DiscussionsModel *const mDiscussionsModel;
0682 
0683     EmoticonModel *mEmoticonModel = nullptr;
0684     CommandsModel *const mCommandsModel;
0685     ThreadMessageModel *mThreadMessageModel = nullptr;
0686 
0687     ListMessagesModel *mListMessageModel = nullptr;
0688     ListMessagesFilterProxyModel *mListMessagesFilterProxyModel = nullptr;
0689 
0690     AutotranslateLanguagesModel *const mAutoTranslateLanguagesModel;
0691     User::PresenceStatus mPresenceStatus = User::PresenceStatus::PresenceOnline;
0692     DownloadAppsLanguagesManager *const mDownloadAppsLanguagesManager;
0693     MessageCache *const mMessageCache;
0694     ManageChannels *const mManageChannels;
0695     CustomSoundsManager *const mCustomSoundManager;
0696     AwayManager *const mAwayManager;
0697     SwitchChannelHistoryModel *const mSwitchChannelHistoryModel;
0698     UploadFileManager *const mUploadFileManager;
0699     OwnUser mOwnUser;
0700     CustomUserStatuses mCustomUserStatuses;
0701     PermissionManager mPermissionManager;
0702     RolesManager mRolesManager;
0703     LicensesManager mLicensesManager;
0704     QStringList mSearchListCompletion;
0705     BannerInfos mBannerInfos;
0706     VideoConferenceManager *const mVideoConferenceManager;
0707     VideoConferenceMessageInfoManager *const mVideoConferenceMessageInfoManager;
0708     std::unique_ptr<LocalDatabaseManager> mLocalDatabaseManager;
0709     ManageLocalDatabase *const mManageLoadHistory;
0710     PreviewUrlCacheManager *const mPreviewUrlCacheManager;
0711 
0712     int mDelayReconnect = 100;
0713     bool mEditingMode = false;
0714     bool mMarkUnreadThreadsAsReadOnNextReply = false;
0715 };