Example #1
0
bool ScmdServer_Impl::HandleBanClient( HCLIENT hClient, ILTMessage_Read& msg )
{
	// Read the id of the client to boot.
	uint16 nClientId = msg.Readuint16( );

	bool bOk = true;
	HCLIENT hBanClient = g_pLTServer->GetClientHandle( nClientId );
	if( !hBanClient )
	{
		bOk = false;
	}

	if( bOk )
	{
		uint8 aClientIP[4];
		uint16 nPort;
		g_pLTServer->GetClientAddr( hBanClient, aClientIP, &nPort );

		BanIPMgr::ClientIP clientIP = { aClientIP[0], aClientIP[1], aClientIP[2], aClientIP[3] };

		// Ban the client.
		bOk = BanIPMgr::Instance( ).AddBan( clientIP );
	}

	// Tell the client if it worked.
	ScmdCommandStatus eScmdCommandStatus = ( bOk ) ? kScmdCommandStatusOk : kScmdCommandStatusFailed;
	if( !SendStatusMessage( hClient, kScmdCommandBanClient, eScmdCommandStatus ))
		return false;

	return true;
}
Example #2
0
bool ScmdServer_Impl::HandleBootId( HCLIENT hClient, ILTMessage_Read& msg )
{
	// Read the id of the client to boot.
	uint16 nClientId = msg.Readuint16( );

	// Boot the client.
	bool bBooted = BootClient( true, nClientId, "" );

	// Tell the client if it worked.
	ScmdCommandStatus eScmdCommandStatus = ( bBooted ) ? kScmdCommandStatusOk : kScmdCommandStatusFailed;
	if( !SendStatusMessage( hClient, kScmdCommandBootId, eScmdCommandStatus ))
		return false;

	return true;
}