| 404 | } |
| 405 | |
| 406 | void PlayerManager::RunAuthChecks() |
| 407 | { |
| 408 | CPlayer *pPlayer; |
| 409 | const char *authstr; |
| 410 | unsigned int removed = 0; |
| 411 | for (unsigned int i=1; i<=m_AuthQueue[0]; i++) |
| 412 | { |
| 413 | pPlayer = &m_Players[m_AuthQueue[i]]; |
| 414 | pPlayer->UpdateAuthIds(); |
| 415 | |
| 416 | authstr = pPlayer->m_AuthID.c_str(); |
| 417 | |
| 418 | if (!pPlayer->IsAuthStringValidated()) |
| 419 | { |
| 420 | continue; // we're using steam auth, and steam doesn't know about this player yet so we can't do anything about them for now |
| 421 | } |
| 422 | |
| 423 | if (authstr && authstr[0] != '\0' |
| 424 | && (strcmp(authstr, "STEAM_ID_PENDING") != 0)) |
| 425 | { |
| 426 | /* Set authorization */ |
| 427 | pPlayer->Authorize(); |
| 428 | |
| 429 | /* Mark as removed from queue */ |
| 430 | unsigned int client = m_AuthQueue[i]; |
| 431 | m_AuthQueue[i] = 0; |
| 432 | removed++; |
| 433 | |
| 434 | const char *steamId = pPlayer->GetSteam2Id(); |
| 435 | |
| 436 | /* Send to extensions */ |
| 437 | List<IClientListener *>::iterator iter; |
| 438 | IClientListener *pListener; |
| 439 | for (iter=m_hooks.begin(); iter!=m_hooks.end(); iter++) |
| 440 | { |
| 441 | pListener = (*iter); |
| 442 | pListener->OnClientAuthorized(client, steamId ? steamId : authstr); |
| 443 | if (!pPlayer->IsConnected()) |
| 444 | { |
| 445 | break; |
| 446 | } |
| 447 | } |
| 448 | |
| 449 | /* Send to plugins if player is still connected */ |
| 450 | if (pPlayer->IsConnected() && m_clauth->GetFunctionCount()) |
| 451 | { |
| 452 | /* :TODO: handle the case of a player disconnecting in the middle */ |
| 453 | m_clauth->PushCell(client); |
| 454 | /* For legacy reasons, people are expecting the Steam2 id here if using Steam auth */ |
| 455 | m_clauth->PushString(steamId ? steamId : authstr); |
| 456 | m_clauth->Execute(NULL); |
| 457 | } |
| 458 | |
| 459 | if (pPlayer->IsConnected()) |
| 460 | { |
| 461 | pPlayer->Authorize_Post(); |
| 462 | } |
| 463 | } |
no test coverage detected