diff options
Diffstat (limited to 'jobs/postmessagejob.cpp')
-rw-r--r-- | jobs/postmessagejob.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/jobs/postmessagejob.cpp b/jobs/postmessagejob.cpp index 0a38da62..9903bec6 100644 --- a/jobs/postmessagejob.cpp +++ b/jobs/postmessagejob.cpp @@ -29,38 +29,22 @@ class PostMessageJob::Private public: Private() {} - QString type; - QString message; - Room* room; + QString eventId; // unused yet }; PostMessageJob::PostMessageJob(ConnectionData* connection, Room* room, QString type, QString message) - : BaseJob(connection, JobHttpType::PostJob, "PostMessageJob") + : BaseJob(connection, JobHttpType::PostJob, "PostMessageJob", + QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(room->id()), + Query(), + Data({ { "msgtype", type }, { "body", message } })) , d(new Private) -{ - d->type = type; - d->message = message; - d->room = room; -} +{ } PostMessageJob::~PostMessageJob() { delete d; } -QString PostMessageJob::apiPath() const -{ - return QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(d->room->id()); -} - -QJsonObject PostMessageJob::data() const -{ - QJsonObject json; - json.insert("msgtype", d->type); - json.insert("body", d->message); - return json; -} - BaseJob::Status PostMessageJob::parseJson(const QJsonDocument& data) { if( data.object().contains("event_id") ) |