aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs/basejob.cpp
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-05-29 16:48:54 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-05-29 16:48:54 +0900
commitc55c1cc83985f808e9cfc7475e5113566a1ac5a8 (patch)
tree58390e0bca3972c24b41a69fd3e839ebc41f6cf2 /lib/jobs/basejob.cpp
parente58a03c84f89a5ec9091ca81ef040df659700ef2 (diff)
downloadlibquotient-c55c1cc83985f808e9cfc7475e5113566a1ac5a8.tar.gz
libquotient-c55c1cc83985f808e9cfc7475e5113566a1ac5a8.zip
BaseJob: Treat M_CONSENT_NOT_GIVEN separately from other content access errors
Closes #207.
Diffstat (limited to 'lib/jobs/basejob.cpp')
-rw-r--r--lib/jobs/basejob.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index 37ecad18..a8fc0adc 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -313,7 +313,15 @@ void BaseJob::gotReply()
emit retryScheduled(d->retriesTaken, retryInterval);
return;
}
- if (!json.isEmpty())
+ if (json.value("errcode").toString() == "M_CONSENT_NOT_GIVEN")
+ {
+ auto urlString = json.value("consent_uri").toString();
+ setStatus(UserConsentRequiredError,
+ tr("You must agree with the server's privacy policy; "
+ "please visit %1").arg(urlString));
+ d->errorUrl = urlString;
+ }
+ if (!json.isEmpty()) // FIXME: The below is not localisable
setStatus(IncorrectRequestError, json.value("error").toString());
}
}
@@ -414,7 +422,7 @@ BaseJob::Status BaseJob::parseReply(QNetworkReply* reply)
if( error.error == QJsonParseError::NoError )
return parseJson(json);
else
- return { JsonParseError, error.errorString() };
+ return { IncorrectResponseError, error.errorString() };
}
BaseJob::Status BaseJob::parseJson(const QJsonDocument&)