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