aboutsummaryrefslogtreecommitdiff
path: root/lib/jobs
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-20 17:48:39 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-20 17:48:39 +0900
commit20e4f76280a8ac36ca1cdfe7d0d7bdeb2eef444d (patch)
treea87f8394421c23b6456597022d01feec4f5bfe52 /lib/jobs
parent6edd8a23765285350a667ae214f5e450f5f24129 (diff)
downloadlibquotient-20e4f76280a8ac36ca1cdfe7d0d7bdeb2eef444d.tar.gz
libquotient-20e4f76280a8ac36ca1cdfe7d0d7bdeb2eef444d.zip
BaseJob: M_UNSUPPORTED_ROOM_VERSION & M_INCOMPATIBLE_ROOM_VERSION
Diffstat (limited to 'lib/jobs')
-rw-r--r--lib/jobs/basejob.cpp12
-rw-r--r--lib/jobs/basejob.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp
index 4a7780b1..628d10ec 100644
--- a/lib/jobs/basejob.cpp
+++ b/lib/jobs/basejob.cpp
@@ -325,7 +325,15 @@ void BaseJob::gotReply()
d->status.code = UserConsentRequiredError;
d->errorUrl = json.value("consent_uri"_ls).toString();
}
- else if (!json.isEmpty()) // Not localisable on the client side
+ else if (errCode == "M_UNSUPPORTED_ROOM_VERSION" ||
+ errCode == "M_INCOMPATIBLE_ROOM_VERSION")
+ {
+ d->status.code = UnsupportedRoomVersionError;
+ if (json.contains("room_version"))
+ d->status.message =
+ tr("Requested room version: %1")
+ .arg(json.value("room_version").toString());
+ } else if (!json.isEmpty()) // Not localisable on the client side
setStatus(IncorrectRequestError,
json.value("error"_ls).toString());
}
@@ -568,6 +576,8 @@ QString BaseJob::statusCaption() const
return tr("Network authentication required");
case UserConsentRequiredError:
return tr("User consent required");
+ case UnsupportedRoomVersionError:
+ return tr("The server does not support the needed room version");
default:
return tr("Request failed");
}
diff --git a/lib/jobs/basejob.h b/lib/jobs/basejob.h
index dd6f9fc8..4c1c7706 100644
--- a/lib/jobs/basejob.h
+++ b/lib/jobs/basejob.h
@@ -64,6 +64,7 @@ namespace QMatrixClient
, IncorrectResponseError
, TooManyRequestsError
, RequestNotImplementedError
+ , UnsupportedRoomVersionError
, NetworkAuthRequiredError
, UserConsentRequiredError
, UserDefinedError = 200