aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-25 14:07:24 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-01-25 14:07:24 +0900
commit14abbe278dd05394ffb5b4354f54ba8795ca0b5b (patch)
tree2ec8fe1f02ff24aaa7c5ca0ae9b3d2e644c4d5e2
parentb4e699a0076fc7827fa89af33d8774d43eb017ce (diff)
parentd1663570003b20be58d4ce87e4b1d26bdf0029a8 (diff)
downloadlibquotient-14abbe278dd05394ffb5b4354f54ba8795ca0b5b.tar.gz
libquotient-14abbe278dd05394ffb5b4354f54ba8795ca0b5b.zip
Merge branch 'kitsune-invite-state-caching'
-rw-r--r--connection.cpp2
-rw-r--r--jobs/basejob.cpp7
-rw-r--r--room.cpp13
3 files changed, 14 insertions, 8 deletions
diff --git a/connection.cpp b/connection.cpp
index f498f613..efe47f86 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -551,7 +551,7 @@ void Connection::setHomeserver(const QUrl& url)
emit homeserverChanged(homeserver());
}
-static constexpr int CACHE_VERSION_MAJOR = 1;
+static constexpr int CACHE_VERSION_MAJOR = 2;
static constexpr int CACHE_VERSION_MINOR = 0;
void Connection::saveState(const QUrl &toFile) const
diff --git a/jobs/basejob.cpp b/jobs/basejob.cpp
index 720ac560..2d0d8b1b 100644
--- a/jobs/basejob.cpp
+++ b/jobs/basejob.cpp
@@ -291,9 +291,10 @@ bool checkContentType(const QByteArray& type, const QByteArrayList& patterns)
BaseJob::Status BaseJob::checkReply(QNetworkReply* reply) const
{
- qCDebug(d->logCat) << this << "returned from" << reply->url().toDisplayString();
- if (reply->error() != QNetworkReply::NoError)
- qCDebug(d->logCat) << this << "returned" << reply->error();
+ qCDebug(d->logCat) << this << "returned"
+ << (reply->error() == QNetworkReply::NoError ?
+ "Success" : reply->errorString())
+ << "from" << reply->url().toDisplayString();
switch( reply->error() )
{
case QNetworkReply::NoError:
diff --git a/room.cpp b/room.cpp
index ab7f7a8f..71b7b228 100644
--- a/room.cpp
+++ b/room.cpp
@@ -1467,7 +1467,9 @@ QJsonObject Room::Private::toJson() const
QJsonObject roomStateObj;
roomStateObj.insert("events", stateEvents);
- result.insert("state", roomStateObj);
+ result.insert(
+ joinState == JoinState::Invite ? "invite_state" : "state",
+ roomStateObj);
}
if (!q->readMarkerEventId().isEmpty())
@@ -1499,9 +1501,12 @@ QJsonObject Room::Private::toJson() const
}
QJsonObject unreadNotificationsObj;
- unreadNotificationsObj.insert("highlight_count", highlightCount);
- unreadNotificationsObj.insert("notification_count", notificationCount);
- result.insert("unread_notifications", unreadNotificationsObj);
+ if (highlightCount > 0)
+ unreadNotificationsObj.insert("highlight_count", highlightCount);
+ if (notificationCount > 0)
+ unreadNotificationsObj.insert("notification_count", notificationCount);
+ if (!unreadNotificationsObj.isEmpty())
+ result.insert("unread_notifications", unreadNotificationsObj);
return result;
}