Fix regression causing inconsistencies in clientprefs auth id handling (r=VoiDeD).

This commit is contained in:
Nicholas Hastings 2014-09-11 23:53:11 -04:00
parent e72ff963f5
commit 570570f7a0
3 changed files with 12 additions and 6 deletions

View File

@ -159,7 +159,7 @@ void CookieManager::OnClientAuthorized(int client, const char *authstring)
g_ClientPrefs.AttemptReconnection(); g_ClientPrefs.AttemptReconnection();
TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial()); TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial());
UTIL_strncpy(op->m_params.steamId, authstring, MAX_NAME_LENGTH); UTIL_strncpy(op->m_params.steamId, GetPlayerCompatAuthId(player), MAX_NAME_LENGTH);
g_ClientPrefs.AddQueryToQueue(op); g_ClientPrefs.AddQueryToQueue(op);
} }
@ -181,7 +181,7 @@ void CookieManager::OnClientDisconnecting(int client)
if (player) if (player)
{ {
pAuth = player->GetAuthString(); pAuth = GetPlayerCompatAuthId(player);
g_ClientPrefs.ClearQueryCache(player->GetSerial()); g_ClientPrefs.ClearQueryCache(player->GetSerial());
} }

View File

@ -349,6 +349,13 @@ void ClientPrefs::ProcessQueryCache()
cachedQueries.clear(); cachedQueries.clear();
} }
const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer)
{
/* For legacy reasons, OnClientAuthorized gives the Steam2 id here if using Steam auth */
const char *steamId = pPlayer->GetSteam2Id();
return steamId ? steamId : pPlayer->GetAuthString();
}
size_t IsAuthIdConnected(char *authID) size_t IsAuthIdConnected(char *authID)
{ {
IGamePlayer *player; IGamePlayer *player;
@ -362,7 +369,7 @@ size_t IsAuthIdConnected(char *authID)
continue; continue;
} }
authString = player->GetAuthString(); authString = GetPlayerCompatAuthId(player);
if (authString == NULL || authString[0] == '\0') if (authString == NULL || authString[0] == '\0')
{ {
@ -394,9 +401,7 @@ void ClientPrefs::CatchLateLoadClients()
continue; continue;
} }
/* For legacy reasons, OnClientAuthorized gives the Steam2 id here if using Steam auth */ g_CookieManager.OnClientAuthorized(i, GetPlayerCompatAuthId(pPlayer));
const char *steamId = pPlayer->GetSteam2Id();
g_CookieManager.OnClientAuthorized(i, steamId ? steamId : pPlayer->GetAuthString());
} }
} }

View File

@ -181,6 +181,7 @@ public:
} }
}; };
const char *GetPlayerCompatAuthId(IGamePlayer *pPlayer);
size_t IsAuthIdConnected(char *authID); size_t IsAuthIdConnected(char *authID);
extern sp_nativeinfo_t g_ClientPrefNatives[]; extern sp_nativeinfo_t g_ClientPrefNatives[];