From de9448a65655451e1310947955dd6b341479dc23 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Wed, 8 Mar 2017 20:22:44 +0900 Subject: Connection::callApi<>, a factory for all API call jobs This call (intended to only be used within the lib) creates a job object of the passed type and passes a ConnectionData pointer to its constructor. This allows to avoid making a switchboard of methods on Connection for the whole API, leaving only those that naturally belong there - e.g. joinRoom() or sync() - and moving, e.g., postMessage() to where it belongs - Room. PostMessageJob and RoomMessagesJob were updated along the way, to unbind from the Room class (which they really don't and won't need). --- jobs/postmessagejob.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'jobs/postmessagejob.cpp') diff --git a/jobs/postmessagejob.cpp b/jobs/postmessagejob.cpp index 9903bec6..a835cd9f 100644 --- a/jobs/postmessagejob.cpp +++ b/jobs/postmessagejob.cpp @@ -17,7 +17,6 @@ */ #include "postmessagejob.h" -#include "../room.h" #include "../connectiondata.h" #include @@ -32,9 +31,10 @@ class PostMessageJob::Private QString eventId; // unused yet }; -PostMessageJob::PostMessageJob(ConnectionData* connection, Room* room, QString type, QString message) +PostMessageJob::PostMessageJob(ConnectionData* connection, QString roomId, + QString type, QString message) : BaseJob(connection, JobHttpType::PostJob, "PostMessageJob", - QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(room->id()), + QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId), Query(), Data({ { "msgtype", type }, { "body", message } })) , d(new Private) -- cgit v1.2.3