diff options
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r-- | lib/connection.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index 8007cea1..d3a53cf4 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -30,7 +30,7 @@ #include "csapi/account-data.h" #include "csapi/joining.h" #include "csapi/to_device.h" -#include "jobs/sendeventjob.h" +#include "csapi/room_send.h" #include "jobs/syncjob.h" #include "jobs/mediathumbnailjob.h" #include "jobs/downloadfilejob.h" @@ -405,11 +405,6 @@ void Connection::stopSync() } } -void Connection::postMessage(Room* room, const QString& type, const QString& message) const -{ - callApi<SendEventJob>(room->id(), type, message); -} - PostReceiptJob* Connection::postReceipt(Room* room, RoomEvent* event) const { return callApi<PostReceiptJob>(room->id(), "m.read", event->id()); @@ -645,6 +640,14 @@ SendToDeviceJob* Connection::sendToDevices(const QString& eventType, eventType, generateTxnId(), json); } +SendMessageJob* Connection::sendMessage(const QString& roomId, const RoomEvent& event) const +{ + const auto txnId = event.transactionId().isEmpty() + ? generateTxnId() : event.transactionId(); + return callApi<SendMessageJob>(roomId, event.matrixType(), + txnId, event.contentJson()); +} + QUrl Connection::homeserver() const { return d->data->baseUrl(); |