Merge branch 'master' into careminster-presence-refactor

This commit is contained in:
Melanie
2010-07-08 17:32:57 +01:00
18 changed files with 157 additions and 148 deletions

View File

@@ -55,7 +55,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public IJ2KDecoder J2KDecoder;
public IAssetService AssetService;
public UUID AgentID;
public IHyperAssetService HyperAssets;
public IInventoryAccessModule InventoryAccessModule;
public OpenJPEG.J2KLayerInfo[] Layers;
public bool IsDecoded;
public bool HasAsset;
@@ -378,14 +378,18 @@ namespace OpenSim.Region.ClientStack.LindenUDP
UUID assetID = UUID.Zero;
if (asset != null)
assetID = asset.FullID;
else if ((HyperAssets != null) && (sender != HyperAssets))
else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
{
// Try the user's inventory, but only if it's different from the regions'
string userAssets = HyperAssets.GetUserAssetServer(AgentID);
if ((userAssets != string.Empty) && (userAssets != HyperAssets.GetSimAssetServer()))
// Unfortunately we need this here, there's no other way.
// This is due to the fact that textures opened directly from the agent's inventory
// don't have any distinguishing feature. As such, in order to serve those when the
// foreign user is visiting, we need to try again after the first fail to the local
// asset service.
string assetServerURL = string.Empty;
if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL))
{
m_log.DebugFormat("[J2KIMAGE]: texture {0} not found in local asset storage. Trying user's storage.", id);
AssetService.Get(userAssets + "/" + id, HyperAssets, AssetReceived);
AssetService.Get(assetServerURL + "/" + id, InventoryAccessModule, AssetReceived);
return;
}
}

View File

@@ -358,7 +358,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected uint m_agentFOVCounter;
protected IAssetService m_assetService;
private IHyperAssetService m_hyperAssets;
private const bool m_checkPackets = true;
private Timer m_propertiesPacketTimer;
@@ -435,7 +434,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// m_attachmentsSent = new HashSet<uint>();
m_assetService = m_scene.RequestModuleInterface<IAssetService>();
m_hyperAssets = m_scene.RequestModuleInterface<IHyperAssetService>();
m_GroupsModule = scene.RequestModuleInterface<IGroupsModule>();
m_imageManager = new LLImageManager(this, m_assetService, Scene.RequestModuleInterface<IJ2KDecoder>());
m_channelVersion = Util.StringToBytes256(scene.GetSimulatorVersion());
@@ -7209,59 +7207,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
else // Agent
{
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, AgentId);
assetRequestItem = invService.GetItem(assetRequestItem);
if (assetRequestItem == null)
IInventoryAccessModule invAccess = m_scene.RequestModuleInterface<IInventoryAccessModule>();
if (invAccess != null)
{
ILibraryService lib = m_scene.RequestModuleInterface<ILibraryService>();
if (lib != null)
assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
if (assetRequestItem == null)
return true;
}
if (!invAccess.GetAgentInventoryItem(this, itemID, requestID))
return false;
// At this point, we need to apply perms
// only to notecards and scripts. All
// other asset types are always available
//
if (assetRequestItem.AssetType == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
{
SendAgentAlertMessage("Insufficient permissions to view script", false);
return true;
}
}
else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
{
SendAgentAlertMessage("Insufficient permissions to view notecard", false);
return true;
}
}
else
return false;
if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return true;
}
}
}
}
//m_assetCache.AddAssetRequest(this, transfer);
MakeAssetRequest(transfer, taskID);
/* RequestAsset = OnRequestAsset;
if (RequestAsset != null)
{
RequestAsset(this, transfer);
}*/
return true;
}
@@ -11498,15 +11459,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
//m_log.Debug("[XXX] inventory asset request " + requestID);
//if (taskID == UUID.Zero) // Agent
// if (m_scene is HGScene)
// {
// m_log.Debug("[XXX] hg asset request " + requestID);
// // We may need to fetch the asset from the user's asset server into the local asset server
// HGAssetMapper mapper = ((HGScene)m_scene).AssetMapper;
// mapper.Get(requestID, AgentId);
// }
}
// m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
@@ -11525,18 +11477,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <param name="asset"></param>
protected void AssetReceived(string id, Object sender, AssetBase asset)
{
if (asset == null)
return;
TransferRequestPacket transferRequest = (TransferRequestPacket)sender;
UUID requestID = UUID.Zero;
byte source = (byte)SourceType.Asset;
if ((transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
|| (transferRequest.TransferInfo.SourceType == 2222))
if (transferRequest.TransferInfo.SourceType == (int)SourceType.Asset)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 0);
}
else if ((transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
|| (transferRequest.TransferInfo.SourceType == 3333))
else if (transferRequest.TransferInfo.SourceType == (int)SourceType.SimInventoryItem)
{
requestID = new UUID(transferRequest.TransferInfo.Params, 80);
source = (byte)SourceType.SimInventoryItem;

View File

@@ -58,8 +58,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private C5.IntervalHeap<J2KImage> m_priorityQueue = new C5.IntervalHeap<J2KImage>(10, new J2KImageComparer());
private object m_syncRoot = new object();
private IHyperAssetService m_hyperAssets;
public LLClientView Client { get { return m_client; } }
public AssetBase MissingImage { get { return m_missingImage; } }
@@ -75,7 +73,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
m_log.Error("[ClientView] - Couldn't set missing image asset, falling back to missing image packet. This is known to crash the client");
m_j2kDecodeModule = pJ2kDecodeModule;
m_hyperAssets = client.Scene.RequestModuleInterface<IHyperAssetService>();
}
/// <summary>
@@ -149,7 +146,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
imgrequest.J2KDecoder = m_j2kDecodeModule;
imgrequest.AssetService = m_assetCache;
imgrequest.AgentID = m_client.AgentId;
imgrequest.HyperAssets = m_hyperAssets;
imgrequest.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
imgrequest.DiscardLevel = newRequest.DiscardLevel;
imgrequest.StartPacket = Math.Max(1, newRequest.PacketNumber);
imgrequest.Priority = newRequest.Priority;