diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-10-02 12:16:36 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-10-13 10:37:16 +0200 |
commit | b2a017303a34e248873b2e47e560a41dc4c5111c (patch) | |
tree | 2745b5d555b7689a448b6800503f6ff3f8201265 /jobs/sendeventjob.h | |
parent | c9dc5e12b835425f1ba5c447ddb3c3394ccac93e (diff) | |
download | libquotient-b2a017303a34e248873b2e47e560a41dc4c5111c.tar.gz libquotient-b2a017303a34e248873b2e47e560a41dc4c5111c.zip |
All jobs: Drop ConnectionData parameter from the constructor
Having to pass ConnectionData to each and every job class was nothing but boilerplate since the very beginning. Removing it required to prepend BaseJob::start() with ConnectionData-setting code, and to provide a way to alter the request configuration depending on the (late-coming) ConnectionData object. This is a new responsibility of BaseJob::start(); the previous BaseJob::start() contents have moved to BaseJob::sendRequest() (which is now invoked on retries, instead of start()).
Diffstat (limited to 'jobs/sendeventjob.h')
-rw-r--r-- | jobs/sendeventjob.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/jobs/sendeventjob.h b/jobs/sendeventjob.h index 42948cc2..7b10b3d4 100644 --- a/jobs/sendeventjob.h +++ b/jobs/sendeventjob.h @@ -29,12 +29,10 @@ namespace QMatrixClient public: /** Constructs a job that sends an arbitrary room event */ template <typename EvT> - SendEventJob(const ConnectionData* connection, const QString& roomId, - const EvT* event) - : BaseJob(connection, HttpVerb::Put, "SendEventJob", - QStringLiteral("_matrix/client/r0/rooms/%1/send/%2/%3") - .arg(roomId, EvT::TypeId, - connection->generateTxnId()), + 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())) { } @@ -43,8 +41,8 @@ namespace QMatrixClient * Constructs a plain text message job (for compatibility with * the old PostMessageJob API). */ - SendEventJob(const ConnectionData* connection, const QString& roomId, - const QString& type, const QString& plainText); + SendEventJob(const QString& roomId, const QString& type, + const QString& plainText); QString eventId() const { return _eventId; } @@ -53,5 +51,7 @@ namespace QMatrixClient private: QString _eventId; + + void beforeStart(const ConnectionData* connData) override; }; } // namespace QMatrixClient |