Redirected all calls to CachedUserProfile methods to the inventory service. Redirection of the RootFolder property is still todo. This compiles but probably inventory will be inconsistent.

arthursv
Diva Canto 2009-08-12 20:39:48 -07:00
parent 41ad610f3e
commit 7aa54593e0
11 changed files with 614 additions and 893 deletions

View File

@ -355,6 +355,15 @@ namespace OpenSim.Framework
} }
protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds; protected int m_creationDate = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;
public InventoryItemBase()
{
}
public InventoryItemBase(UUID id)
{
ID = id;
}
public object Clone() public object Clone()
{ {
return MemberwiseClone(); return MemberwiseClone();

View File

@ -191,11 +191,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
InventoryItemBase item) InventoryItemBase item)
{ {
if (XferUploaders.ContainsKey(transactionID)) if (XferUploaders.ContainsKey(transactionID))
{
CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
remoteClient.AgentId);
if (userInfo != null)
{ {
UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId); UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
@ -218,14 +213,8 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
Manager.MyScene.AssetService.Store(asset); Manager.MyScene.AssetService.Store(asset);
} }
userInfo.UpdateItem(item); IInventoryService invService = Manager.MyScene.InventoryService;
} invService.UpdateItem(item);
else
{
m_log.ErrorFormat(
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update",
remoteClient.AgentId);
}
} }
} }
} }

View File

@ -32,6 +32,7 @@ using log4net;
using OpenMetaverse; using OpenMetaverse;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Agent.AssetTransaction namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
{ {
@ -214,12 +215,9 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
private void DoCreateItem(uint callbackID) private void DoCreateItem(uint callbackID)
{ {
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); 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(); InventoryItemBase item = new InventoryItemBase();
item.Owner = ourClient.AgentId; item.Owner = ourClient.AgentId;
item.CreatorId = ourClient.AgentId.ToString(); item.CreatorId = ourClient.AgentId.ToString();
@ -238,15 +236,10 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
item.Flags = (uint) wearableType; item.Flags = (uint) wearableType;
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
userInfo.AddItem(item); if (invService.AddItem(item))
ourClient.SendInventoryItemCreateUpdate(item, callbackID); ourClient.SendInventoryItemCreateUpdate(item, callbackID);
}
else else
{ ourClient.SendAlertMessage("Unable to create inventory item");
m_log.ErrorFormat(
"[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
ourClient.AgentId);
}
} }
/// <summary> /// <summary>

View File

@ -39,6 +39,7 @@ using OpenSim.Framework.Communications;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Friends namespace OpenSim.Region.CoreModules.Avatar.Friends
{ {
@ -654,8 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID }); initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID });
// find the folder for the friend... // find the folder for the friend...
InventoryFolderImpl folder = //InventoryFolderImpl folder =
initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard); // 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) if (folder != null)
{ {
// ... and add the calling card // ... and add the calling card

View File

@ -33,6 +33,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Gestures 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) 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 = invService.QueryItem(new InventoryItemBase(gestureId));
{
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
if (item != null) if (item != null)
{ {
item.Flags = 1; item.Flags = 1;
userInfo.UpdateItem(item); invService.UpdateItem(item);
} }
else else
m_log.ErrorFormat( m_log.WarnFormat(
"[GESTURES]: Unable to find gesture to activate {0} for {1}", gestureId, client.Name); "[GESTURES]: Unable to find gesture {0} to activate for {1}", gestureId, client.Name);
}
else
m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name);
} }
public virtual void DeactivateGesture(IClientAPI client, UUID gestureId) 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 = invService.QueryItem(new InventoryItemBase(gestureId));
{
InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId);
if (item != null) if (item != null)
{ {
item.Flags = 0; item.Flags = 0;
userInfo.UpdateItem(item); invService.UpdateItem(item);
} }
else else
m_log.ErrorFormat( m_log.ErrorFormat(
"[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name); "[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);
}
} }
} }

View File

