diff options
Diffstat (limited to 'lib/jobs')
-rw-r--r-- | lib/jobs/basejob.cpp | 6 | ||||
-rw-r--r-- | lib/jobs/basejob.h | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp index 8d11cc83..9a5460d4 100644 --- a/lib/jobs/basejob.cpp +++ b/lib/jobs/basejob.cpp @@ -505,14 +505,18 @@ QByteArray BaseJob::errorDetails() const void BaseJob::setStatus(Status s) { + if (d->status == s) + return; + + s.message.replace(d->connection->accessToken(), "(REDACTED)"); if (!s.good()) qCWarning(d->logCat) << this << "status" << s; d->status = std::move(s); + emit statusChanged(d->status); } void BaseJob::setStatus(int code, QString message) { - message.replace(d->connection->accessToken(), "(REDACTED)"); setStatus({ code, std::move(message) }); } diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h index eec09506..6c91a333 100644 --- a/lib/jobs/basejob.h +++ b/lib/jobs/basejob.h @@ -107,6 +107,15 @@ namespace QMatrixClient << s.code << ": " << s.message; } + bool operator==(const Status& other) const + { + return code == other.code && message == other.message; + } + bool operator!=(const Status& other) const + { + return !operator==(other); + } + int code; QString message; }; @@ -156,6 +165,9 @@ namespace QMatrixClient /** The job has sent a network request */ void started(); + /** The job has changed its status */ + void statusChanged(Status newStatus); + /** * The previous network request has failed; the next attempt will * be done in the specified time |