aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-06-13 17:30:13 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-07-27 14:35:28 +0900
commitbaee19241daffd50e0b32559cda64d5b6ede09a2 (patch)
tree2aa9e41f64d0dddeff3b5fdf8cca1f433cf0a5d7 /examples
parent284b751ee424985341812a32721227112160a905 (diff)
downloadlibquotient-baee19241daffd50e0b32559cda64d5b6ede09a2.tar.gz
libquotient-baee19241daffd50e0b32559cda64d5b6ede09a2.zip
Initial support for local echo
The Room class has gained a new internal container, unsyncedEvents, storing locally-created Event objects that are about to be sent or are sent but not yet synced. These objects are supposed to be complete enough to be displayed by clients in a usual way; access to them is provided by Room::pendingEvents() accessor. A set of pendingEvent* signals has been added to notify clients about changes in this container (adding, removal, status update). Yet unsent events don't have Event::id() at all; sent but yet unsynced ones have Event::id() but have almost nothing else except the content for now (probably a sender and an (at least local) timestamp are worth adding). Also: SendEventJob is removed in favor of GTAD-generated SendMessageJob.
Diffstat (limited to 'examples')
-rw-r--r--examples/qmc-example.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/qmc-example.cpp b/examples/qmc-example.cpp
index 4de42623..d24b6ed0 100644
--- a/examples/qmc-example.cpp
+++ b/examples/qmc-example.cpp
@@ -2,7 +2,7 @@
#include "connection.h"
#include "room.h"
#include "user.h"
-#include "jobs/sendeventjob.h"
+#include "csapi/room_send.h"
#include "csapi/joining.h"
#include "csapi/leaving.h"
@@ -87,8 +87,8 @@ void QMCTest::setup(const QString& testRoomName)
c->sync(10000);
else if (targetRoom)
{
- auto j = c->callApi<SendEventJob>(targetRoom->id(),
- RoomMessageEvent(origin % ": All tests finished"));
+ auto j = c->sendMessage(targetRoom->id(),
+ RoomMessageEvent(origin % ": All tests finished"));
connect(j, &BaseJob::finished, this, &QMCTest::leave);
}
else
@@ -176,7 +176,7 @@ void QMCTest::sendAndRedact()
{
running.push_back("Redaction");
cout << "Sending a message to redact" << endl;
- auto* job = targetRoom->connection()->callApi<SendEventJob>(targetRoom->id(),
+ auto* job = targetRoom->connection()->sendMessage(targetRoom->id(),
RoomMessageEvent(origin % ": Message to redact"));
connect(job, &BaseJob::success, targetRoom, [job,this] {
cout << "Message to redact has been succesfully sent, redacting" << endl;