diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index 09388bf7..b0c4383f 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -422,6 +422,8 @@ void PlayerManager::RunAuthChecks() unsigned int client = m_AuthQueue[i]; m_AuthQueue[i] = 0; removed++; + + const char *steamId = pPlayer->GetSteam2Id(); /* Send to extensions */ List::iterator iter; @@ -429,7 +431,7 @@ void PlayerManager::RunAuthChecks() for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++) { pListener = (*iter); - pListener->OnClientAuthorized(client, authstr); + pListener->OnClientAuthorized(client, steamId ? steamId : authstr); if (!pPlayer->IsConnected()) { break; @@ -441,7 +443,8 @@ void PlayerManager::RunAuthChecks() { /* :TODO: handle the case of a player disconnecting in the middle */ m_clauth->PushCell(client); - m_clauth->PushString(authstr); + /* For legacy reasons, people are expecting the Steam2 id here if using Steam auth */ + m_clauth->PushString(steamId ? steamId : authstr); m_clauth->Execute(NULL); } @@ -707,18 +710,21 @@ void PlayerManager::OnClientPutInServer(edict_t *pEntity, const char *playername cell_t res; m_clconnect_post->PushCell(client); m_clconnect_post->Execute(&res, NULL); + + const char *steamId = pPlayer->GetSteam2Id(); /* Now do authorization */ for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++) { pListener = (*iter); - pListener->OnClientAuthorized(client, pPlayer->m_AuthID.c_str()); + pListener->OnClientAuthorized(client, steamId ? steamId : pPlayer->m_AuthID.c_str()); } /* Finally, tell plugins */ if (m_clauth->GetFunctionCount()) { m_clauth->PushCell(client); - m_clauth->PushString(pPlayer->m_AuthID.c_str()); + /* For legacy reasons, people are expecting the Steam2 id here if using Steam auth */ + m_clauth->PushString(steamId ? steamId : pPlayer->m_AuthID.c_str()); m_clauth->Execute(NULL); } pPlayer->Authorize_Post(); @@ -2151,7 +2157,7 @@ const CSteamID &CPlayer::GetSteamId(bool validated) const char *CPlayer::GetSteam2Id(bool validated) { - if (validated && !IsAuthStringValidated()) + if (!m_Steam2Id.length() || (validated && !IsAuthStringValidated())) { return NULL; } @@ -2161,7 +2167,7 @@ const char *CPlayer::GetSteam2Id(bool validated) const char *CPlayer::GetSteam3Id(bool validated) { - if (validated && !IsAuthStringValidated()) + if (!m_Steam2Id.length() || (validated && !IsAuthStringValidated())) { return NULL; } diff --git a/extensions/clientprefs/extension.cpp b/extensions/clientprefs/extension.cpp index 7ff5eee2..a31f42e6 100644 --- a/extensions/clientprefs/extension.cpp +++ b/extensions/clientprefs/extension.cpp @@ -394,7 +394,9 @@ void ClientPrefs::CatchLateLoadClients() continue; } - g_CookieManager.OnClientAuthorized(i, pPlayer->GetAuthString()); + /* For legacy reasons, OnClientAuthorized gives the Steam2 id here if using Steam auth */ + const char *steamId = pPlayer->GetSteam2Id(); + g_CookieManager.OnClientAuthorized(i, steamId ? steamId : pPlayer->GetAuthString()); } } diff --git a/plugins/include/clients.inc b/plugins/include/clients.inc index b30a3040..d914e823 100644 --- a/plugins/include/clients.inc +++ b/plugins/include/clients.inc @@ -154,14 +154,14 @@ forward Action:OnClientCommand(client, args); forward void OnClientSettingsChanged(client); /** - * Called when a client receives a Steam ID. The state of a client's + * Called when a client receives an auth ID. The state of a client's * authorization as an admin is not guaranteed here. Use * OnClientPostAdminCheck() if you need a client's admin status. * * This is called by bots, but the ID will be "BOT". * * @param client Client index. - * @param auth Client auth string. + * @param auth Client Steam2 id, if available, else engine auth id. * @noreturn */ forward void OnClientAuthorized(client, const String:auth[]); diff --git a/public/IPlayerHelpers.h b/public/IPlayerHelpers.h index 71c4a333..672cddb5 100644 --- a/public/IPlayerHelpers.h +++ b/public/IPlayerHelpers.h @@ -282,7 +282,7 @@ namespace SourceMod * * @param validated Check backend validation status. * - * @return True on success or false if not available. + * @return Steam2 Id on success or NULL if not available. */ virtual const char *GetSteam2Id(bool validated = true) =0; @@ -291,7 +291,7 @@ namespace SourceMod * * @param validated Check backend validation status. * - * @return True on success or false if not available. + * @return Steam3 Id on success or NULL if not available. */ virtual const char *GetSteam3Id(bool validated = true) =0; }; @@ -365,7 +365,7 @@ namespace SourceMod * @brief Called when a client has received authorization. * * @param client Index of the client. - * @param authstring Authorization string. + * @param authstring Client Steam2 id, if available, else engine auth id. */ virtual void OnClientAuthorized(int client, const char *authstring) {