Page MenuHomePhabricator

D11170.diff
No OneTemporary

D11170.diff

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
@@ -6,6 +6,7 @@
#include "entities/KeyserverInfo.h"
#include "entities/Message.h"
#include "entities/MessageStoreThread.h"
+#include "entities/MessageToDevice.h"
#include "entities/OlmPersistAccount.h"
#include "entities/OlmPersistSession.h"
#include "entities/PersistItem.h"
@@ -98,6 +99,8 @@
std::string mainCompactionEncryptionKey) const = 0;
virtual void
restoreFromBackupLog(const std::vector<std::uint8_t> &backupLog) const = 0;
+ virtual void addMessagesToDevice(
+ const std::vector<ClientMessageToDevice> &messages) const = 0;
#ifdef EMSCRIPTEN
virtual std::vector<WebThread> getAllThreadsWeb() 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
@@ -112,6 +112,8 @@
std::string mainCompactionEncryptionKey) const override;
void restoreFromBackupLog(
const std::vector<std::uint8_t> &backupLog) const override;
+ void addMessagesToDevice(
+ const std::vector<ClientMessageToDevice> &messages) const override;
#ifdef EMSCRIPTEN
std::vector<WebThread> getAllThreadsWeb() const override;
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
@@ -1694,6 +1694,20 @@
return (entry == nullptr) ? "" : entry->data;
}
+void SQLiteQueryExecutor::addMessagesToDevice(
+ const std::vector<ClientMessageToDevice> &messages) const {
+ static std::string addMessageToDevice =
+ "REPLACE INTO messages_to_device ("
+ " message_id, device_id, user_id, timestamp, plaintext, ciphertext) "
+ "VALUES (?, ?, ?, ?, ?, ?);";
+
+ for (const ClientMessageToDevice &clientMessage : messages) {
+ MessageToDevice message = clientMessage.toMessageToDevice();
+ replaceEntity<MessageToDevice>(
+ SQLiteQueryExecutor::getConnection(), addMessageToDevice, message);
+ }
+}
+
#ifdef EMSCRIPTEN
std::vector<WebThread> SQLiteQueryExecutor::getAllThreadsWeb() const {
auto threads = this->getAllThreads();
diff --git a/web/database/_generated/comm_query_executor.wasm b/web/database/_generated/comm_query_executor.wasm
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
GIT binary patch
literal 0
Hc$@<O00001
literal 0
Hc$@<O00001

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 7:30 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2577120
Default Alt Text
D11170.diff (2 KB)

Event Timeline