void CServerContext::HandleCallbackClientApprove( GSClientApprove_t *pClientApprove )
{
	std::cout << "[SERVER] Back-end approved " << pClientApprove->m_SteamID << std::endl;

	SteamUserMap::iterator iter = clientSteamMap.find( pClientApprove->m_SteamID );
	if( iter != clientSteamMap.end() )
	{
		CUser *user = iter->second;
		std::cout << "[SERVER] User " << *user << " was authed, updating user data." << std::endl;
		gameserver->UpdateUserData(user->GetSteamID(), user->GetUsername().c_str(), 0);

		gameserveritems->LoadItems(user->GetSteamID());
	}
}
void CServerContext::HandleNetClientAuth( SNetSocket_t clientSocket, NetClientAuth_t *pClientAuth )
{
	if( clientSocketMap.find( clientSocket ) != clientSocketMap.end() )
	{
		return;
	}

	if ( numClients >= MAX_CLIENTS )
	{
		NetServerConnectionDenied_t denyMsg;
		denyMsg.denyReason = EDenyServerFull;

		networking->SendDataOnSocket( clientSocket, (void *)&denyMsg, sizeof( denyMsg ), true );
		return;
	}

	uint32 clientIP;
	networking->GetSocketInfo( clientSocket, NULL, NULL, &clientIP, NULL );

	CSteamID clientSteamID;
	EConnectionDenyReason denyReason = EDenyAuthFailed;
	bool passedAuth = gameserver->SendUserConnectAndAuthenticate( clientIP, pClientAuth->authTicket, pClientAuth->ticketLen, &clientSteamID );

	if( clientSteamMap.find( clientSteamID ) != clientSteamMap.end() )
	{
		passedAuth = false;
		denyReason = EDenySteamIDExists;
	}

	if ( !passedAuth )
	{
		NetServerConnectionDenied_t denyMsg;
		denyMsg.denyReason = denyReason;

		networking->SendDataOnSocket( clientSocket, (void *)&denyMsg, sizeof( denyMsg ), true );

		return;
	}

	CUser *user = new CUser(clientSocket, clientSteamID, pClientAuth->username);

	clientSocketMap.insert( SocketUserMap::value_type( clientSocket, user ) );
	clientSteamMap.insert( SteamUserMap::value_type( user->GetSteamID(), user ) );
	numClients++;

	UpdateServerStatus();

	std::cout << "[SERVER] " << *user << " connected. Clients: " << numClients << ", Max Clients: " << MAX_CLIENTS << std::endl;

	NetServerClientAuthed_t authedMsg;
	strcpy( authedMsg.messageOfTheDay, "Welcome to the idler2 test server. Please report any bugs and issues to: VoiDeD @ irc.gamesurge.net / #opensteamworks" );

	networking->SendDataOnSocket( clientSocket, (void *)&authedMsg, sizeof( authedMsg ), true );
}