@ -35,6 +35,7 @@ using OpenSim.Framework;
using OpenSim.Framework.Communications.Cache; using OpenSim.Framework.Communications.Cache;
using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes;
using OpenSim.Services.Interfaces;
namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
{ {
@ -154,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
"into agent {1}'s inventory", "into agent {1}'s inventory",
folderID, new UUID(im.toAgentID)); folderID, new UUID(im.toAgentID));
InventoryFolderImpl folderCopy InventoryFolderBase folderCopy
= scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero); = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero);
if (folderCopy == null) if (folderCopy == null)
@ -247,35 +248,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
// It will have been pushed to the client, too // It will have been pushed to the client, too
// //
CachedUserInfo userInfo = //CachedUserInfo userInfo =
scene.CommsManager.UserProfileCacheService. // scene.CommsManager.UserProfileCacheService.
GetUserDetails(client.AgentId); // GetUserDetails(client.AgentId);
IInventoryService invService = scene.InventoryService;
if (userInfo != null) InventoryFolderBase trashFolder =
{ invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
InventoryFolderImpl trashFolder =
userInfo.FindFolderForType((int)AssetType.TrashFolder);
UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
InventoryItemBase item = userInfo.RootFolder.FindItem(inventoryEntityID); InventoryItemBase item = invService.QueryItem(new InventoryItemBase(inventoryEntityID));
InventoryFolderBase folder = null; InventoryFolderBase folder = null;
if (item != null && trashFolder != null) if (item != null && trashFolder != null)
{ {
item.Folder = trashFolder.ID; item.Folder = trashFolder.ID;
userInfo.DeleteItem(inventoryEntityID); // Diva comment: can't we just update this item???
invService.DeleteItem(item);
scene.AddInventoryItem(client, item); scene.AddInventoryItem(client, item);
} }
else else
{ {
folder = userInfo.RootFolder.FindFolder(inventoryEntityID); folder = invService.QueryFolder(new InventoryFolderBase(inventoryEntityID));
if (folder != null & trashFolder != null) 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 "+ client.SendAgentAlertMessage("Unable to delete "+
"received inventory" + reason, false); "received inventory" + reason, false);
} }
}
ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
@ -405,17 +405,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
return; return;
} }
CachedUserInfo userInfo = //CachedUserInfo userInfo =
scene.CommsManager.UserProfileCacheService. // scene.CommsManager.UserProfileCacheService.
GetUserDetails(user.ControllingClient.AgentId); // GetUserDetails(user.ControllingClient.AgentId);
if (userInfo == null) //if (userInfo == null)
{ //{
m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient"); // m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
return; // return;
} //}
AssetType assetType = (AssetType)msg.binaryBucket[0]; AssetType assetType = (AssetType)msg.binaryBucket[0];
IInventoryService invService = scene.InventoryService;
if (AssetType.Folder == assetType) if (AssetType.Folder == assetType)
{ {
@ -425,31 +426,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
folder.ID = folderID; folder.ID = folderID;
folder.Owner = user.ControllingClient.AgentId; folder.Owner = user.ControllingClient.AgentId;
// Fetch from database // Fetch from service
// //
if (!userInfo.QueryFolder(folder)) folder = invService.QueryFolder(folder);
if (folder == null)
{ {
m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give"); m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
return; return;
} }
// Get folder info user.ControllingClient.SendBulkUpdateInventory(folder);
//
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(folderInfo); //// This unelegant, slow kludge is to reload the folders and
//// items. Since a folder give can transfer subfolders and
// This unelegant, slow kludge is to reload the folders and //// items, this is the easiest way to pull that stuff in
// items. Since a folder give can transfer subfolders and ////
// items, this is the easiest way to pull that stuff in //userInfo.DropInventory();
// //userInfo.FetchInventory();
userInfo.DropInventory();
userInfo.FetchInventory();
// Deliver message // Deliver message
// //
@ -463,20 +456,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
item.ID = itemID; item.ID = itemID;
item.Owner = user.ControllingClient.AgentId; item.Owner = user.ControllingClient.AgentId;
// Fetch from database // Fetch from service
// //
if (!userInfo.QueryItem(item)) item = invService.QueryItem(item);
{
m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
return;
}
// Get item info
//
item = userInfo.RootFolder.FindItem(item.ID);
if (item == null) 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; return;
} }

View File

@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); 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}", 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); presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
if (folders.Count > 0) if (folders.Count > 0)
lock (m_InventoryCache) lock (m_InventoryCache)
m_InventoryCache.Add(presence.UUID, folders); m_InventoryCache.Add(presence.UUID, folders);

View File

@ -80,17 +80,12 @@ namespace OpenSim.Region.Framework.Scenes
public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
{ {
CachedUserInfo userInfo if (InventoryService.AddItem(item))
= CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
if (userInfo != null)
{
userInfo.AddItem(item);
return true; return true;
}
else else
{ {
m_log.ErrorFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Agent was not found for add of item {1} {2}", item.Name, item.ID); "[AGENT INVENTORY]: Unable to add item {1} to agent {2} inventory", item.Name, AgentId);
return false; return false;
} }
@ -98,13 +93,9 @@ namespace OpenSim.Region.Framework.Scenes
public void AddInventoryItem(UUID AgentID, InventoryItemBase item) 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; int userlevel = 0;
if (Permissions.IsGod(AgentID)) if (Permissions.IsGod(AgentID))
{ {
@ -120,8 +111,8 @@ namespace OpenSim.Region.Framework.Scenes
} }
else else
{ {
m_log.ErrorFormat( m_log.WarnFormat(
"[AGENT INVENTORY]: Agent {1} was not found for add of item {2} {3}", "[AGENT INVENTORY]: Agent {1} could not add item {2} {3}",
AgentID, item.Name, item.ID); AgentID, item.Name, item.ID);
return; 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 /// <param name="item">The item. This structure contains all the item metadata, including the folder
/// in which the item is to be placed.</param> /// in which the item is to be placed.</param>
public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item)
{
CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{ {
AddInventoryItem(remoteClient.AgentId, item); AddInventoryItem(remoteClient.AgentId, item);
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
} }
else
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item",
remoteClient.AgentId);
}
}
/// <summary> /// <summary>
/// Capability originating call to update the asset of an item in an agent's inventory /// 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> /// <returns></returns>
public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
{ {
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
if (userInfo != null)
{
if (userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
if (item != null) if (item != null)
{ {
@ -196,13 +170,11 @@ namespace OpenSim.Region.Framework.Scenes
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
AssetService.Store(asset); AssetService.Store(asset);
userInfo.UpdateItem(item); InventoryService.UpdateItem(item);
// remoteClient.SendInventoryItemCreateUpdate(item); // remoteClient.SendInventoryItemCreateUpdate(item);
return (asset.FullID); return (asset.FullID);
} }
}
}
else else
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
@ -343,12 +315,7 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
UUID itemID, InventoryItemBase itemUpd) UUID itemID, InventoryItemBase itemUpd)
{ {
CachedUserInfo userInfo InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null && userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
if (item != null) if (item != null)
{ {
@ -378,7 +345,7 @@ namespace OpenSim.Region.Framework.Scenes
item.SaleType = itemUpd.SaleType; item.SaleType = itemUpd.SaleType;
item.Flags = itemUpd.Flags; item.Flags = itemUpd.Flags;
userInfo.UpdateItem(item); InventoryService.UpdateItem(item);
} }
else else
{ {
@ -396,12 +363,6 @@ namespace OpenSim.Region.Framework.Scenes
"[AGENTINVENTORY]: Item ID " + itemID + " not found for an inventory item update."); "[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> /// <summary>
/// Give an inventory item from one user to another /// Give an inventory item from one user to another
@ -445,24 +406,11 @@ namespace OpenSim.Region.Framework.Scenes
public virtual InventoryItemBase GiveInventoryItem( public virtual InventoryItemBase GiveInventoryItem(
UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) 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"); Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
if (senderUserInfo == null) InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemId));
{
m_log.ErrorFormat(
"[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId);
return null; if ((item != null) && (item.Owner == senderId))
}
if (senderUserInfo.RootFolder != null)
{
InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId);
if (item != null)
{ {
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
@ -470,14 +418,6 @@ namespace OpenSim.Region.Framework.Scenes
return null; 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 // Insert a copy of the item into the recipient
InventoryItemBase itemCopy = new InventoryItemBase(); InventoryItemBase itemCopy = new InventoryItemBase();
itemCopy.Owner = recipient; itemCopy.Owner = recipient;
@ -529,39 +469,22 @@ namespace OpenSim.Region.Framework.Scenes
itemCopy.SalePrice = item.SalePrice; itemCopy.SalePrice = item.SalePrice;
itemCopy.SaleType = item.SaleType; itemCopy.SaleType = item.SaleType;
recipientUserInfo.AddItem(itemCopy); InventoryService.AddItem(itemCopy);
if (!Permissions.BypassPermissions()) if (!Permissions.BypassPermissions())
{ {
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
senderUserInfo.DeleteItem(itemId); InventoryService.DeleteItem(new InventoryItemBase(itemId));
} }
return itemCopy; return itemCopy;
} }
else else
{ {
m_log.ErrorFormat( m_log.WarnFormat("[AGENT INVENTORY]: Failed to find item {0} or item does not belong to giver ", itemId);
"[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");
return null; return null;
} }
return null;
} }
/// <summary> /// <summary>
@ -578,31 +501,11 @@ namespace OpenSim.Region.Framework.Scenes
/// <returns> /// <returns>
/// The inventory folder copy given, null if the copy was unsuccessful /// The inventory folder copy given, null if the copy was unsuccessful
/// </returns> /// </returns>
public virtual InventoryFolderImpl GiveInventoryFolder( public virtual InventoryFolderBase GiveInventoryFolder(
UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId)
{ {
// Retrieve the folder from the sender //// Retrieve the folder from the sender
CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); InventoryFolderBase folder = InventoryService.QueryFolder(new InventoryFolderBase(folderId));
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);
if (null == folder) if (null == folder)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
@ -611,48 +514,37 @@ namespace OpenSim.Region.Framework.Scenes
return null; 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) 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(); UUID newFolderId = UUID.Random();
recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId); InventoryFolderBase newFolder = new InventoryFolderBase(newFolderId, folder.Name, recipientId, folder.Type, recipientParentFolderId, folder.Version);
InventoryService.AddFolder(newFolder);
// XXX: Messy - we should really get this back in the CreateFolder call
InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId);
// Give all the subfolders // Give all the subfolders
List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls(); InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId);
foreach (InventoryFolderImpl childFolder in subFolders) foreach (InventoryFolderBase childFolder in contents.Folders)
{ {
GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID); GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID);
} }
// Give all the items // Give all the items
List<InventoryItemBase> items = folder.RequestListOfItems(); foreach (InventoryItemBase item in contents.Items)
foreach (InventoryItemBase item in 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, public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID,
@ -759,18 +651,7 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat( m_log.DebugFormat(
"[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId);
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
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);
if (item != null) if (item != null)
{ {
@ -780,20 +661,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
item.Folder = folderID; item.Folder = folderID;
userInfo.DeleteItem(item.ID); // Diva comment: can't we just update?
InventoryService.DeleteItem(item);
AddInventoryItem(remoteClient, item); AddInventoryItem(remoteClient, item);
} }
else else
{ {
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
return;
}
}
else
{
m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder");
return; return;
} }
@ -829,11 +704,6 @@ namespace OpenSim.Region.Framework.Scenes
private void CreateNewInventoryItem( private void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, 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) 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(); InventoryItemBase item = new InventoryItemBase();
item.Owner = remoteClient.AgentId; item.Owner = remoteClient.AgentId;
@ -853,14 +723,14 @@ namespace OpenSim.Region.Framework.Scenes
item.BasePermissions = baseMask; item.BasePermissions = baseMask;
item.CreationDate = creationDate; item.CreationDate = creationDate;
userInfo.AddItem(item); if (InventoryService.AddItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, callbackID); remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
}
else else
{ {
m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
m_log.WarnFormat( m_log.WarnFormat(
"No user details associated with client {0} uuid {1} in CreateNewInventoryItem!", "Failed to add item for {0} in CreateNewInventoryItem!",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name);
} }
} }
@ -941,19 +811,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="itemID"></param> /// <param name="itemID"></param>
private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID)
{ {
CachedUserInfo userInfo InventoryService.DeleteItem(new InventoryItemBase(itemID));
= 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);
} }
/// <summary> /// <summary>
@ -1332,19 +1190,12 @@ namespace OpenSim.Region.Framework.Scenes
public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
{ {
CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID); InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID);
if (profile == null || profile.RootFolder == null)
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Avatar {0} cannot be found to add items",
destID);
return UUID.Zero;
}
UUID newFolderID = UUID.Random(); 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) foreach (UUID itemID in items)
{ {
@ -1358,19 +1209,27 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
ScenePresence avatar; ScenePresence avatar = null;
if (TryGetAvatar(destID, out avatar)) if (TryGetAvatar(destID, out avatar))
{ {
profile.SendInventoryDecendents(avatar.ControllingClient, //profile.SendInventoryDecendents(avatar.ControllingClient,
profile.RootFolder.ID, true, false); // profile.RootFolder.ID, true, false);
profile.SendInventoryDecendents(avatar.ControllingClient, //profile.SendInventoryDecendents(avatar.ControllingClient,
newFolderID, false, true); // newFolderID, false, true);
SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false);
SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true);
} }
return newFolderID; 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> /// <summary>
/// Update an item in a prim (task) inventory. /// Update an item in a prim (task) inventory.
/// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see> /// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see>
@ -1848,7 +1707,7 @@ namespace OpenSim.Region.Framework.Scenes
// Get the user info of the item destination // Get the user info of the item destination
// //
CachedUserInfo userInfo; UUID userID = UUID.Zero;
if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || if (action == DeRezAction.Take || action == DeRezAction.TakeCopy ||
action == DeRezAction.SaveToExistingUserInventoryItem) action == DeRezAction.SaveToExistingUserInventoryItem)
@ -1859,30 +1718,21 @@ namespace OpenSim.Region.Framework.Scenes
if (remoteClient == null) if (remoteClient == null)
return UUID.Zero; return UUID.Zero;
userInfo = CommsManager.UserProfileCacheService.GetUserDetails( userID = remoteClient.AgentId;
remoteClient.AgentId);
} }
else else
{ {
// All returns / deletes go to the object owner // 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; 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 // If we're returning someone's item, it goes back to the
// owner's Lost And Found folder. // owner's Lost And Found folder.
// Delete is treated like return in this case // Delete is treated like return in this case
@ -1894,8 +1744,11 @@ namespace OpenSim.Region.Framework.Scenes
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item = userInfo.RootFolder.FindItem( item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID);
objectGroup.RootPart.FromUserInventoryItemID); item = InventoryService.QueryItem(item);
//item = userInfo.RootFolder.FindItem(
// objectGroup.RootPart.FromUserInventoryItemID);
if (null == item) if (null == item)
{ {
@ -1920,53 +1773,36 @@ namespace OpenSim.Region.Framework.Scenes
// have to wait for the inventory to find // have to wait for the inventory to find
// the destination folder // the destination folder
// //
if (!WaitForInventory(userInfo)) folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
return UUID.Zero;
folder = userInfo.FindFolderForType(
(int)AssetType.LostAndFoundFolder);
} }
else else
{ {
// Assume inventory skeleton was loaded during login // Assume inventory skeleton was loaded during login
// and all folders can be found // and all folders can be found
// //
folder = userInfo.FindFolderForType( folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder);
(int)AssetType.TrashFolder);
} }
} }
else if (action == DeRezAction.Return) else if (action == DeRezAction.Return)
{ {
// Wait if needed
//
if (!userInfo.HasReceivedInventory)
{
if (!WaitForInventory(userInfo))
return UUID.Zero;
}
// Dump to lost + found unconditionally // Dump to lost + found unconditionally
// //
folder = userInfo.FindFolderForType( folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
(int)AssetType.LostAndFoundFolder);
} }
if (folderID == UUID.Zero && folder == null) if (folderID == UUID.Zero && folder == null)
{ {
// Catch all. Use lost & found // Catch all. Use lost & found
// //
if (!userInfo.HasReceivedInventory)
{
if (!WaitForInventory(userInfo))
return UUID.Zero;
}
folder = userInfo.FindFolderForType( folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder);
(int)AssetType.LostAndFoundFolder);
} }
if (folder == null) // None of the above 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 if (folder == null) // Nowhere to put it
{ {
@ -1979,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes
item.ID = UUID.Random(); item.ID = UUID.Random();
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = folder.ID; item.Folder = folder.ID;
item.Owner = userInfo.UserProfile.ID; item.Owner = userID;
} }
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
@ -1993,7 +1829,7 @@ namespace OpenSim.Region.Framework.Scenes
if (DeRezAction.SaveToExistingUserInventoryItem == action) if (DeRezAction.SaveToExistingUserInventoryItem == action)
{ {
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
userInfo.UpdateItem(item); InventoryService.UpdateItem(item);
} }
else else
{ {
@ -2034,7 +1870,7 @@ namespace OpenSim.Region.Framework.Scenes
item.Name = asset.Name; item.Name = asset.Name;
item.AssetType = asset.Type; item.AssetType = asset.Type;
userInfo.AddItem(item); InventoryService.AddItem(item);
if (remoteClient != null && item.Owner == remoteClient.AgentId) if (remoteClient != null && item.Owner == remoteClient.AgentId)
{ {
@ -2053,7 +1889,7 @@ namespace OpenSim.Region.Framework.Scenes
return assetID; 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; SceneObjectGroup objectGroup = grp;
if (objectGroup != null) if (objectGroup != null)
@ -2070,43 +1906,9 @@ namespace OpenSim.Region.Framework.Scenes
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
CachedUserInfo userInfo = InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
CommsManager.UserProfileCacheService.GetUserDetails(agentID);
if (userInfo != null && userInfo.RootFolder != null)
{
Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>();
searchfolders.Enqueue(userInfo.RootFolder);
UUID foundFolder = UUID.Zero; if (item != null)
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)
{ {
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
objectGroup.GetPartName(objectGroup.LocalId), objectGroup.GetPartName(objectGroup.LocalId),
@ -2120,9 +1922,8 @@ namespace OpenSim.Region.Framework.Scenes
item.Name = asset.Name; item.Name = asset.Name;
item.AssetType = asset.Type; item.AssetType = asset.Type;
item.InvType = (int)InventoryType.Object; item.InvType = (int)InventoryType.Object;
item.Folder = foundFolder;
userInfo.UpdateItem(item); InventoryService.UpdateItem(item);
// this gets called when the agent loggs off! // this gets called when the agent loggs off!
if (remoteClient != null) if (remoteClient != null)
@ -2132,7 +1933,6 @@ namespace OpenSim.Region.Framework.Scenes
} }
} }
} }
}
public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID) public UUID attachObjectAssetStore(IClientAPI remoteClient, SceneObjectGroup grp, UUID AgentId, out UUID itemID)
{ {
@ -2141,11 +1941,6 @@ namespace OpenSim.Region.Framework.Scenes
{ {
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp);
CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(AgentId);
if (userInfo != null)
{
AssetBase asset = CreateAsset( AssetBase asset = CreateAsset(
grp.GetPartName(grp.LocalId), grp.GetPartName(grp.LocalId),
grp.GetPartDescription(grp.LocalId), grp.GetPartDescription(grp.LocalId),
@ -2186,16 +1981,16 @@ namespace OpenSim.Region.Framework.Scenes
// sets assetID so client can show asset as 'attached' in inventory // sets assetID so client can show asset as 'attached' in inventory
grp.SetFromAssetID(item.ID); grp.SetFromAssetID(item.ID);
userInfo.AddItem(item); if (InventoryService.AddItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
else
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
itemID = item.ID; itemID = item.ID;
return item.AssetID; return item.AssetID;
} }
return UUID.Zero; return UUID.Zero;
} }
return UUID.Zero;
}
/// <summary> /// <summary>
/// Event Handler Rez an object into a scene /// Event Handler Rez an object into a scene
@ -2261,17 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
BypassRayCast, bRayEndIsIntersection,true,scale, false); BypassRayCast, bRayEndIsIntersection,true,scale, false);
// Rez object // Rez object
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
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);
if (item != null) if (item != null)
{ {
@ -2422,19 +2207,13 @@ namespace OpenSim.Region.Framework.Scenes
// copy ones will be lost, so avoid it // copy ones will be lost, so avoid it
// //
if (!attachment) if (!attachment)
userInfo.DeleteItem(item.ID); InventoryService.DeleteItem(item);
} }
} }
return rootPart.ParentGroup; 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; return null;
} }
@ -2681,14 +2460,10 @@ namespace OpenSim.Region.Framework.Scenes
ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
} }
part.ParentGroup.DetachToGround(); part.ParentGroup.DetachToGround();
CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); InventoryService.DeleteItem(new InventoryItemBase(inventoryID));
if (userInfo != null)
{
userInfo.DeleteItem(inventoryID);
remoteClient.SendRemoveInventoryItem(inventoryID); remoteClient.SendRemoveInventoryItem(inventoryID);
} }
}
SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
} }

