core/PlayerManager.cpp
changeset 1688 513a3b2dd86d
parent 1621 ac5d4c68a99a
child 1813 372939c88bc7
     1.1 --- a/core/PlayerManager.cpp	Sat Nov 17 01:43:25 2007 +0000
     1.2 +++ b/core/PlayerManager.cpp	Sat Nov 17 02:54:44 2007 +0000
     1.3 @@ -1295,12 +1295,32 @@
     1.4  
     1.5  void CPlayer::DoPostConnectAuthorization()
     1.6  {
     1.7 +	bool delay = false;
     1.8 +
     1.9 +	List<IClientListener *>::iterator iter;
    1.10 +	for (iter = g_Players.m_hooks.begin();
    1.11 +		 iter != g_Players.m_hooks.end();
    1.12 +		 iter++)
    1.13 +	{
    1.14 +		IClientListener *pListener = (*iter);
    1.15 +#if defined MIN_API_FOR_ADMINCALLS
    1.16 +		if (pListener->GetClientListenerVersion() < MIN_API_FOR_ADMINCALLS)
    1.17 +		{
    1.18 +			continue;
    1.19 +		}
    1.20 +#endif
    1.21 +		if (!pListener->OnClientPreAdminCheck(m_iIndex))
    1.22 +		{
    1.23 +			delay = true;
    1.24 +		}
    1.25 +	}
    1.26 +	
    1.27  	cell_t result = 0;
    1.28  	PreAdminCheck->PushCell(m_iIndex);
    1.29  	PreAdminCheck->Execute(&result);
    1.30  
    1.31  	/* Defer, for better or worse */
    1.32 -	if ((ResultType)result >= Pl_Handled)
    1.33 +	if (delay || (ResultType)result >= Pl_Handled)
    1.34  	{
    1.35  		return;
    1.36  	}
    1.37 @@ -1318,6 +1338,15 @@
    1.38  	NotifyPostAdminChecks();
    1.39  }
    1.40  
    1.41 +bool CPlayer::RunAdminCacheChecks()
    1.42 +{
    1.43 +	AdminId old_id = GetAdminId();
    1.44 +
    1.45 +	DoBasicAdminChecks();
    1.46 +
    1.47 +	return (GetAdminId() != old_id);
    1.48 +}
    1.49 +
    1.50  void CPlayer::NotifyPostAdminChecks()
    1.51  {
    1.52  	if (m_bAdminCheckSignalled)
    1.53 @@ -1328,6 +1357,21 @@
    1.54  	/* Block beforehand so they can't double-call */
    1.55  	m_bAdminCheckSignalled = true;
    1.56  
    1.57 +	List<IClientListener *>::iterator iter;
    1.58 +	for (iter = g_Players.m_hooks.begin();
    1.59 +		iter != g_Players.m_hooks.end();
    1.60 +		iter++)
    1.61 +	{
    1.62 +		IClientListener *pListener = (*iter);
    1.63 +#if defined MIN_API_FOR_ADMINCALLS
    1.64 +		if (pListener->GetClientListenerVersion() < MIN_API_FOR_ADMINCALLS)
    1.65 +		{
    1.66 +			continue;
    1.67 +		}
    1.68 +#endif
    1.69 +		pListener->OnClientPostAdminCheck(m_iIndex);
    1.70 +	}
    1.71 +
    1.72  	PostAdminCheck->PushCell(m_iIndex);
    1.73  	PostAdminCheck->Execute(NULL);
    1.74  }