MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / parseRolloutResponse

Function parseRolloutResponse

launcher/minecraft/auth/Parsers.cpp:425–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423}
424
425bool parseRolloutResponse(QByteArray & data, bool& result) {
426 qDebug() << "Parsing Rollout response...";
427#ifndef NDEBUG
428 qDebug() << data;
429#endif
430
431 QJsonParseError jsonError;
432 QJsonDocument doc = QJsonDocument::fromJson(data, &jsonError);
433 if(jsonError.error) {
434 qWarning() << "Failed to parse response from https://api.minecraftservices.com/rollout/v1/msamigration as JSON: " << jsonError.errorString();
435 return false;
436 }
437
438 auto obj = doc.object();
439 QString feature;
440 if(!getString(obj.value("feature"), feature)) {
441 qWarning() << "Rollout feature is not a string";
442 return false;
443 }
444 if(feature != "msamigration") {
445 qWarning() << "Rollout feature is not what we expected (msamigration), but is instead \"" << feature << "\"";
446 return false;
447 }
448 if(!getBool(obj.value("rollout"), result)) {
449 qWarning() << "Rollout feature is not a string";
450 return false;
451 }
452 return true;
453}
454
455bool parseMojangResponse(QByteArray & data, Katabasis::Token &output) {
456 QJsonParseError jsonError;

Callers 1

onRequestDoneMethod · 0.85

Calls 4

fromJsonFunction · 0.85
getStringFunction · 0.85
getBoolFunction · 0.85
objectMethod · 0.80

Tested by

no test coverage detected