View File

@ -435,17 +435,7 @@ namespace OpenSim.Region.Framework.Scenes
return; return;
} }
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems);
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);
} }
/// <summary> /// <summary>
@ -543,19 +533,10 @@ namespace OpenSim.Region.Framework.Scenes
public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType,
string folderName, UUID parentID) string folderName, UUID parentID)
{ {
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1);
if (!InventoryService.AddFolder(folder))
if (null == userProfile)
{ {
m_log.ErrorFormat( m_log.WarnFormat(
"[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(
"[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}",
remoteClient.Name, remoteClient.AgentId); remoteClient.Name, remoteClient.AgentId);
} }

View File

@ -3510,11 +3510,6 @@ namespace OpenSim.Region.Framework.Scenes
case 2: // Sell a copy case 2: // Sell a copy
string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group);
CachedUserInfo userInfo =
CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
uint perms=group.GetEffectivePermissions(); uint perms=group.GetEffectivePermissions();
if ((perms & (uint)PermissionMask.Transfer) == 0) if ((perms & (uint)PermissionMask.Transfer) == 0)
@ -3560,9 +3555,8 @@ namespace OpenSim.Region.Framework.Scenes
item.CurrentPermissions |= 8; // Slam! item.CurrentPermissions |= 8; // Slam!
item.CreationDate = Util.UnixTimeSinceEpoch(); item.CreationDate = Util.UnixTimeSinceEpoch();
userInfo.AddItem(item); if (InventoryService.AddItem(item))
remoteClient.SendInventoryItemCreateUpdate(item, 0); remoteClient.SendInventoryItemCreateUpdate(item, 0);
}
else else
{ {
m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable");
@ -3577,8 +3571,8 @@ namespace OpenSim.Region.Framework.Scenes
foreach (UUID invID in invList) foreach (UUID invID in invList)
{ {
TaskInventoryItem item = part.Inventory.GetInventoryItem(invID); TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID);
if ((item.CurrentPermissions & if ((item1.CurrentPermissions &
(uint)PermissionMask.Transfer) == 0) (uint)PermissionMask.Transfer) == 0)
{ {
okToSell = false; okToSell = false;

View File

@ -542,7 +542,7 @@ namespace OpenSim.Region.Framework.Scenes
group.DetachToInventoryPrep(); group.DetachToInventoryPrep();
m_log.Debug("[DETACH]: Saving attachpoint: " + m_log.Debug("[DETACH]: Saving attachpoint: " +
((uint)group.GetAttachmentPoint()).ToString()); ((uint)group.GetAttachmentPoint()).ToString());
m_parentScene.updateKnownAsset(remoteClient, group, m_parentScene.UpdateKnownItem(remoteClient, group,
group.GetFromAssetID(), group.OwnerID); group.GetFromAssetID(), group.OwnerID);
m_parentScene.DeleteSceneObject(group, false); m_parentScene.DeleteSceneObject(group, false);
return; return;
@ -1307,7 +1307,7 @@ namespace OpenSim.Region.Framework.Scenes
group.UpdateGroupPosition(pos); group.UpdateGroupPosition(pos);
group.RootPart.IsAttachment = false; group.RootPart.IsAttachment = false;
group.AbsolutePosition = group.RootPart.AttachedPos; group.AbsolutePosition = group.RootPart.AttachedPos;
m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID); m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromAssetID(), group.OwnerID);
group.SetAttachmentPoint(attachmentPoint); group.SetAttachmentPoint(attachmentPoint);
} }