diff --git a/Quotient/room.cpp b/Quotient/room.cpp index d80234476..e2fc795cc 100644 --- a/Quotient/room.cpp +++ b/Quotient/room.cpp @@ -2121,27 +2121,28 @@ void Room::discardMessage(const QString& txnId) emit pendingEventDiscarded(); } -QString Room::postMessage(const QString& plainText, MessageEventType type) +QString Room::postMessage(const QString& plainText, MessageEventType type, std::optional relatesTo) { - return post(plainText, type)->transactionId(); + return post(plainText, type, nullptr, relatesTo)->transactionId(); } -QString Room::postPlainText(const QString& plainText) +QString Room::postPlainText(const QString& plainText, std::optional relatesTo) { - return postMessage(plainText, MessageEventType::Text); + return postMessage(plainText, MessageEventType::Text, relatesTo); } QString Room::postHtmlMessage(const QString& plainText, const QString& html, - MessageEventType type) + MessageEventType type, std::optional relatesTo) { return post(plainText, type, - new EventContent::TextContent(html, u"text/html"_s)) + new EventContent::TextContent(html, u"text/html"_s), + relatesTo) ->transactionId(); } -QString Room::postHtmlText(const QString& plainText, const QString& html) +QString Room::postHtmlText(const QString& plainText, const QString& html, std::optional relatesTo) { - return postHtmlMessage(plainText, html); + return postHtmlMessage(plainText, html, MessageEventType::Text, relatesTo); } QString Room::postReaction(const QString& eventId, const QString& key) @@ -2198,7 +2199,8 @@ QString Room::Private::doPostFile(RoomEventPtr&& msgEvent, const QUrl& localUrl) } QString Room::postFile(const QString& plainText, - EventContent::TypedBase* content) + EventContent::TypedBase* content, + std::optional relatesTo) { Q_ASSERT(content != nullptr && content->fileInfo() != nullptr); const auto* const fileInfo = content->fileInfo(); @@ -2210,7 +2212,7 @@ QString Room::postFile(const QString& plainText, return d->doPostFile( makeEvent( - plainText, RoomMessageEvent::rawMsgTypeForFile(localFile), content), + plainText, RoomMessageEvent::rawMsgTypeForFile(localFile), content, relatesTo), fileInfo->url()); } diff --git a/Quotient/room.h b/Quotient/room.h index 720b8d601..cba40ae9c 100644 --- a/Quotient/room.h +++ b/Quotient/room.h @@ -746,15 +746,16 @@ public Q_SLOTS: /** Check whether the room should be upgraded */ void checkVersion(); - QString postMessage(const QString& plainText, MessageEventType type); - QString postPlainText(const QString& plainText); + QString postMessage(const QString& plainText, MessageEventType type, std::optional relatesTo = std::nullopt); + QString postPlainText(const QString& plainText, std::optional relatesTo = std::nullopt); QString postHtmlMessage(const QString& plainText, const QString& html, - MessageEventType type = MessageEventType::Text); - QString postHtmlText(const QString& plainText, const QString& html); + MessageEventType type = MessageEventType::Text, + std::optional relatesTo = std::nullopt); + QString postHtmlText(const QString& plainText, const QString& html, std::optional relatesTo = std::nullopt); /// Send a reaction on a given event with a given key QString postReaction(const QString& eventId, const QString& key); - QString postFile(const QString& plainText, EventContent::TypedBase* content); + QString postFile(const QString& plainText, EventContent::TypedBase* content, std::optional relatesTo = std::nullopt); /** Post a pre-created room message event * diff --git a/quotest/quotest.cpp b/quotest/quotest.cpp index cbe71075d..341c5e866 100644 --- a/quotest/quotest.cpp +++ b/quotest/quotest.cpp @@ -438,7 +438,7 @@ TEST_IMPL(sendFile) const auto tfName = tfi.fileName(); clog << "Sending file " << tfName.toStdString() << endl; const auto txnId = targetRoom->postFile( - "Test file"_L1, new EventContent::FileContent(tfi)); + "Test file"_L1, new EventContent::FileContent(tfi), std::nullopt); if (!validatePendingEvent(txnId)) { clog << "Invalid pending event right after submitting" << endl; tf->deleteLater();