aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-14 01:22:04 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-14 01:53:02 +0200
commit76c42a9863b83229e6afaf4be32e9582e3d97d3f (patch)
tree1aacf03ab8d9ae96e4f21f430d7e99ddf4b0bb10 /jobs
parent2d3590dbdb23c82f1960327ffbd78e778231b9c8 (diff)
downloadlibquotient-76c42a9863b83229e6afaf4be32e9582e3d97d3f.tar.gz
libquotient-76c42a9863b83229e6afaf4be32e9582e3d97d3f.zip
Cleanup around Room (potentially breaks API compatibility, beware)
Notably: * API for SendEventJob and SetRoomStateJob has been altered to accept references, not pointers. * Methods on Room that invoke requests to the server, have lost const, because they may be reflecting the changed state on the fly, within themselves
Diffstat (limited to 'jobs')
-rw-r--r--jobs/sendeventjob.cpp2
-rw-r--r--jobs/sendeventjob.h4
-rw-r--r--jobs/setroomstatejob.h8
3 files changed, 7 insertions, 7 deletions
diff --git a/jobs/sendeventjob.cpp b/jobs/sendeventjob.cpp
index 7e33e089..f5190d4b 100644
--- a/jobs/sendeventjob.cpp
+++ b/jobs/sendeventjob.cpp
@@ -24,7 +24,7 @@ using namespace QMatrixClient;
SendEventJob::SendEventJob(const QString& roomId, const QString& type,
const QString& plainText)
- : SendEventJob(roomId, new RoomMessageEvent(plainText, type))
+ : SendEventJob(roomId, RoomMessageEvent(plainText, type))
{ }
void SendEventJob::beforeStart(const ConnectionData* connData)
diff --git a/jobs/sendeventjob.h b/jobs/sendeventjob.h
index 7b10b3d4..3a11eb6a 100644
--- a/jobs/sendeventjob.h
+++ b/jobs/sendeventjob.h
@@ -29,12 +29,12 @@ namespace QMatrixClient
public:
/** Constructs a job that sends an arbitrary room event */
template <typename EvT>
- SendEventJob(const QString& roomId, const EvT* event)
+ SendEventJob(const QString& roomId, const EvT& event)
: BaseJob(HttpVerb::Put, QStringLiteral("SendEventJob"),
QStringLiteral("_matrix/client/r0/rooms/%1/send/%2/")
.arg(roomId, EvT::TypeId), // See also beforeStart()
Query(),
- Data(event->toJson()))
+ Data(event.toJson()))
{ }
/**
diff --git a/jobs/setroomstatejob.h b/jobs/setroomstatejob.h
index ddc271b9..b7e6d4a1 100644
--- a/jobs/setroomstatejob.h
+++ b/jobs/setroomstatejob.h
@@ -33,24 +33,24 @@ namespace QMatrixClient
*/
template <typename EvT>
SetRoomStateJob(const QString& roomId, const QString& stateKey,
- const EvT* event)
+ const EvT& event)
: BaseJob(HttpVerb::Put, "SetRoomStateJob",
QStringLiteral("_matrix/client/r0/rooms/%1/state/%2/%3")
.arg(roomId, EvT::TypeId, stateKey),
Query(),
- Data(event->toJson()))
+ Data(event.toJson()))
{ }
/**
* Constructs a job that sets a state using an arbitrary room event
* without a state key.
*/
template <typename EvT>
- SetRoomStateJob(const QString& roomId, const EvT* event)
+ SetRoomStateJob(const QString& roomId, const EvT& event)
: BaseJob(HttpVerb::Put, "SetRoomStateJob",
QStringLiteral("_matrix/client/r0/rooms/%1/state/%2")
.arg(roomId, EvT::TypeId),
Query(),
- Data(event->toJson()))
+ Data(event.toJson()))
{ }
QString eventId() const { return _eventId; }