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

Method onRequestDone

launcher/minecraft/auth/steps/LauncherLoginStep.cpp:46–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void LauncherLoginStep::onRequestDone(
47 QNetworkReply::NetworkError error,
48 QByteArray data,
49 QList<QNetworkReply::RawHeaderPair> headers
50) {
51 auto requestor = qobject_cast<AuthRequest *>(QObject::sender());
52 requestor->deleteLater();
53
54#ifndef NDEBUG
55 qDebug() << data;
56#endif
57 if (error != QNetworkReply::NoError) {
58 qWarning() << "Reply error:" << error;
59#ifndef NDEBUG
60 qDebug() << data;
61#endif
62 if (Net::isApplicationError(error)) {
63 emit finished(
64 AccountTaskState::STATE_FAILED_SOFT,
65 tr("Failed to get Minecraft access token: %1").arg(requestor->errorString_)
66 );
67 }
68 else {
69 emit finished(
70 AccountTaskState::STATE_OFFLINE,
71 tr("Failed to get Minecraft access token: %1").arg(requestor->errorString_)
72 );
73 }
74 return;
75 }
76
77 if(!Parsers::parseMojangResponse(data, m_data->yggdrasilToken)) {
78 qWarning() << "Could not parse login_with_xbox response...";
79#ifndef NDEBUG
80 qDebug() << data;
81#endif
82 emit finished(
83 AccountTaskState::STATE_FAILED_SOFT,
84 tr("Failed to parse the Minecraft access token response.")
85 );
86 return;
87 }
88 emit finished(AccountTaskState::STATE_WORKING, tr(""));
89}

Callers

nothing calls this directly

Calls 2

isApplicationErrorFunction · 0.85
parseMojangResponseFunction · 0.85

Tested by

no test coverage detected