aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-27 18:34:28 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-27 18:34:28 +0900
commit84aa055bba602635599def37915b96ccf3f63484 (patch)
tree59857c792f913871ab70385fb7e9f037fa58973a /lib/connection.cpp
parent284b751ee424985341812a32721227112160a905 (diff)
parentc7e4d01c479452aad4616ee2d5a285f4fe0565aa (diff)
downloadlibquotient-84aa055bba602635599def37915b96ccf3f63484.tar.gz
libquotient-84aa055bba602635599def37915b96ccf3f63484.zip
Merge branch 'kitsune-local-echo'
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp15
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();