diff --git a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/DatabaseQueryExecutor.h @@ -176,6 +176,11 @@ std::string original_message_id, std::string message_id, std::string processed_content) const = 0; + virtual std::vector searchMessages( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const = 0; #ifdef EMSCRIPTEN virtual std::vector getAllThreadsWeb() const = 0; @@ -185,6 +190,11 @@ virtual NullableString getOlmPersistAccountDataWeb(int accountID) const = 0; virtual std::vector getRelatedMessagesWeb(const std::string &messageID) const = 0; + virtual std::vector searchMessagesWeb( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const = 0; #else virtual void createMainCompaction(std::string backupID) const = 0; virtual void captureBackupLogs() const = 0; diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.h @@ -189,6 +189,11 @@ std::string original_message_id, std::string message_id, std::string processed_content) const override; + std::vector searchMessages( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const override; #ifdef EMSCRIPTEN std::vector getAllThreadsWeb() const override; @@ -198,6 +203,11 @@ NullableString getOlmPersistAccountDataWeb(int accountID) const override; std::vector getRelatedMessagesWeb(const std::string &messageID) const override; + std::vector searchMessagesWeb( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const override; #else static void clearSensitiveData(); static void initialize(std::string &databasePath); diff --git a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp --- a/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp +++ b/native/cpp/CommonCpp/DatabaseManagers/SQLiteQueryExecutor.cpp @@ -2551,6 +2551,15 @@ return this->processMessagesResults(preparedSQL); } +std::vector SQLiteQueryExecutor::searchMessages( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const { + + return std::vector{}; +} + #ifdef EMSCRIPTEN std::vector SQLiteQueryExecutor::getAllThreadsWeb() const { auto threads = this->getAllThreads(); @@ -2604,6 +2613,23 @@ return relatedMessagesWithMedias; } + +std::vector SQLiteQueryExecutor::searchMessagesWeb( + std::string query, + std::string threadID, + std::optional timestampCursor, + std::optional messageIDCursor) const { + auto allMessages = + this->searchMessages(query, threadID, timestampCursor, messageIDCursor); + + std::vector allMessagesWithMedias; + for (auto &messageWithMedia : allMessages) { + allMessagesWithMedias.push_back( + {std::move(messageWithMedia.first), messageWithMedia.second}); + } + + return allMessagesWithMedias; +} #else void SQLiteQueryExecutor::clearSensitiveData() { SQLiteQueryExecutor::closeConnection(); diff --git a/web/shared-worker/_generated/comm_query_executor.wasm b/web/shared-worker/_generated/comm_query_executor.wasm index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@