diff options
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/basejob.cpp | 20 | ||||
-rw-r--r-- | jobs/basejob.h | 4 | ||||
-rw-r--r-- | jobs/checkauthmethods.cpp | 2 | ||||
-rw-r--r-- | jobs/joinroomjob.cpp | 2 | ||||
-rw-r--r-- | jobs/leaveroomjob.cpp | 2 | ||||
-rw-r--r-- | jobs/logoutjob.cpp | 2 | ||||
-rw-r--r-- | jobs/mediathumbnailjob.cpp | 2 | ||||
-rw-r--r-- | jobs/passwordlogin.cpp | 2 | ||||
-rw-r--r-- | jobs/postmessagejob.cpp | 2 | ||||
-rw-r--r-- | jobs/postreceiptjob.cpp | 2 | ||||
-rw-r--r-- | jobs/roommessagesjob.cpp | 2 | ||||
-rw-r--r-- | jobs/syncjob.cpp | 2 |
12 files changed, 22 insertions, 22 deletions
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp index 92361dc4..226290ff 100644 --- a/jobs/basejob.cpp +++ b/jobs/basejob.cpp @@ -43,9 +43,9 @@ struct NetworkReplyDeleter : public QScopedPointerDeleteLater class BaseJob::Private { public: - Private(ConnectionData* c, JobHttpType t, QString endpoint, + Private(ConnectionData* c, HttpVerb v, QString endpoint, const QUrlQuery& q, const Data& data, bool nt) - : connection(c), type(t), apiEndpoint(endpoint), requestQuery(q) + : connection(c), verb(v), apiEndpoint(endpoint), requestQuery(q) , requestData(data), needsToken(nt) , reply(nullptr), status(NoError) { } @@ -55,7 +55,7 @@ class BaseJob::Private ConnectionData* connection; // Contents for the network request - JobHttpType type; + HttpVerb verb; QString apiEndpoint; QUrlQuery requestQuery; Data requestData; @@ -76,10 +76,10 @@ inline QDebug operator<<(QDebug dbg, const BaseJob* j) return dbg << "Job" << j->objectName(); } -BaseJob::BaseJob(ConnectionData* connection, JobHttpType type, QString name, +BaseJob::BaseJob(ConnectionData* connection, HttpVerb verb, QString name, QString endpoint, BaseJob::Query query, BaseJob::Data data, bool needsToken) - : d(new Private(connection, type, endpoint, query, data, needsToken)) + : d(new Private(connection, verb, endpoint, query, data, needsToken)) { setObjectName(name); d->timer.setSingleShot(true); @@ -134,18 +134,18 @@ void BaseJob::Private::sendRequest() req.setAttribute(QNetworkRequest::FollowRedirectsAttribute, true); req.setMaximumRedirectsAllowed(10); #endif - switch( type ) + switch( verb ) { - case JobHttpType::GetJob: + case HttpVerb::Get: reply.reset( connection->nam()->get(req) ); break; - case JobHttpType::PostJob: + case HttpVerb::Post: reply.reset( connection->nam()->post(req, requestData.serialize()) ); break; - case JobHttpType::PutJob: + case HttpVerb::Put: reply.reset( connection->nam()->put(req, requestData.serialize()) ); break; - case JobHttpType::DeleteJob: + case HttpVerb::Delete: reply.reset( connection->nam()->deleteResource(req) ); break; } diff --git a/jobs/basejob.h b/jobs/basejob.h index fc26426b..ed35e3e8 100644 --- a/jobs/basejob.h +++ b/jobs/basejob.h @@ -31,7 +31,7 @@ namespace QMatrixClient { class ConnectionData; - enum class JobHttpType { GetJob, PutJob, PostJob, DeleteJob }; + enum class HttpVerb { Get, Put, Post, Delete }; class BaseJob: public QObject { @@ -111,7 +111,7 @@ namespace QMatrixClient using duration_t = int; // milliseconds public: - BaseJob(ConnectionData* connection, JobHttpType type, QString name, + BaseJob(ConnectionData* connection, HttpVerb verb, QString name, QString endpoint, Query query = Query(), Data data = Data(), bool needsToken = true); virtual ~BaseJob(); diff --git a/jobs/checkauthmethods.cpp b/jobs/checkauthmethods.cpp index 28646822..5c6a95d2 100644 --- a/jobs/checkauthmethods.cpp +++ b/jobs/checkauthmethods.cpp @@ -37,7 +37,7 @@ class CheckAuthMethods::Private }; CheckAuthMethods::CheckAuthMethods(ConnectionData* connection) - : BaseJob(connection, JobHttpType::GetJob, "CheckAuthMethods", + : BaseJob(connection, HttpVerb::Get, "CheckAuthMethods", "_matrix/client/r0/login", Query(), Data(), false) , d(new Private) { diff --git a/jobs/joinroomjob.cpp b/jobs/joinroomjob.cpp index 073084c4..a6f65c31 100644 --- a/jobs/joinroomjob.cpp +++ b/jobs/joinroomjob.cpp @@ -31,7 +31,7 @@ class JoinRoomJob::Private }; JoinRoomJob::JoinRoomJob(ConnectionData* data, QString roomAlias) - : BaseJob(data, JobHttpType::PostJob, "JoinRoomJob", + : BaseJob(data, HttpVerb::Post, "JoinRoomJob", QString("_matrix/client/r0/join/%1").arg(roomAlias)) , d(new Private) { diff --git a/jobs/leaveroomjob.cpp b/jobs/leaveroomjob.cpp index 554bb990..22a5d34b 100644 --- a/jobs/leaveroomjob.cpp +++ b/jobs/leaveroomjob.cpp @@ -23,7 +23,7 @@ using namespace QMatrixClient; LeaveRoomJob::LeaveRoomJob(ConnectionData* data, Room* room) - : BaseJob(data, JobHttpType::PostJob, "LeaveRoomJob", + : BaseJob(data, HttpVerb::Post, "LeaveRoomJob", QString("_matrix/client/r0/rooms/%1/leave").arg(room->id())) { } diff --git a/jobs/logoutjob.cpp b/jobs/logoutjob.cpp index 25dee174..9b9cacb6 100644 --- a/jobs/logoutjob.cpp +++ b/jobs/logoutjob.cpp @@ -21,7 +21,7 @@ using namespace QMatrixClient; LogoutJob::LogoutJob(ConnectionData* connection) - : BaseJob(connection, JobHttpType::PostJob, "LogoutJob", "/_matrix/client/r0/logout") + : BaseJob(connection, HttpVerb::Post, "LogoutJob", "/_matrix/client/r0/logout") { } diff --git a/jobs/mediathumbnailjob.cpp b/jobs/mediathumbnailjob.cpp index dee06372..fdee8f47 100644 --- a/jobs/mediathumbnailjob.cpp +++ b/jobs/mediathumbnailjob.cpp @@ -30,7 +30,7 @@ class MediaThumbnailJob::Private MediaThumbnailJob::MediaThumbnailJob(ConnectionData* data, QUrl url, QSize requestedSize, ThumbnailType thumbnailType) - : BaseJob(data, JobHttpType::GetJob, "MediaThumbnailJob", + : BaseJob(data, HttpVerb::Get, "MediaThumbnailJob", QString("/_matrix/media/v1/thumbnail/%1%2").arg(url.host(), url.path()), Query( { { "width", QString::number(requestedSize.width()) } diff --git a/jobs/passwordlogin.cpp b/jobs/passwordlogin.cpp index c78c15b5..2f34e86a 100644 --- a/jobs/passwordlogin.cpp +++ b/jobs/passwordlogin.cpp @@ -33,7 +33,7 @@ class PasswordLogin::Private }; PasswordLogin::PasswordLogin(ConnectionData* connection, QString user, QString password) - : BaseJob(connection, JobHttpType::PostJob, "PasswordLogin" + : BaseJob(connection, HttpVerb::Post, "PasswordLogin" , "_matrix/client/r0/login" , Query() , Data( diff --git a/jobs/postmessagejob.cpp b/jobs/postmessagejob.cpp index a835cd9f..23c2214c 100644 --- a/jobs/postmessagejob.cpp +++ b/jobs/postmessagejob.cpp @@ -33,7 +33,7 @@ class PostMessageJob::Private PostMessageJob::PostMessageJob(ConnectionData* connection, QString roomId, QString type, QString message) - : BaseJob(connection, JobHttpType::PostJob, "PostMessageJob", + : BaseJob(connection, HttpVerb::Post, "PostMessageJob", QString("_matrix/client/r0/rooms/%1/send/m.room.message").arg(roomId), Query(), Data({ { "msgtype", type }, { "body", message } })) diff --git a/jobs/postreceiptjob.cpp b/jobs/postreceiptjob.cpp index 1eaefc2a..ee750dbf 100644 --- a/jobs/postreceiptjob.cpp +++ b/jobs/postreceiptjob.cpp @@ -25,7 +25,7 @@ using namespace QMatrixClient; PostReceiptJob::PostReceiptJob(ConnectionData* connection, QString roomId, QString eventId) - : BaseJob(connection, JobHttpType::PostJob, "PostReceiptJob", + : BaseJob(connection, HttpVerb::Post, "PostReceiptJob", QString("/_matrix/client/r0/rooms/%1/receipt/m.read/%2").arg(roomId, eventId)) { } diff --git a/jobs/roommessagesjob.cpp b/jobs/roommessagesjob.cpp index ad8bea74..6443217b 100644 --- a/jobs/roommessagesjob.cpp +++ b/jobs/roommessagesjob.cpp @@ -34,7 +34,7 @@ class RoomMessagesJob::Private RoomMessagesJob::RoomMessagesJob(ConnectionData* data, QString roomId, QString from, int limit, FetchDirection dir) - : BaseJob(data, JobHttpType::GetJob, "RoomMessagesJob", + : BaseJob(data, HttpVerb::Get, "RoomMessagesJob", QString("/_matrix/client/r0/rooms/%1/messages").arg(roomId), Query( { { "from", from } diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp index e3421d35..b3724dff 100644 --- a/jobs/syncjob.cpp +++ b/jobs/syncjob.cpp @@ -34,7 +34,7 @@ static size_t jobId = 0; SyncJob::SyncJob(ConnectionData* connection, QString since, QString filter, int timeout, QString presence) - : BaseJob(connection, JobHttpType::GetJob, QString("SyncJob-%1").arg(++jobId), + : BaseJob(connection, HttpVerb::Get, QString("SyncJob-%1").arg(++jobId), "_matrix/client/r0/sync") , d(new Private) { |