Skip to content

Commit

Permalink
Finish removing UploadProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Feb 12, 2018
1 parent 7e6487c commit 439a919
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
8 changes: 8 additions & 0 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,8 @@ void DownloadManager::UploadScoreWithReplayData(HighScore* hs)
AddSessionCookieToCURL(curlHandle);
curl_easy_setopt(curlHandle, CURLOPT_HTTPPOST, form);
function<void(HTTPRequest&)> done = [this,hs](HTTPRequest& req) {
long response_code;
curl_easy_getinfo(req.handle, CURLINFO_RESPONSE_CODE, &response_code);
Json::Value json;
RString error;
hs->AddUploadedServer(serverURL.Get());
Expand All @@ -624,6 +626,7 @@ void DownloadManager::UploadScoreWithReplayData(HighScore* hs)
(DLMAN->sessionRatings)[ss] = ratings.get(SkillsetToString(ss), "0.0").asDouble();
(DLMAN->sessionRatings)[Skill_Overall] = ratings.get("player_rating", "0.0").asDouble();
}
HTTPRunning = response_code;
};
HTTPRequest* req = new HTTPRequest(curlHandle, done);
SetCURLResultsString(curlHandle, req->result);
Expand Down Expand Up @@ -753,6 +756,9 @@ void DownloadManager::RequestChartLeaderBoard(string chartkey)
return;
vector<OnlineScore> & vec = DLMAN->chartLeaderboards[chartkey];
vec.clear();
LOG->Trace(req.result.c_str());
LOG->Trace(json.toStyledString().c_str());
LOG->Flush();
for (auto it = json.begin(); it != json.end(); ++it) {
OnlineScore tmp;
tmp.wife = atof((*it).get("wifescore", "0.0").asCString());
Expand Down Expand Up @@ -813,6 +819,8 @@ void DownloadManager::RefreshTop25(Skillset ss)
function<void(HTTPRequest&)> done = [ss](HTTPRequest& req) {
Json::Value json;
RString error;
LOG->Trace(req.result.c_str());
LOG->Flush();
if (!JsonUtil::LoadFromString(json, req.result, error) || (json.isObject() && json.isMember("error")))
return;
vector<OnlineTopScore> & vec = DLMAN->topScores[ss];
Expand Down
21 changes: 0 additions & 21 deletions src/ProfileManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -861,26 +861,6 @@ class LunaProfileManager: public Luna<ProfileManager>
LuaHelpers::CreateTableFromArray<RString>( vsProfileNames, L );
return 1;
}
static int UploadProfile(T* p, lua_State *L)
{
if (lua_gettop(L) <1 ) {
return luaL_error(L, "UploadProfile expects at least 1 argument(player number[, user, pass])");
}
Profile* prof = p->GetProfile(Enum::Check<PlayerNumber>(L, 1));
if (prof == nullptr) {
return luaL_error(L, "UploadProfile needs a profile to be currently selected");
}
if (!lua_isnil(L, 2) && !lua_isnil(L, 3)) {
string user = SArg(2);
string pass = SArg(3);
DLMAN->StartSession(user, pass);
}
if(prof->profiledir == "")
lua_pushboolean(L, false);
else
lua_pushboolean(L, DLMAN->UploadProfile(prof->profiledir + "Etterna.xml", prof->m_sDisplayName.c_str()));
return 1;
}
LunaProfileManager()
{
ADD_METHOD(GetStatsPrefix);
Expand All @@ -900,7 +880,6 @@ class LunaProfileManager: public Luna<ProfileManager>
//
ADD_METHOD( SaveProfile );
ADD_METHOD( ConvertProfile );
ADD_METHOD( UploadProfile );
ADD_METHOD( SaveLocalProfile );
ADD_METHOD( GetSongNumTimesPlayed );
ADD_METHOD( GetLocalProfileIDs );
Expand Down

0 comments on commit 439a919

Please sign in to comment.