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

Method checkName

launcher/ui/dialogs/ProfileSetupDialog.cpp:147–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

145
146
147void ProfileSetupDialog::checkName(const QString &name) {
148 if(isChecking) {
149 return;
150 }
151
152 currentCheck = name;
153 isChecking = true;
154
155 auto token = m_accountToSetup->accessToken();
156
157 auto url = QString("https://api.minecraftservices.com/minecraft/profile/name/%1/available").arg(name);
158 QNetworkRequest request = QNetworkRequest(url);
159 request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
160 request.setRawHeader("Accept", "application/json");
161 request.setRawHeader("Authorization", QString("Bearer %1").arg(token).toUtf8());
162
163 AuthRequest *requestor = new AuthRequest(this);
164 connect(requestor, &AuthRequest::finished, this, &ProfileSetupDialog::checkFinished);
165 requestor->get(request);
166}
167
168void ProfileSetupDialog::checkFinished(
169 QNetworkReply::NetworkError error,

Callers

nothing calls this directly

Calls 3

QStringClass · 0.85
accessTokenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected