Merge branch 'master' of ../opensim-diva/ into inventory-connector
commit
973be65945
|
@ -747,7 +747,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
InventoryItemBase itemInfo = null;
|
||||
|
||||
itemInfo = m_InventoryService.QueryItem(item);
|
||||
itemInfo = m_InventoryService.GetItem(item);
|
||||
|
||||
if (itemInfo != null)
|
||||
{
|
||||
|
@ -784,7 +784,7 @@ namespace OpenSim.Framework.Communications.Cache
|
|||
|
||||
InventoryFolderBase folderInfo = null;
|
||||
|
||||
folderInfo = m_InventoryService.QueryFolder(folder);
|
||||
folderInfo = m_InventoryService.GetFolder(folder);
|
||||
|
||||
if (folderInfo != null)
|
||||
{
|
||||
|
|
|
@ -186,14 +186,14 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
|
||||
Assert.That(
|
||||
userInfo.CreateFolder("testFolder1", folderId, (ushort)AssetType.Animation, missingFolderId), Is.False);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(missingFolderId), Is.False);
|
||||
Assert.That(userInfo.RootFolder.FindFolder(folderId), Is.Null);
|
||||
|
||||
// 2: Try a folder create that should work
|
||||
Assert.That(
|
||||
userInfo.CreateFolder("testFolder2", folderId, (ushort)AssetType.Animation, userInfo.RootFolder.ID), Is.True);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(userInfo.RootFolder.ContainsChildFolder(folderId), Is.True);
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
Assert.That(newFolderName1, Is.EqualTo(folder1.Name));
|
||||
Assert.That(folderType1, Is.EqualTo((ushort)folder1.Type));
|
||||
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder);
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder);
|
||||
Assert.That(newFolderName1, Is.EqualTo(dataFolder1.Name));
|
||||
Assert.That(folderType1, Is.EqualTo((ushort)dataFolder1.Type));
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
Assert.That(folder2.ContainsChildFolder(folder1Id), Is.True);
|
||||
Assert.That(rootFolder.ContainsChildFolder(folder1Id), Is.False);
|
||||
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.QueryFolder(myFolder2);
|
||||
InventoryFolderBase dataFolder1 = myScene.InventoryService.GetFolder(myFolder2);
|
||||
Assert.That(newFolderName2, Is.EqualTo(dataFolder1.Name));
|
||||
Assert.That(folderType2, Is.EqualTo((ushort)dataFolder1.Type));
|
||||
Assert.That(folder2Id, Is.EqualTo(dataFolder1.ParentID));
|
||||
|
@ -296,7 +296,7 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
InventoryFolderBase myFolder = new InventoryFolderBase();
|
||||
myFolder.ID = folderToMoveId;
|
||||
Assert.That(folder2.ContainsChildFolder(folderToMoveId), Is.True);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder).ParentID, Is.EqualTo(folder2Id));
|
||||
|
||||
Assert.That(folder1.ContainsChildFolder(folderToMoveId), Is.False);
|
||||
}
|
||||
|
@ -322,13 +322,13 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
myFolder.ID = folder1Id;
|
||||
|
||||
userInfo.CreateFolder("folder1", folder1Id, (ushort)AssetType.Animation, rootFolder.ID);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Not.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Not.Null);
|
||||
|
||||
// Test purge
|
||||
userInfo.PurgeFolder(rootFolder.ID);
|
||||
|
||||
Assert.That(rootFolder.RequestListOfFolders(), Is.Empty);
|
||||
Assert.That(myScene.InventoryService.QueryFolder(myFolder), Is.Null);
|
||||
Assert.That(myScene.InventoryService.GetFolder(myFolder), Is.Null);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -552,12 +552,12 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
return false;
|
||||
}
|
||||
|
||||
public InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -575,5 +575,10 @@ namespace OpenSim.Framework.Communications.Tests
|
|||
root.ParentID = UUID.Zero;
|
||||
return root;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -355,6 +355,15 @@ namespace OpenSim.Framework
|
|||
}
|
||||
protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
|
||||
|
||||
public InventoryItemBase()
|
||||
{
|
||||
}
|
||||
|
||||
public InventoryItemBase(UUID id)
|
||||
{
|
||||
ID = id;
|
||||
}
|
||||
|
||||
public object Clone()
|
||||
{
|
||||
return MemberwiseClone();
|
||||
|
|
|
@ -2156,16 +2156,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
|
||||
protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase)
|
||||
{
|
||||
// XXX: Nasty temporary move that will be resolved shortly
|
||||
InventoryFolderImpl folder = (InventoryFolderImpl)folderBase;
|
||||
|
||||
// We will use the same transaction id for all the separate packets to be sent out in this update.
|
||||
UUID transactionId = UUID.Random();
|
||||
|
||||
List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks
|
||||
= new List<BulkUpdateInventoryPacket.FolderDataBlock>();
|
||||
|
||||
SendBulkUpdateInventoryFolderRecursive(folder, ref folderDataBlocks, transactionId);
|
||||
SendBulkUpdateInventoryFolderRecursive(folderBase, ref folderDataBlocks, transactionId);
|
||||
|
||||
if (folderDataBlocks.Count > 0)
|
||||
{
|
||||
|
@ -2191,17 +2188,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
/// <param name="folderDataBlocks"></param>
|
||||
/// <param name="transactionId"></param>
|
||||
private void SendBulkUpdateInventoryFolderRecursive(
|
||||
InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
||||
InventoryFolderBase folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks,
|
||||
UUID transactionId)
|
||||
{
|
||||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||
|
||||
const int MAX_ITEMS_PER_PACKET = 5;
|
||||
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
// If there are any items then we have to start sending them off in this packet - the next folder will have
|
||||
// to be in its own bulk update packet. Also, we can only fit 5 items in a packet (at least this was the limit
|
||||
// being used on the Linden grid at 20081203).
|
||||
List<InventoryItemBase> items = folder.RequestListOfItems();
|
||||
InventoryCollection contents = invService.GetFolderContent(AgentId, folder.ID); // folder.RequestListOfItems();
|
||||
List<InventoryItemBase> items = contents.Items;
|
||||
while (items.Count > 0)
|
||||
{
|
||||
BulkUpdateInventoryPacket bulkUpdate
|
||||
|
@ -2233,8 +2232,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder));
|
||||
}
|
||||
|
||||
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
|
||||
foreach (InventoryFolderImpl subFolder in subFolders)
|
||||
List<InventoryFolderBase> subFolders = contents.Folders;
|
||||
foreach (InventoryFolderBase subFolder in subFolders)
|
||||
{
|
||||
SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId);
|
||||
}
|
||||
|
@ -6609,20 +6608,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
|||
}
|
||||
else // Agent
|
||||
{
|
||||
CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[CLIENT]: Could not resolve user {0} for caps inventory update",
|
||||
AgentId);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
break;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
|
||||
//InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
|
||||
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID));
|
||||
if (assetRequestItem == null)
|
||||
{
|
||||
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
|
|
|
@ -191,11 +191,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
InventoryItemBase item)
|
||||
{
|
||||
if (XferUploaders.ContainsKey(transactionID))
|
||||
{
|
||||
CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
|
||||
|
||||
|
@ -218,14 +213,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
Manager.MyScene.AssetService.Store(asset);
|
||||
}
|
||||
|
||||
userInfo.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update",
|
||||
remoteClient.AgentId);
|
||||
}
|
||||
IInventoryService invService = Manager.MyScene.InventoryService;
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using log4net;
|
|||
using OpenMetaverse;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
||||
{
|
||||
|
@ -214,12 +215,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
private void DoCreateItem(uint callbackID)
|
||||
{
|
||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
||||
CachedUserInfo userInfo =
|
||||
m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
ourClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = ourClient.AgentId;
|
||||
item.CreatorId = ourClient.AgentId.ToString();
|
||||
|
@ -238,15 +236,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
item.Flags = (uint) wearableType;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
userInfo.AddItem(item);
|
||||
if (invService.AddItem(item))
|
||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
|
||||
ourClient.AgentId);
|
||||
}
|
||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache;
|
|||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Agent.TextureDownload
|
||||
{
|
||||
|
@ -217,11 +218,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
|
|||
if (profile == null) // Deny unknown user
|
||||
return;
|
||||
|
||||
if (profile.RootFolder == null) // Deny no inventory
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory
|
||||
return;
|
||||
|
||||
if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
||||
return;
|
||||
// Diva 2009-08-13: this test doesn't make any sense to many devs
|
||||
//if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
|
||||
//{
|
||||
// m_log.WarnFormat("[TEXTURE]: user {0} doesn't have permissions to texture {1}");
|
||||
// return;
|
||||
//}
|
||||
|
||||
m_log.Debug("Texture preview");
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
||||
{
|
||||
|
@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
|
||||
|
||||
public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance)
|
||||
public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
|
||||
{
|
||||
if (profile.RootFolder != null)
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (invService.GetRootFolder(userID) != null)
|
||||
{
|
||||
for (int i = 0; i < 13; i++)
|
||||
{
|
||||
|
@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
else
|
||||
{
|
||||
InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID);
|
||||
InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID));
|
||||
|
||||
if (baseItem != null)
|
||||
{
|
||||
|
@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work");
|
||||
m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
|
||||
|
||||
AvatarAppearance avatAppearance = null;
|
||||
if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
|
||||
{
|
||||
|
@ -174,10 +175,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
//m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
|
||||
|
||||
if (profile != null)
|
||||
{
|
||||
if (profile.RootFolder != null)
|
||||
{
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (wear.Type < 13)
|
||||
|
@ -186,23 +183,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
}
|
||||
}
|
||||
|
||||
SetAppearanceAssets(profile, ref avatAppearance);
|
||||
SetAppearanceAssets(avatar.UUID, ref avatAppearance);
|
||||
|
||||
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
||||
avatar.Appearance = avatAppearance;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables",
|
||||
clientView.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
{
|
||||
|
|
|
@ -39,6 +39,7 @@ using OpenSim.Framework.Communications;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Friends
|
||||
{
|
||||
|
@ -654,8 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
|
|||
initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID });
|
||||
|
||||
// find the folder for the friend...
|
||||
InventoryFolderImpl folder =
|
||||
initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
|
||||
//InventoryFolderImpl folder =
|
||||
// initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
|
||||
IInventoryService invService = initiator.Scene.InventoryService;
|
||||
InventoryFolderBase folder = invService.GetFolderForType(toAgentID, AssetType.CallingCard);
|
||||
if (folder != null)
|
||||
{
|
||||
// ... and add the calling card
|
||||
|
|
|
@ -33,6 +33,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
||||
{
|
||||
|
@ -62,42 +63,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
|
|||
|
||||
public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId)
|
||||
{
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 1;
|
||||
userInfo.UpdateItem(item);
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[GESTURES]: Unable to find gesture to activate {0} for {1}", gestureId, client.Name);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name);
|
||||
m_log.WarnFormat(
|
||||
"[GESTURES]: Unable to find gesture {0} to activate for {1}", gestureId, client.Name);
|
||||
}
|
||||
|
||||
public virtual void DeactivateGesture(IClientAPI client, UUID gestureId)
|
||||
{
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(gestureId));
|
||||
if (item != null)
|
||||
{
|
||||
item.Flags = 0;
|
||||
userInfo.UpdateItem(item);
|
||||
invService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat(
|
||||
"[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
|
||||
}
|
||||
else
|
||||
m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
||||
{
|
||||
|
@ -154,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
"into agent {1}'s inventory",
|
||||
folderID, new UUID(im.toAgentID));
|
||||
|
||||
InventoryFolderImpl folderCopy
|
||||
InventoryFolderBase folderCopy
|
||||
= scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero);
|
||||
|
||||
if (folderCopy == null)
|
||||
|
@ -247,35 +248,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
// It will have been pushed to the client, too
|
||||
//
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.
|
||||
GetUserDetails(client.AgentId);
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(client.AgentId);
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
InventoryFolderImpl trashFolder =
|
||||
userInfo.FindFolderForType((int)AssetType.TrashFolder);
|
||||
InventoryFolderBase trashFolder =
|
||||
invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
|
||||
|
||||
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
|
||||
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(inventoryEntityID);
|
||||
InventoryItemBase item = invService.GetItem(new InventoryItemBase(inventoryEntityID));
|
||||
InventoryFolderBase folder = null;
|
||||
|
||||
if (item != null && trashFolder != null)
|
||||
{
|
||||
item.Folder = trashFolder.ID;
|
||||
|
||||
userInfo.DeleteItem(inventoryEntityID);
|
||||
|
||||
// Diva comment: can't we just update this item???
|
||||
invService.DeleteItem(item);
|
||||
scene.AddInventoryItem(client, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
folder = userInfo.RootFolder.FindFolder(inventoryEntityID);
|
||||
folder = invService.GetFolder(new InventoryFolderBase(inventoryEntityID));
|
||||
|
||||
if (folder != null & trashFolder != null)
|
||||
{
|
||||
userInfo.MoveFolder(inventoryEntityID, trashFolder.ID);
|
||||
folder.ParentID = trashFolder.ID;
|
||||
invService.MoveFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -293,7 +294,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
client.SendAgentAlertMessage("Unable to delete "+
|
||||
"received inventory" + reason, false);
|
||||
}
|
||||
}
|
||||
|
||||
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
|
||||
|
||||
|
@ -405,17 +405,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.
|
||||
GetUserDetails(user.ControllingClient.AgentId);
|
||||
//CachedUserInfo userInfo =
|
||||
// scene.CommsManager.UserProfileCacheService.
|
||||
// GetUserDetails(user.ControllingClient.AgentId);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
|
||||
return;
|
||||
}
|
||||
//if (userInfo == null)
|
||||
//{
|
||||
// m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
|
||||
// return;
|
||||
//}
|
||||
|
||||
AssetType assetType = (AssetType)msg.binaryBucket[0];
|
||||
IInventoryService invService = scene.InventoryService;
|
||||
|
||||
if (AssetType.Folder == assetType)
|
||||
{
|
||||
|
@ -425,31 +426,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
folder.ID = folderID;
|
||||
folder.Owner = user.ControllingClient.AgentId;
|
||||
|
||||
// Fetch from database
|
||||
// Fetch from service
|
||||
//
|
||||
if (!userInfo.QueryFolder(folder))
|
||||
folder = invService.GetFolder(folder);
|
||||
if (folder == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get folder info
|
||||
//
|
||||
InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID);
|
||||
if (folderInfo == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give");
|
||||
return;
|
||||
}
|
||||
user.ControllingClient.SendBulkUpdateInventory(folder);
|
||||
|
||||
user.ControllingClient.SendBulkUpdateInventory(folderInfo);
|
||||
|
||||
// This unelegant, slow kludge is to reload the folders and
|
||||
// items. Since a folder give can transfer subfolders and
|
||||
// items, this is the easiest way to pull that stuff in
|
||||
//
|
||||
userInfo.DropInventory();
|
||||
userInfo.FetchInventory();
|
||||
//// This unelegant, slow kludge is to reload the folders and
|
||||
//// items. Since a folder give can transfer subfolders and
|
||||
//// items, this is the easiest way to pull that stuff in
|
||||
////
|
||||
//userInfo.DropInventory();
|
||||
//userInfo.FetchInventory();
|
||||
|
||||
// Deliver message
|
||||
//
|
||||
|
@ -463,20 +456,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
|
|||
item.ID = itemID;
|
||||
item.Owner = user.ControllingClient.AgentId;
|
||||
|
||||
// Fetch from database
|
||||
// Fetch from service
|
||||
//
|
||||
if (!userInfo.QueryItem(item))
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get item info
|
||||
//
|
||||
item = userInfo.RootFolder.FindItem(item.ID);
|
||||
item = invService.GetItem(item);
|
||||
if (item == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give");
|
||||
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns>null if no root folder was found</returns>
|
||||
public abstract InventoryFolderBase GetRootFolder(UUID userID);
|
||||
public InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
// Root folder is here as system type Folder.
|
||||
return m_cache.GetFolderForType(userID, AssetType.Folder);
|
||||
}
|
||||
|
||||
public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID);
|
||||
|
||||
|
@ -184,9 +188,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// <returns>true if the item was successfully deleted</returns>
|
||||
public abstract bool DeleteItem(InventoryItemBase item);
|
||||
|
||||
public abstract InventoryItemBase QueryItem(InventoryItemBase item);
|
||||
public abstract InventoryItemBase GetItem(InventoryItemBase item);
|
||||
|
||||
public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder);
|
||||
public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
||||
|
||||
/// <summary>
|
||||
/// Does the given user have an inventory structure?
|
||||
|
@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
/// <returns></returns>
|
||||
public abstract List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||
|
||||
public abstract int GetAssetPermissions(UUID userID, UUID assetID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -238,7 +238,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID)
|
||||
{
|
||||
if (IsLocalGridUser(userID))
|
||||
{
|
||||
// This is not pretty, but it will have to do for now
|
||||
if (m_GridService is BaseInventoryConnector)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module");
|
||||
return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal");
|
||||
return GetSystemFoldersLocal(userID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
|
@ -263,6 +275,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count);
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
return folders;
|
||||
}
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Root folder content not found for {0}", userID);
|
||||
|
@ -387,13 +401,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner);
|
||||
if (IsLocalGridUser(item.Owner))
|
||||
return m_GridService.QueryItem(item);
|
||||
return m_GridService.GetItem(item);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(item.Owner);
|
||||
|
@ -402,13 +416,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
}
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
||||
if (IsLocalGridUser(folder.Owner))
|
||||
return m_GridService.QueryFolder(folder);
|
||||
return m_GridService.GetFolder(folder);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(folder.Owner);
|
||||
|
@ -422,39 +436,56 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return false;
|
||||
}
|
||||
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
if (IsLocalGridUser(userID))
|
||||
return m_GridService.GetAssetPermissions(userID, assetID);
|
||||
else
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
string uri = GetUserInventoryURI(userID) + "/" + userID.ToString();
|
||||
return m_HGService.GetAssetPermissions(uri, assetID, sessionID);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
{
|
||||
ScenePresence sp = m_Scene.GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
return sp.ControllingClient.SessionId;
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return uinfo.SessionID;
|
||||
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID);
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
private bool IsLocalGridUser(UUID userID)
|
||||
{
|
||||
if (m_UserProfileService == null)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false.");
|
||||
return false;
|
||||
}
|
||||
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo == null)
|
||||
{
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID);
|
||||
return true;
|
||||
}
|
||||
|
||||
string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI);
|
||||
string uri = m_LocalGridInventoryURI.TrimEnd('/');
|
||||
|
||||
if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == ""))
|
||||
m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri);
|
||||
|
||||
if ((userInventoryServerURI == uri) || (userInventoryServerURI == ""))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
|
||||
m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
|
||||
presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
|
||||
|
||||
if (folders.Count > 0)
|
||||
lock (m_InventoryCache)
|
||||
m_InventoryCache.Add(presence.UUID, folders);
|
||||
|
|
|
@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
foreach (InventoryFolderBase folder in content.Folders)
|
||||
{
|
||||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
||||
{
|
||||
m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type);
|
||||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
}
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type);
|
||||
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
|
@ -292,14 +299,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.DeleteItem(item);
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return m_InventoryService.QueryItem(item);
|
||||
return m_InventoryService.GetItem(item);
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return m_InventoryService.QueryFolder(folder);
|
||||
return m_InventoryService.GetFolder(folder);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -312,20 +319,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_InventoryService.HasInventoryForUser(userID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve the root inventory folder for the given user.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <returns>null if no root folder was found</returns>
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return m_InventoryService.GetRootFolder(userID);
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return m_InventoryService.GetActiveGestures(userId);
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return m_InventoryService.GetAssetPermissions(userID, assetID);
|
||||
}
|
||||
#endregion IInventoryService
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.Reflection;
|
|||
using Nini.Config;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Statistics;
|
||||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Services.Connectors;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
|
@ -48,6 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
private bool m_Enabled = false;
|
||||
private bool m_Initialized = false;
|
||||
private Scene m_Scene;
|
||||
private UserProfileCacheService m_UserProfileService;
|
||||
private InventoryServicesConnector m_RemoteConnector;
|
||||
|
||||
public Type ReplaceableInterface
|
||||
|
@ -104,12 +106,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void AddRegion(Scene scene)
|
||||
{
|
||||
m_Scene = scene;
|
||||
m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
if (!m_Initialized)
|
||||
{
|
||||
m_Scene = scene;
|
||||
// ugh!
|
||||
scene.CommsManager.UserProfileCacheService.SetInventoryService(this);
|
||||
scene.CommsManager.UserService.SetInventoryService(this);
|
||||
|
@ -130,6 +134,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
|
||||
public void RegionLoaded(Scene scene)
|
||||
{
|
||||
m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService;
|
||||
if (m_UserProfileService != null)
|
||||
m_log.Debug("[XXXX] Set m_UserProfileService in " + m_Scene.RegionInfo.RegionName);
|
||||
|
||||
if (!m_Enabled)
|
||||
return;
|
||||
|
||||
|
@ -273,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID);
|
||||
}
|
||||
|
||||
public override InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public override InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
if (item == null)
|
||||
return null;
|
||||
|
@ -282,7 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID);
|
||||
}
|
||||
|
||||
public override InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public override InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
if (folder == null)
|
||||
return null;
|
||||
|
@ -296,26 +304,40 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
return false;
|
||||
}
|
||||
|
||||
public override InventoryFolderBase GetRootFolder(UUID userID)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override List<InventoryItemBase> GetActiveGestures(UUID userId)
|
||||
{
|
||||
return new List<InventoryItemBase>();
|
||||
}
|
||||
|
||||
public override int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
UUID sessionID = GetSessionID(userID);
|
||||
return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
private UUID GetSessionID(UUID userID)
|
||||
{
|
||||
ScenePresence sp = m_Scene.GetScenePresence(userID);
|
||||
if (sp != null)
|
||||
return sp.ControllingClient.SessionId;
|
||||
if (m_Scene == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null");
|
||||
}
|
||||
|
||||
if (m_UserProfileService == null)
|
||||
{
|
||||
m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null");
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID);
|
||||
if (uinfo != null)
|
||||
return uinfo.SessionID;
|
||||
m_log.DebugFormat("[INVENTORY CONNECTOR]: user profile for {0} not found", userID);
|
||||
return UUID.Zero;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ using OpenSim.Framework;
|
|||
using OpenSim.Framework.Communications.Cache;
|
||||
using OpenSim.Region.Framework.Interfaces;
|
||||
using OpenSim.Region.Framework.Scenes;
|
||||
using OpenSim.Services.Interfaces;
|
||||
|
||||
// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
|
||||
enum GroupPowers : long
|
||||
|
@ -964,19 +965,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for edit notecard check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
|
||||
|
@ -1394,19 +1384,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for administrator check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script);
|
||||
|
@ -1499,19 +1478,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
|
|||
|
||||
if (objectID == UUID.Zero) // User inventory
|
||||
{
|
||||
CachedUserInfo userInfo =
|
||||
scene.CommsManager.UserProfileCacheService.GetUserDetails(user);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for view notecard check", user);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder == null)
|
||||
return false;
|
||||
|
||||
InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
|
||||
IInventoryService invService = m_scene.InventoryService;
|
||||
InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard));
|
||||
if (assetRequestItem == null) // Library item
|
||||
{
|
||||
assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
|
||||
|
|
|
@ -201,31 +201,31 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
}
|
||||
}
|
||||
|
||||
public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
{
|
||||
InventoryClient invCli = null;
|
||||
string inventoryURL = UserInventoryURL(item.Owner);
|
||||
if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
|
||||
{
|
||||
m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
|
||||
invCli = new InventoryClient(inventoryURL);
|
||||
m_inventoryServers.Add(inventoryURL, invCli);
|
||||
}
|
||||
//public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
|
||||
//{
|
||||
// InventoryClient invCli = null;
|
||||
// string inventoryURL = UserInventoryURL(item.Owner);
|
||||
// if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
|
||||
// {
|
||||
// m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
|
||||
// invCli = new InventoryClient(inventoryURL);
|
||||
// m_inventoryServers.Add(inventoryURL, invCli);
|
||||
// }
|
||||
|
||||
item = invCli.GetInventoryItem(item);
|
||||
if (item != null)
|
||||
{
|
||||
// Change the folder, stick it in root folder, all items flattened out here in this region cache
|
||||
item.Folder = rootFolder;
|
||||
//userInfo.AddItem(item); don't use this, it calls back to the inventory server
|
||||
lock (userInfo.RootFolder.Items)
|
||||
{
|
||||
userInfo.RootFolder.Items[item.ID] = item;
|
||||
}
|
||||
// item = invCli.GetInventoryItem(item);
|
||||
// if (item != null)
|
||||
// {
|
||||
// // Change the folder, stick it in root folder, all items flattened out here in this region cache
|
||||
// item.Folder = rootFolder;
|
||||
// //userInfo.AddItem(item); don't use this, it calls back to the inventory server
|
||||
// lock (userInfo.RootFolder.Items)
|
||||
// {
|
||||
// userInfo.RootFolder.Items[item.ID] = item;
|
||||
// }
|
||||
|
||||
}
|
||||
return item;
|
||||
}
|
||||
// }
|
||||
// return item;
|
||||
//}
|
||||
|
||||
public void Post(UUID assetID, UUID ownerID)
|
||||
{
|
||||
|
|
|
@ -117,27 +117,22 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
|
||||
if (fromTaskID.Equals(UUID.Zero))
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
if (item == null)
|
||||
{ // Fetch the item
|
||||
item = new InventoryItemBase();
|
||||
InventoryItemBase item = new InventoryItemBase(itemID);
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item.ID = itemID;
|
||||
item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
|
||||
}
|
||||
item = InventoryService.GetItem(item);
|
||||
//if (item == null)
|
||||
//{ // Fetch the item
|
||||
// item = new InventoryItemBase();
|
||||
// item.Owner = remoteClient.AgentId;
|
||||
// item.ID = itemID;
|
||||
// item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
|
||||
//}
|
||||
if (item != null)
|
||||
{
|
||||
m_assMapper.Get(item.AssetID, remoteClient.AgentId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// OK, we're done fetching. Pass it up to the default RezObject
|
||||
return base.RezObject(remoteClient, itemID, RayEnd, RayStart, RayTargetID, BypassRayCast, RayEndIsIntersection,
|
||||
|
|
|
@ -80,17 +80,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.AddItem(item);
|
||||
if (InventoryService.AddItem(item))
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Agent was not found for add of item {1} {2}", item.Name, item.ID);
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Unable to add item {1} to agent {2} inventory", item.Name, AgentId);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -98,13 +93,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void AddInventoryItem(UUID AgentID, InventoryItemBase item)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(AgentID);
|
||||
|
||||
if (userInfo != null)
|
||||
if (InventoryService.AddItem(item))
|
||||
{
|
||||
userInfo.AddItem(item);
|
||||
|
||||
int userlevel = 0;
|
||||
if (Permissions.IsGod(AgentID))
|
||||
{
|
||||
|
@ -120,8 +111,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Agent {1} was not found for add of item {2} {3}",
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Agent {1} could not add item {2} {3}",
|
||||
AgentID, item.Name, item.ID);
|
||||
|
||||
return;
|
||||
|
@ -135,22 +126,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="item">The item. This structure contains all the item metadata, including the folder
|
||||
/// in which the item is to be placed.</param>
|
||||
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
AddInventoryItem(remoteClient.AgentId, item);
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item",
|
||||
remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Capability originating call to update the asset of an item in an agent's inventory
|
||||
|
@ -161,12 +140,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns></returns>
|
||||
public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
|
@ -196,13 +170,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.AssetID = asset.FullID;
|
||||
AssetService.Store(asset);
|
||||
|
||||
userInfo.UpdateItem(item);
|
||||
InventoryService.UpdateItem(item);
|
||||
|
||||
// remoteClient.SendInventoryItemCreateUpdate(item);
|
||||
return (asset.FullID);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
|
@ -343,12 +315,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
|
||||
UUID itemID, InventoryItemBase itemUpd)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
|
@ -378,7 +345,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.SaleType = itemUpd.SaleType;
|
||||
item.Flags = itemUpd.Flags;
|
||||
|
||||
userInfo.UpdateItem(item);
|
||||
InventoryService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -396,12 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[AGENTINVENTORY]: Item ID " + itemID + " not found for an inventory item update.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error(
|
||||
"[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Give an inventory item from one user to another
|
||||
|
@ -445,24 +406,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public virtual InventoryItemBase GiveInventoryItem(
|
||||
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId)
|
||||
{
|
||||
// Retrieve the item from the sender
|
||||
CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId);
|
||||
|
||||
Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
|
||||
|
||||
if (senderUserInfo == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (senderUserInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId);
|
||||
|
||||
if (item != null)
|
||||
if ((item != null) && (item.Owner == senderId))
|
||||
{
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
|
@ -470,14 +418,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return null;
|
||||
}
|
||||
|
||||
CachedUserInfo recipientUserInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(recipient);
|
||||
|
||||
if (recipientUserInfo != null)
|
||||
{
|
||||
if (!recipientUserInfo.HasReceivedInventory)
|
||||
recipientUserInfo.FetchInventory();
|
||||
|
||||
// Insert a copy of the item into the recipient
|
||||
InventoryItemBase itemCopy = new InventoryItemBase();
|
||||
itemCopy.Owner = recipient;
|
||||
|
@ -529,39 +469,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
itemCopy.SalePrice = item.SalePrice;
|
||||
itemCopy.SaleType = item.SaleType;
|
||||
|
||||
recipientUserInfo.AddItem(itemCopy);
|
||||
InventoryService.AddItem(itemCopy);
|
||||
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
senderUserInfo.DeleteItem(itemId);
|
||||
InventoryService.DeleteItem(new InventoryItemBase(itemId));
|
||||
}
|
||||
|
||||
return itemCopy;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find userinfo for recipient user {0} of item {1}, {2} from {3}",
|
||||
recipient, item.Name,
|
||||
item.ID, senderId);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder");
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: Failed to find item {0} or item does not belong to giver ", itemId);
|
||||
return null;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -578,31 +501,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <returns>
|
||||
/// The inventory folder copy given, null if the copy was unsuccessful
|
||||
/// </returns>
|
||||
public virtual InventoryFolderImpl GiveInventoryFolder(
|
||||
public virtual InventoryFolderBase GiveInventoryFolder(
|
||||
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
|
||||
{
|
||||
// Retrieve the folder from the sender
|
||||
CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId);
|
||||
|
||||
if (null == senderUserInfo)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to find sending user {0} for folder {1}", senderId, folderId);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!senderUserInfo.HasReceivedInventory)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}",
|
||||
senderId);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId);
|
||||
|
||||
//// Retrieve the folder from the sender
|
||||
InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId));
|
||||
if (null == folder)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
|
@ -611,48 +514,37 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return null;
|
||||
}
|
||||
|
||||
CachedUserInfo recipientUserInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(recipientId);
|
||||
|
||||
if (null == recipientUserInfo)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to find receiving user {0} for folder {1}", recipientId, folderId);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!recipientUserInfo.HasReceivedInventory)
|
||||
{
|
||||
recipientUserInfo.FetchInventory();
|
||||
if (!WaitForInventory(recipientUserInfo))
|
||||
return null;
|
||||
}
|
||||
|
||||
if (recipientParentFolderId == UUID.Zero)
|
||||
recipientParentFolderId = recipientUserInfo.RootFolder.ID;
|
||||
{
|
||||
InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId);
|
||||
if (recipientRootFolder != null)
|
||||
recipientParentFolderId = recipientRootFolder.ID;
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: Unable to find root folder for receiving agent");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
UUID newFolderId = UUID.Random();
|
||||
recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId);
|
||||
|
||||
// XXX: Messy - we should really get this back in the CreateFolder call
|
||||
InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId);
|
||||
InventoryFolderBase newFolder = new InventoryFolderBase(newFolderId, folder.Name, recipientId, folder.Type, recipientParentFolderId, folder.Version);
|
||||
InventoryService.AddFolder(newFolder);
|
||||
|
||||
// Give all the subfolders
|
||||
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls();
|
||||
foreach (InventoryFolderImpl childFolder in subFolders)
|
||||
InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
|
||||
foreach (InventoryFolderBase childFolder in contents.Folders)
|
||||
{
|
||||
GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID);
|
||||
GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID);
|
||||
}
|
||||
|
||||
// Give all the items
|
||||
List<InventoryItemBase> items = folder.RequestListOfItems();
|
||||
foreach (InventoryItemBase item in items)
|
||||
foreach (InventoryItemBase item in contents.Items)
|
||||
{
|
||||
GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID);
|
||||
GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID);
|
||||
}
|
||||
|
||||
return copiedFolder;
|
||||
return newFolder;
|
||||
}
|
||||
|
||||
public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID,
|
||||
|
@ -666,16 +558,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (item == null)
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID);
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
item = userInfo.RootFolder.FindItem(oldItemID);
|
||||
item = InventoryService.GetItem(new InventoryItemBase(oldItemID));
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
|
@ -683,12 +566,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
AssetBase asset = AssetService.Get(item.AssetID.ToString());
|
||||
|
||||
|
@ -759,18 +636,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat(
|
||||
"[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
|
||||
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
|
@ -780,20 +646,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
item.Folder = folderID;
|
||||
|
||||
userInfo.DeleteItem(item.ID);
|
||||
// Diva comment: can't we just update?
|
||||
InventoryService.DeleteItem(item);
|
||||
|
||||
AddInventoryItem(remoteClient, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
|
||||
m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -829,11 +689,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
private void CreateNewInventoryItem(
|
||||
IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType,
|
||||
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = remoteClient.AgentId;
|
||||
|
@ -853,14 +708,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions = baseMask;
|
||||
item.CreationDate = creationDate;
|
||||
|
||||
userInfo.AddItem(item);
|
||||
if (InventoryService.AddItem(item))
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
|
||||
m_log.WarnFormat(
|
||||
"No user details associated with client {0} uuid {1} in CreateNewInventoryItem!",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
"Failed to add item for {0} in CreateNewInventoryItem!",
|
||||
remoteClient.Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -941,19 +796,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="itemID"></param>
|
||||
private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo == null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}",
|
||||
remoteClient.Name, remoteClient.AgentId, itemID);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
userInfo.DeleteItem(itemID);
|
||||
InventoryService.DeleteItem(new InventoryItemBase(itemID));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -964,28 +807,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// <param name="folderID"></param>
|
||||
private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID)
|
||||
{
|
||||
CachedUserInfo userInfo
|
||||
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
// Unclear is this handler is ever called by the Linden client, but it might
|
||||
|
||||
if (userInfo == null)
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID);
|
||||
folder.Owner = remoteClient.AgentId;
|
||||
InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
|
||||
if (trash != null)
|
||||
{
|
||||
m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
|
||||
return;
|
||||
}
|
||||
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase folder = userInfo.RootFolder.FindItem(folderID);
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Remove folder not implemented in request by {0} {1} for {2}",
|
||||
remoteClient.Name, remoteClient.AgentId, folderID);
|
||||
|
||||
// doesn't work just yet, commented out. will fix in next patch.
|
||||
// userInfo.DeleteItem(folder);
|
||||
}
|
||||
folder.ParentID = trash.ID;
|
||||
InventoryService.MoveFolder(folder);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1203,19 +1033,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(avatarId);
|
||||
if (profile == null || profile.RootFolder == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Avatar {0} cannot be found to add item",
|
||||
avatarId);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!profile.HasReceivedInventory)
|
||||
profile.FetchInventory();
|
||||
|
||||
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
|
||||
|
||||
if (agentItem == null)
|
||||
|
@ -1332,19 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
|
||||
{
|
||||
CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID);
|
||||
if (profile == null || profile.RootFolder == null)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Avatar {0} cannot be found to add items",
|
||||
destID);
|
||||
return UUID.Zero;
|
||||
}
|
||||
InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
|
||||
|
||||
UUID newFolderID = UUID.Random();
|
||||
|
||||
profile.CreateFolder(category, newFolderID, 0xffff, profile.RootFolder.ID);
|
||||
InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, 0xff, rootFolder.ID, rootFolder.Version);
|
||||
InventoryService.AddFolder(newFolder);
|
||||
|
||||
foreach (UUID itemID in items)
|
||||
{
|
||||
|
@ -1358,19 +1168,27 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
ScenePresence avatar;
|
||||
|
||||
ScenePresence avatar = null;
|
||||
if (TryGetAvatar(destID, out avatar))
|
||||
{
|
||||
profile.SendInventoryDecendents(avatar.ControllingClient,
|
||||
profile.RootFolder.ID, true, false);
|
||||
profile.SendInventoryDecendents(avatar.ControllingClient,
|
||||
newFolderID, false, true);
|
||||
//profile.SendInventoryDecendents(avatar.ControllingClient,
|
||||
// profile.RootFolder.ID, true, false);
|
||||
//profile.SendInventoryDecendents(avatar.ControllingClient,
|
||||
// newFolderID, false, true);
|
||||
|
||||
SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
|
||||
SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
|
||||
}
|
||||
|
||||
return newFolderID;
|
||||
}
|
||||
|
||||
private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems)
|
||||
{
|
||||
InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID);
|
||||
client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, fetchFolders, fetchItems);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Update an item in a prim (task) inventory.
|
||||
/// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see>
|
||||
|
@ -1406,14 +1224,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
UUID copyID = UUID.Random();
|
||||
if (itemID != UUID.Zero)
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item)
|
||||
{
|
||||
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
|
@ -1440,7 +1253,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Updating existing item with new perms etc
|
||||
{
|
||||
IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>();
|
||||
|
@ -1475,11 +1287,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
|
@ -1522,7 +1330,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
itemID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // script has been rezzed directly into a prim's inventory
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
|
||||
|
@ -1811,26 +1618,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
private bool WaitForInventory(CachedUserInfo info)
|
||||
{
|
||||
// 200 Seconds wait. This is called in the context of the
|
||||
// background delete thread, so we can afford to waste time
|
||||
// here.
|
||||
//
|
||||
int count = 200;
|
||||
|
||||
while (count > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
count--;
|
||||
if (info.HasReceivedInventory)
|
||||
return true;
|
||||
}
|
||||
m_log.DebugFormat("Timed out waiting for inventory of user {0}",
|
||||
info.UserProfile.ID.ToString());
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Delete a scene object from a scene and place in the given avatar's inventory.
|
||||
/// Returns the UUID of the newly created asset.
|
||||
|
@ -1848,7 +1635,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
// Get the user info of the item destination
|
||||
//
|
||||
CachedUserInfo userInfo;
|
||||
UUID userID = UUID.Zero;
|
||||
|
||||
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
|
||||
action == DeRezAction.SaveToExistingUserInventoryItem)
|
||||
|
@ -1859,30 +1646,21 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (remoteClient == null)
|
||||
return UUID.Zero;
|
||||
|
||||
userInfo = CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
remoteClient.AgentId);
|
||||
userID = remoteClient.AgentId;
|
||||
}
|
||||
else
|
||||
{
|
||||
// All returns / deletes go to the object owner
|
||||
//
|
||||
userInfo = CommsManager.UserProfileCacheService.GetUserDetails(
|
||||
objectGroup.RootPart.OwnerID);
|
||||
|
||||
userID = objectGroup.RootPart.OwnerID;
|
||||
}
|
||||
|
||||
if (userInfo == null) // Can't proceed
|
||||
if (userID == UUID.Zero) // Can't proceed
|
||||
{
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
if (!userInfo.HasReceivedInventory)
|
||||
{
|
||||
// Async inventory requests will queue, but they will never
|
||||
// execute unless inventory is actually fetched
|
||||
//
|
||||
userInfo.FetchInventory();
|
||||
}
|
||||
|
||||
// If we're returning someone's item, it goes back to the
|
||||
// owner's Lost And Found folder.
|
||||
// Delete is treated like return in this case
|
||||
|
@ -1894,8 +1672,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||
{
|
||||
item = userInfo.RootFolder.FindItem(
|
||||
objectGroup.RootPart.FromUserInventoryItemID);
|
||||
item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID);
|
||||
item = InventoryService.GetItem(item);
|
||||
|
||||
//item = userInfo.RootFolder.FindItem(
|
||||
// objectGroup.RootPart.FromUserInventoryItemID);
|
||||
|
||||
if (null == item)
|
||||
{
|
||||
|
@ -1920,53 +1701,36 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// have to wait for the inventory to find
|
||||
// the destination folder
|
||||
//
|
||||
if (!WaitForInventory(userInfo))
|
||||
return UUID.Zero;
|
||||
folder = userInfo.FindFolderForType(
|
||||
(int)AssetType.LostAndFoundFolder);
|
||||
folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume inventory skeleton was loaded during login
|
||||
// and all folders can be found
|
||||
//
|
||||
folder = userInfo.FindFolderForType(
|
||||
(int)AssetType.TrashFolder);
|
||||
folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
|
||||
}
|
||||
}
|
||||
else if (action == DeRezAction.Return)
|
||||
{
|
||||
// Wait if needed
|
||||
//
|
||||
if (!userInfo.HasReceivedInventory)
|
||||
{
|
||||
if (!WaitForInventory(userInfo))
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
// Dump to lost + found unconditionally
|
||||
//
|
||||
folder = userInfo.FindFolderForType(
|
||||
(int)AssetType.LostAndFoundFolder);
|
||||
folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
|
||||
if (folderID == UUID.Zero && folder == null)
|
||||
{
|
||||
// Catch all. Use lost & found
|
||||
//
|
||||
if (!userInfo.HasReceivedInventory)
|
||||
{
|
||||
if (!WaitForInventory(userInfo))
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
folder = userInfo.FindFolderForType(
|
||||
(int)AssetType.LostAndFoundFolder);
|
||||
folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
|
||||
}
|
||||
|
||||
if (folder == null) // None of the above
|
||||
{
|
||||
folder = userInfo.RootFolder.FindFolder(folderID);
|
||||
//folder = userInfo.RootFolder.FindFolder(folderID);
|
||||
folder = new InventoryFolderBase(folderID);
|
||||
|
||||
if (folder == null) // Nowhere to put it
|
||||
{
|
||||
|
@ -1979,7 +1743,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.ID = UUID.Random();
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = folder.ID;
|
||||
item.Owner = userInfo.UserProfile.ID;
|
||||
item.Owner = userID;
|
||||
}
|
||||
|
||||
AssetBase asset = CreateAsset(
|
||||
|
@ -1993,7 +1757,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (DeRezAction.SaveToExistingUserInventoryItem == action)
|
||||
{
|
||||
item.AssetID = asset.FullID;
|
||||
userInfo.UpdateItem(item);
|
||||
InventoryService.UpdateItem(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2034,7 +1798,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
|
||||
userInfo.AddItem(item);
|
||||
InventoryService.AddItem(item);
|
||||
|
||||
if (remoteClient != null && item.Owner == remoteClient.AgentId)
|
||||
{
|
||||
|
@ -2053,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return assetID;
|
||||
}
|
||||
|
||||
public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, UUID assetID, UUID agentID)
|
||||
public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID)
|
||||
{
|
||||
SceneObjectGroup objectGroup = grp;
|
||||
if (objectGroup != null)
|
||||
|
@ -2070,43 +1834,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(agentID);
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
{
|
||||
Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>();
|
||||
searchfolders.Enqueue(userInfo.RootFolder);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
UUID foundFolder = UUID.Zero;
|
||||
InventoryItemBase item = null;
|
||||
|
||||
// search through folders to find the asset.
|
||||
while (searchfolders.Count > 0)
|
||||
{
|
||||
InventoryFolderImpl fld = searchfolders.Dequeue();
|
||||
lock (fld)
|
||||
{
|
||||
if (fld != null)
|
||||
{
|
||||
if (fld.Items.ContainsKey(assetID))
|
||||
{
|
||||
item = fld.Items[assetID];
|
||||
foundFolder = fld.ID;
|
||||
searchfolders.Clear();
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (InventoryFolderImpl subfld in fld.RequestListOfFolderImpls())
|
||||
{
|
||||
searchfolders.Enqueue(subfld);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (foundFolder != UUID.Zero && item != null)
|
||||
if (item != null)
|
||||
{
|
||||
AssetBase asset = CreateAsset(
|
||||
objectGroup.GetPartName(objectGroup.LocalId),
|
||||
|
@ -2120,9 +1850,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
item.InvType = (int)InventoryType.Object;
|
||||
item.Folder = foundFolder;
|
||||
|
||||
userInfo.UpdateItem(item);
|
||||
InventoryService.UpdateItem(item);
|
||||
|
||||
// this gets called when the agent loggs off!
|
||||
if (remoteClient != null)
|
||||
|
@ -2132,7 +1861,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
|
||||
{
|
||||
|
@ -2141,11 +1869,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
AssetBase asset = CreateAsset(
|
||||
grp.GetPartName(grp.LocalId),
|
||||
grp.GetPartDescription(grp.LocalId),
|
||||
|
@ -2183,19 +1906,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
// sets assetID so client can show asset as 'attached' in inventory
|
||||
grp.SetFromAssetID(item.ID);
|
||||
// sets itemID so client can show item as 'attached' in inventory
|
||||
grp.SetFromItemID(item.ID);
|
||||
|
||||
userInfo.AddItem(item);
|
||||
if (InventoryService.AddItem(item))
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
else
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
|
||||
|
||||
itemID = item.ID;
|
||||
return item.AssetID;
|
||||
}
|
||||
return UUID.Zero;
|
||||
}
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Event Handler Rez an object into a scene
|
||||
|
@ -2261,17 +1984,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
BypassRayCast, bRayEndIsIntersection,true,scale, false);
|
||||
|
||||
// Rez object
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
// Do NOT use HasReceivedInventory here, this is called
|
||||
// from within ItemReceive during login for attachments.
|
||||
// Using HasReceivedInventory here will break attachment
|
||||
// persistence!
|
||||
//
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
|
@ -2331,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else
|
||||
{
|
||||
group.SetFromAssetID(itemID);
|
||||
group.SetFromItemID(itemID);
|
||||
}
|
||||
|
||||
SceneObjectPart rootPart = null;
|
||||
|
@ -2422,19 +2135,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// copy ones will be lost, so avoid it
|
||||
//
|
||||
if (!attachment)
|
||||
userInfo.DeleteItem(item.ID);
|
||||
InventoryService.DeleteItem(item);
|
||||
}
|
||||
}
|
||||
|
||||
return rootPart.ParentGroup;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: Root folder not found in {0}", RegionInfo.RegionName);
|
||||
}
|
||||
else
|
||||
m_log.WarnFormat("[AGENT INVENTORY]: User profile not found in {0}", RegionInfo.RegionName);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -2666,7 +2373,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (part == null || part.ParentGroup == null)
|
||||
return;
|
||||
|
||||
UUID inventoryID = part.ParentGroup.GetFromAssetID();
|
||||
UUID inventoryID = part.ParentGroup.GetFromItemID();
|
||||
|
||||
ScenePresence presence;
|
||||
if (TryGetAvatar(remoteClient.AgentId, out presence))
|
||||
|
@ -2681,14 +2388,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
|
||||
}
|
||||
part.ParentGroup.DetachToGround();
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.DeleteItem(inventoryID);
|
||||
|
||||
InventoryService.DeleteItem(new InventoryItemBase(inventoryID));
|
||||
remoteClient.SendRemoveInventoryItem(inventoryID);
|
||||
}
|
||||
}
|
||||
SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
|
||||
}
|
||||
|
||||
|
|
|
@ -382,31 +382,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
InventoryItemBase item = null;
|
||||
if (userProfile.RootFolder == null)
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: User {0} {1} does not have a root folder.",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
else
|
||||
item = userProfile.RootFolder.FindItem(itemID);
|
||||
InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
}
|
||||
// else shouldn't we send an alert message?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -435,23 +417,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems);
|
||||
SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle the caps inventory descendents fetch.
|
||||
///
|
||||
/// Since the folder structure is sent to the client on login, I believe we only need to handle items.
|
||||
/// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
|
||||
/// </summary>
|
||||
/// <param name="agentID"></param>
|
||||
/// <param name="folderID"></param>
|
||||
|
@ -478,58 +451,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return fold.RequestListOfItems();
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID);
|
||||
InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
|
||||
return contents.Items;
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID);
|
||||
return null;
|
||||
}
|
||||
|
||||
// XXX: When a client crosses into a scene, their entire inventory is fetched
|
||||
// asynchronously. If the client makes a request before the inventory is received, we need
|
||||
// to give the inventory a chance to come in.
|
||||
//
|
||||
// This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
|
||||
// in CAPS as doing this with the udp request, since here it won't hold up other packets.
|
||||
// In fact, here we'll be generous and try for longer.
|
||||
if (!userProfile.HasReceivedInventory)
|
||||
{
|
||||
int attempts = 0;
|
||||
while (attempts++ < 30)
|
||||
{
|
||||
m_log.DebugFormat(
|
||||
"[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
|
||||
attempts, folderID, agentID);
|
||||
|
||||
Thread.Sleep(2000);
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (userProfile.HasReceivedInventory)
|
||||
{
|
||||
if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
|
||||
{
|
||||
return fold.RequestListOfItems();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
|
||||
folderID, agentID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -543,19 +467,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType,
|
||||
string folderName, UUID parentID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1);
|
||||
if (!InventoryService.AddFolder(folder))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
|
@ -598,36 +513,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handle an inventory folder move request from the client.
|
||||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
/// <param name="parentID"></param>
|
||||
public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.MoveFolder(folderID, parentID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
|
||||
folderID, parentID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID);
|
||||
folder = InventoryService.QueryFolder(folder);
|
||||
folder = InventoryService.GetFolder(folder);
|
||||
if (folder != null)
|
||||
{
|
||||
folder.ParentID = parentID;
|
||||
|
@ -647,27 +536,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// </summary>
|
||||
/// <param name="remoteClient"></param>
|
||||
/// <param name="folderID"></param>
|
||||
|
||||
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
|
||||
{
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Could not find user profile for {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!userProfile.PurgeFolder(folderID))
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
|
||||
remoteClient.Name, remoteClient.AgentId);
|
||||
}
|
||||
}
|
||||
|
||||
public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID)
|
||||
{
|
||||
InventoryFolderBase folder = new InventoryFolderBase(folderID);
|
||||
|
||||
|
|
|
@ -1962,7 +1962,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
m_log.DebugFormat("[ATTACHMENT]: Received " +
|
||||
"attachment {0}, inworld asset id {1}",
|
||||
//grp.RootPart.LastOwnerID.ToString(),
|
||||
grp.GetFromAssetID(),
|
||||
grp.GetFromItemID(),
|
||||
grp.UUID.ToString());
|
||||
|
||||
//grp.SetFromAssetID(grp.RootPart.LastOwnerID);
|
||||
|
@ -3672,11 +3672,6 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
case 2: // Sell a copy
|
||||
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
|
||||
|
||||
CachedUserInfo userInfo =
|
||||
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (userInfo != null)
|
||||
{
|
||||
uint perms=group.GetEffectivePermissions();
|
||||
|
||||
if ((perms & (uint)PermissionMask.Transfer) == 0)
|
||||
|
@ -3722,9 +3717,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.CurrentPermissions |= 8; // Slam!
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
userInfo.AddItem(item);
|
||||
if (InventoryService.AddItem(item))
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
|
||||
|
@ -3739,8 +3733,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
foreach (UUID invID in invList)
|
||||
{
|
||||
TaskInventoryItem item = part.Inventory.GetInventoryItem(invID);
|
||||
if ((item.CurrentPermissions &
|
||||
TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID);
|
||||
if ((item1.CurrentPermissions &
|
||||
(uint)PermissionMask.Transfer) == 0)
|
||||
{
|
||||
okToSell = false;
|
||||
|
|
|
@ -1086,11 +1086,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public bool WaitForCallback(UUID id)
|
||||
{
|
||||
int count = 20;
|
||||
int count = 200;
|
||||
while (m_agentsInTransit.Contains(id) && count-- > 0)
|
||||
{
|
||||
//m_log.Debug(" >>> Waiting... " + count);
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
|
@ -1207,16 +1207,16 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
pos = pos + (agent.Velocity);
|
||||
|
||||
CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.DropInventory();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}",
|
||||
agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName);
|
||||
}
|
||||
//CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
//if (userInfo != null)
|
||||
//{
|
||||
// userInfo.DropInventory();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}",
|
||||
// agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName);
|
||||
//}
|
||||
|
||||
//bool crossingSuccessful =
|
||||
// CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos,
|
||||
|
@ -1315,11 +1315,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
else // Not successful
|
||||
{
|
||||
CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
if (userInfo != null)
|
||||
{
|
||||
userInfo.FetchInventory();
|
||||
}
|
||||
//CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
|
||||
//if (userInfo != null)
|
||||
//{
|
||||
// userInfo.FetchInventory();
|
||||
//}
|
||||
agent.RestoreInCurrentScene();
|
||||
}
|
||||
// In any case
|
||||
|
|
|
@ -442,7 +442,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (group != null)
|
||||
{
|
||||
//group.DetachToGround();
|
||||
m_parentScene.DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient);
|
||||
m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -489,7 +489,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Calls attach with a Zero position
|
||||
//
|
||||
AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromAssetID(), remoteClient.AgentId);
|
||||
m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
|
||||
}
|
||||
|
||||
public SceneObjectGroup RezSingleAttachment(
|
||||
|
@ -536,14 +536,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
if (entity is SceneObjectGroup)
|
||||
{
|
||||
group = (SceneObjectGroup)entity;
|
||||
if (group.GetFromAssetID() == itemID)
|
||||
if (group.GetFromItemID() == itemID)
|
||||
{
|
||||
m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
|
||||
group.DetachToInventoryPrep();
|
||||
m_log.Debug("[DETACH]: Saving attachpoint: " +
|
||||
((uint)group.GetAttachmentPoint()).ToString());
|
||||
m_parentScene.updateKnownAsset(remoteClient, group,
|
||||
group.GetFromAssetID(), group.OwnerID);
|
||||
m_parentScene.UpdateKnownItem(remoteClient, group,
|
||||
group.GetFromItemID(), group.OwnerID);
|
||||
m_parentScene.DeleteSceneObject(group, false);
|
||||
return;
|
||||
}
|
||||
|
@ -588,13 +588,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// Saves and gets assetID
|
||||
UUID itemId;
|
||||
|
||||
if (group.GetFromAssetID() == UUID.Zero)
|
||||
if (group.GetFromItemID() == UUID.Zero)
|
||||
{
|
||||
m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId);
|
||||
}
|
||||
else
|
||||
{
|
||||
itemId = group.GetFromAssetID();
|
||||
itemId = group.GetFromItemID();
|
||||
}
|
||||
|
||||
m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group);
|
||||
|
@ -1307,7 +1307,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
group.UpdateGroupPosition(pos);
|
||||
group.RootPart.IsAttachment = false;
|
||||
group.AbsolutePosition = group.RootPart.AttachedPos;
|
||||
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
|
||||
m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID);
|
||||
group.SetAttachmentPoint(attachmentPoint);
|
||||
|
||||
}
|
||||
|
|
|
@ -447,22 +447,22 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
public void SetFromAssetID(UUID AssetId)
|
||||
public void SetFromItemID(UUID AssetId)
|
||||
{
|
||||
lock (m_parts)
|
||||
{
|
||||
foreach (SceneObjectPart part in m_parts.Values)
|
||||
{
|
||||
part.FromAssetID = AssetId;
|
||||
part.FromItemID = AssetId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public UUID GetFromAssetID()
|
||||
public UUID GetFromItemID()
|
||||
{
|
||||
if (m_rootPart != null)
|
||||
{
|
||||
return m_rootPart.FromAssetID;
|
||||
return m_rootPart.FromItemID;
|
||||
}
|
||||
return UUID.Zero;
|
||||
}
|
||||
|
@ -3374,19 +3374,19 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public virtual string ExtraToXmlString()
|
||||
{
|
||||
return "<ExtraFromAssetID>" + GetFromAssetID().ToString() + "</ExtraFromAssetID>";
|
||||
return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>";
|
||||
}
|
||||
|
||||
public virtual void ExtraFromXmlString(string xmlstr)
|
||||
{
|
||||
string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromAssetID>"));
|
||||
id = xmlstr.Replace("<ExtraFromAssetID>", "");
|
||||
id = id.Replace("</ExtraFromAssetID>", "");
|
||||
string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromItemID>"));
|
||||
id = xmlstr.Replace("<ExtraFromItemID>", "");
|
||||
id = id.Replace("</ExtraFromItemID>", "");
|
||||
|
||||
UUID uuid = UUID.Zero;
|
||||
UUID.TryParse(id, out uuid);
|
||||
|
||||
SetFromAssetID(uuid);
|
||||
SetFromItemID(uuid);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
public uint TimeStampTerse = 0;
|
||||
|
||||
[XmlIgnore]
|
||||
public UUID FromAssetID = UUID.Zero;
|
||||
public UUID FromItemID = UUID.Zero;
|
||||
|
||||
/// <value>
|
||||
/// The UUID of the user inventory item from which this object was rezzed if this is a root part.
|
||||
|
@ -2389,7 +2389,7 @@ if (m_shape != null) {
|
|||
remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape,
|
||||
lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID,
|
||||
m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment,
|
||||
AttachmentPoint,FromAssetID, Sound, SoundGain, SoundFlags, SoundRadius);
|
||||
AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -3767,7 +3767,7 @@ if (m_shape != null) {
|
|||
(ushort)(m_parentGroup.GetTimeDilation() *
|
||||
(float)ushort.MaxValue), LocalId, lPos,
|
||||
RotationOffset, Velocity,
|
||||
RotationalVelocity, state, FromAssetID,
|
||||
RotationalVelocity, state, FromItemID,
|
||||
OwnerID, (int)AttachmentPoint);
|
||||
}
|
||||
|
||||
|
|
|
@ -833,11 +833,11 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
m_scene.SwapRootAgentCount(false);
|
||||
|
||||
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
if (userInfo != null)
|
||||
userInfo.FetchInventory();
|
||||
else
|
||||
m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
//CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||
//if (userInfo != null)
|
||||
// userInfo.FetchInventory();
|
||||
//else
|
||||
// m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||
|
||||
// On the next prim update, all objects will be sent
|
||||
//
|
||||
|
|
|
@ -2801,7 +2801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0)
|
||||
{
|
||||
SceneObjectGroup grp = m_host.ParentGroup;
|
||||
UUID itemID = grp.GetFromAssetID();
|
||||
UUID itemID = grp.GetFromItemID();
|
||||
|
||||
ScenePresence presence = World.GetScenePresence(m_host.OwnerID);
|
||||
|
||||
|
|
|
@ -110,11 +110,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
|
||||
"POST", "/QueryItem/", m_InventoryService.QueryItem, CheckAuthSession));
|
||||
"POST", "/QueryItem/", m_InventoryService.GetItem, CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
|
||||
"POST", "/QueryFolder/", m_InventoryService.QueryFolder, CheckAuthSession));
|
||||
"POST", "/QueryFolder/", m_InventoryService.GetFolder, CheckAuthSession));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, bool>(
|
||||
|
@ -153,6 +153,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>>
|
||||
("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource));
|
||||
|
||||
m_httpServer.AddStreamHandler(
|
||||
new RestDeserialiseTrustedHandler<InventoryItemBase, int>
|
||||
("POST", "/AssetPermissions/", GetAssetPermissions, CheckTrustSource));
|
||||
|
||||
}
|
||||
|
||||
#region Wrappers for converting the Guid parameter
|
||||
|
@ -185,6 +190,8 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown))
|
||||
folders[(AssetType)folder.Type] = folder;
|
||||
}
|
||||
// Put the root folder there, as type Folder
|
||||
folders[AssetType.Folder] = root;
|
||||
return folders;
|
||||
}
|
||||
}
|
||||
|
@ -235,6 +242,11 @@ namespace OpenSim.Server.Handlers.Inventory
|
|||
return m_InventoryService.GetInventorySkeleton(userID);
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(InventoryItemBase item)
|
||||
{
|
||||
return m_InventoryService.GetAssetPermissions(item.Owner, item.AssetID);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace OpenSim.Services.Connectors.Inventory
|
|||
/// <returns></returns>
|
||||
public InventoryCollection GetFolderContent(string id, UUID folderID, UUID sessionID)
|
||||
{
|
||||
m_log.Debug("[HGInventory]: GetSystemFolders " + id);
|
||||
m_log.Debug("[HGInventory]: GetFolderContent " + id);
|
||||
string url = string.Empty;
|
||||
string userID = string.Empty;
|
||||
|
||||
|
@ -279,5 +279,17 @@ namespace OpenSim.Services.Connectors.Inventory
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(string id, UUID assetID, UUID sessionID)
|
||||
{
|
||||
string url = string.Empty;
|
||||
string userID = string.Empty;
|
||||
|
||||
if (StringToUrlAndUserID(id, out url, out userID))
|
||||
{
|
||||
ISessionAuthInventoryService connector = GetConnector(url);
|
||||
return connector.GetAssetPermissions(userID, assetID, sessionID);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,5 +120,7 @@ namespace OpenSim.Services.Connectors
|
|||
|
||||
InventoryFolderBase QueryFolder(string userID, InventoryFolderBase item, UUID session_id);
|
||||
|
||||
int GetAssetPermissions(string userID, UUID assetID, UUID session_id);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -163,21 +163,21 @@ namespace OpenSim.Services.Connectors
|
|||
/// <returns></returns>
|
||||
public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(string userID, UUID sessionID)
|
||||
{
|
||||
// !!! Not just yet.
|
||||
//try
|
||||
//{
|
||||
// List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
// "POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
// Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
||||
// foreach (InventoryFolderBase f in folders)
|
||||
// dFolders[(AssetType)f.Type] = f;
|
||||
// return dFolders;
|
||||
//}
|
||||
//catch (Exception e)
|
||||
//{
|
||||
// m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
|
||||
// e.Source, e.Message);
|
||||
//}
|
||||
try
|
||||
{
|
||||
List<InventoryFolderBase> folders = SynchronousRestSessionObjectPoster<Guid, List<InventoryFolderBase>>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/SystemFolders/", new Guid(userID), sessionID.ToString(), userID.ToString());
|
||||
|
||||
Dictionary<AssetType, InventoryFolderBase> dFolders = new Dictionary<AssetType, InventoryFolderBase>();
|
||||
foreach (InventoryFolderBase f in folders)
|
||||
dFolders[(AssetType)f.Type] = f;
|
||||
return dFolders;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: GetSystemFolders operation failed, {0} {1}",
|
||||
e.Source, e.Message);
|
||||
}
|
||||
|
||||
return new Dictionary<AssetType, InventoryFolderBase>();
|
||||
}
|
||||
|
@ -348,6 +348,25 @@ namespace OpenSim.Services.Connectors
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(string userID, UUID assetID, UUID sessionID)
|
||||
{
|
||||
try
|
||||
{
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = new UUID(userID);
|
||||
item.AssetID = assetID;
|
||||
return SynchronousRestSessionObjectPoster<InventoryItemBase, int>.BeginPostObject(
|
||||
"POST", m_ServerURI + "/AssetPermissions/", item, sessionID.ToString(), userID);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.ErrorFormat("[INVENTORY CONNECTOR]: AssetPermissions operation failed, {0} {1}",
|
||||
e.Source, e.Message);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -156,12 +156,12 @@ namespace OpenSim.Services.Connectors
|
|||
return false;
|
||||
}
|
||||
|
||||
public InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -176,5 +176,10 @@ namespace OpenSim.Services.Connectors
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,9 +149,19 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <returns>true if the item was successfully deleted</returns>
|
||||
bool DeleteItem(InventoryItemBase item);
|
||||
|
||||
InventoryItemBase QueryItem(InventoryItemBase item);
|
||||
/// <summary>
|
||||
/// Get an item, given by its UUID
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
InventoryItemBase GetItem(InventoryItemBase item);
|
||||
|
||||
InventoryFolderBase QueryFolder(InventoryFolderBase folder);
|
||||
/// <summary>
|
||||
/// Get a folder, given by its UUID
|
||||
/// </summary>
|
||||
/// <param name="folder"></param>
|
||||
/// <returns></returns>
|
||||
InventoryFolderBase GetFolder(InventoryFolderBase folder);
|
||||
|
||||
/// <summary>
|
||||
/// Does the given user have an inventory structure?
|
||||
|
@ -166,5 +176,15 @@ namespace OpenSim.Services.Interfaces
|
|||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
List<InventoryItemBase> GetActiveGestures(UUID userId);
|
||||
|
||||
/// <summary>
|
||||
/// Get the union of permissions of all inventory items
|
||||
/// that hold the given assetID.
|
||||
/// </summary>
|
||||
/// <param name="userID"></param>
|
||||
/// <param name="assetID"></param>
|
||||
/// <returns>The permissions or 0 if no such asset is found in
|
||||
/// the user's inventory</returns>
|
||||
int GetAssetPermissions(UUID userID, UUID assetID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -398,7 +398,7 @@ namespace OpenSim.Services.InventoryService
|
|||
return true;
|
||||
}
|
||||
|
||||
public virtual InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public virtual InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
InventoryItemBase result = m_Database.queryInventoryItem(item.ID);
|
||||
if (result != null)
|
||||
|
@ -407,7 +407,7 @@ namespace OpenSim.Services.InventoryService
|
|||
return null;
|
||||
}
|
||||
|
||||
public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
|
||||
public virtual InventoryFolderBase GetFolder(InventoryFolderBase item)
|
||||
{
|
||||
InventoryFolderBase result = m_Database.queryInventoryFolder(item.ID);
|
||||
if (result != null)
|
||||
|
@ -465,6 +465,29 @@ namespace OpenSim.Services.InventoryService
|
|||
return null;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
InventoryFolderBase parent = GetRootFolder(userID);
|
||||
return FindAssetPerms(parent, assetID);
|
||||
}
|
||||
|
||||
private int FindAssetPerms(InventoryFolderBase folder, UUID assetID)
|
||||
{
|
||||
InventoryCollection contents = GetFolderContent(folder.Owner, folder.ID);
|
||||
|
||||
int perms = 0;
|
||||
foreach (InventoryItemBase item in contents.Items)
|
||||
{
|
||||
if (item.AssetID == assetID)
|
||||
perms = (int)item.CurrentPermissions | perms;
|
||||
}
|
||||
|
||||
foreach (InventoryFolderBase subfolder in contents.Folders)
|
||||
perms = perms | FindAssetPerms(subfolder, assetID);
|
||||
|
||||
return perms;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used to create a new user inventory.
|
||||
/// </summary>
|
||||
|
|
|
@ -148,12 +148,12 @@ namespace OpenSim.Tests.Common.Mock
|
|||
return false;
|
||||
}
|
||||
|
||||
public InventoryItemBase QueryItem(InventoryItemBase item)
|
||||
public InventoryItemBase GetItem(InventoryItemBase item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public InventoryFolderBase QueryFolder(InventoryFolderBase folder)
|
||||
public InventoryFolderBase GetFolder(InventoryFolderBase folder)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
@ -171,5 +171,10 @@ namespace OpenSim.Tests.Common.Mock
|
|||
root.ParentID = UUID.Zero;
|
||||
return root;
|
||||
}
|
||||
|
||||
public int GetAssetPermissions(UUID userID, UUID assetID)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue