MCPcopy Create free account
hub / github.com/audacity/audacity / SendOptOutRequest

Method SendOptOutRequest

src/update/UpdateManager.cpp:381–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381void UpdateManager::SendOptOutRequest() const {
382 using namespace rapidjson;
383 using namespace audacity::network_manager;
384
385 std::string uuid = InstanceId->Read().ToStdString();
386
387 Document document;
388 document.SetObject().AddMember("uuid",
389 Value(uuid.c_str(), document.GetAllocator()),
390 document.GetAllocator());
391
392 StringBuffer buffer;
393 Writer<StringBuffer> writer(buffer);
394 document.Accept(writer);
395
396 Request request(GetOptOutUrl());
397
398 request.setHeader(common_headers::ContentType, common_content_types::ApplicationJson);
399 request.setHeader(common_headers::Accept, common_content_types::ApplicationJson);
400
401 auto response = NetworkManager::GetInstance().doPost(request, buffer.GetString(), buffer.GetSize());
402
403 response->setRequestFinishedCallback([response](auto) {
404 if (response->getHTTPCode() != HttpCode::OK) {
405 wxLogWarning(wxT("Failed to communicate with Audio.com. Error code: %d."), response->getHTTPCode());
406 wxLogWarning(wxT("Server response: %s"), response->readAll<std::string>());
407 }
408 });
409}
410
411void UpdateManager::UpdatePrefs()
412{

Callers

nothing calls this directly

Calls 8

setHeaderMethod · 0.80
doPostMethod · 0.80
ReadMethod · 0.45
c_strMethod · 0.45
GetStringMethod · 0.45
GetSizeMethod · 0.45
getHTTPCodeMethod · 0.45

Tested by

no test coverage detected