aboutsummaryrefslogtreecommitdiff
path: root/jobs/syncjob.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'jobs/syncjob.cpp')
-rw-r--r--jobs/syncjob.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/jobs/syncjob.cpp b/jobs/syncjob.cpp
index 6d37db5c..ce5dd894 100644
--- a/jobs/syncjob.cpp
+++ b/jobs/syncjob.cpp
@@ -69,19 +69,13 @@ BaseJob::Status SyncData::parseJson(const QJsonDocument &data)
// TODO: account_data
QJsonObject rooms = json.value("rooms").toObject();
- static const struct { QString jsonKey; JoinState enumVal; } roomStates[]
+ for (size_t i = 0; i < JoinStateStrings.size(); ++i)
{
- { "join", JoinState::Join },
- { "invite", JoinState::Invite },
- { "leave", JoinState::Leave }
- };
- for (const auto& roomState: roomStates)
- {
- const QJsonObject rs = rooms.value(roomState.jsonKey).toObject();
+ const auto rs = rooms.value(JoinStateStrings[i]).toObject();
// We have a Qt container on the right and an STL one on the left
roomData.reserve(static_cast<size_t>(rs.size()));
for(auto roomIt = rs.begin(); roomIt != rs.end(); ++roomIt)
- roomData.emplace_back(roomIt.key(), roomState.enumVal,
+ roomData.emplace_back(roomIt.key(), JoinState(i),
roomIt.value().toObject());
}
qCDebug(PROFILER) << "*** SyncData::parseJson():" << et.elapsed() << "ms";