Move code that allows llGiveInvetory() to move item into appropriate system folder up from connectors into Scene.Inventory.cs
This fixes the problem for all architectures (hg as well as local and grid) and means we don't have to dupe code between connectors. Not ideal in that it becomes non-modular, but methods in Scene.Inventory.cs should eventually be modularized anyway.prebuild-update
parent
107052b23d
commit
1e8e98a07f
|
@ -1602,8 +1602,8 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = destinationFolder.ID;
|
||||
|
||||
inventoryService.AddItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
|
||||
// Wear item
|
||||
AvatarWearable newWearable = new AvatarWearable();
|
||||
|
@ -1613,7 +1613,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
|
||||
m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", wearable.ItemID, destinationFolder.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1655,16 +1655,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = destinationFolder.ID;
|
||||
|
||||
inventoryService.AddItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, destinationFolder.ID);
|
||||
|
||||
// Attach item
|
||||
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
|
||||
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat("[RADMIN] Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
|
||||
m_log.WarnFormat("[RADMIN]: Error transferring {0} to folder {1}", itemID, destinationFolder.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1762,16 +1762,16 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
destinationItem.CreationDate = item.CreationDate;
|
||||
destinationItem.Folder = extraFolder.ID;
|
||||
|
||||
inventoryService.AddItem(destinationItem);
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(destinationItem);
|
||||
inventoryMap.Add(item.ID, destinationItem.ID);
|
||||
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Added item {0} to folder {1}", destinationItem.ID, extraFolder.ID);
|
||||
|
||||
// Attach item, if original is attached
|
||||
int attachpoint = avatarAppearance.GetAttachpoint(item.ID);
|
||||
if (attachpoint != 0)
|
||||
{
|
||||
avatarAppearance.SetAttachment(attachpoint, destinationItem.ID, destinationItem.AssetID);
|
||||
m_log.DebugFormat("[RADMIN] Attached {0}", destinationItem.ID);
|
||||
m_log.DebugFormat("[RADMIN]: Attached {0}", destinationItem.ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1790,7 +1790,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
private bool CreateDefaultAvatars()
|
||||
{
|
||||
// Only load once
|
||||
|
||||
if (m_defaultAvatarsLoaded)
|
||||
{
|
||||
return false;
|
||||
|
@ -2048,7 +2047,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
|
|||
inventoryItem.CreationDate = GetIntegerAttribute(item,"creationdate",Util.UnixTimeSinceEpoch());
|
||||
inventoryItem.Folder = extraFolder.ID; // Parent folder
|
||||
|
||||
inventoryService.AddItem(inventoryItem);
|
||||
m_application.SceneManager.CurrentOrFirstScene.AddInventoryItem(inventoryItem);
|
||||
m_log.DebugFormat("[RADMIN] Added item {0} to folder {1}", inventoryItem.ID, extraFolder.ID);
|
||||
}
|
||||
|
||||
|
|
|
@ -214,8 +214,6 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
{
|
||||
m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
|
||||
|
||||
IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
|
||||
|
||||
InventoryItemBase item = new InventoryItemBase();
|
||||
item.Owner = ourClient.AgentId;
|
||||
item.CreatorId = ourClient.AgentId.ToString();
|
||||
|
@ -234,7 +232,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
|
|||
item.Flags = (uint) wearableType;
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (invService.AddItem(item))
|
||||
if (m_userTransactions.Manager.MyScene.AddInventoryItem(item))
|
||||
ourClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
else
|
||||
ourClient.SendAlertMessage("Unable to create inventory item");
|
||||
|
|
|
@ -406,8 +406,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
|||
// Reset folder ID to the one in which we want to load it
|
||||
item.Folder = loadFolder.ID;
|
||||
|
||||
//m_userInfo.AddItem(item);
|
||||
m_scene.InventoryService.AddItem(item);
|
||||
m_scene.AddInventoryItem(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
|
|
@ -425,7 +425,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
|
|||
item.Name = asset.Name;
|
||||
item.AssetType = asset.Type;
|
||||
|
||||
m_Scene.InventoryService.AddItem(item);
|
||||
m_Scene.AddInventoryItem(item);
|
||||
|
||||
if (remoteClient != null && item.Owner == remoteClient.AgentId)
|
||||
{
|
||||
|
|
|
@ -221,34 +221,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
// m_log.DebugFormat(
|
||||
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Adding inventory item {0} to user {1} folder {2}",
|
||||
// item.Name, item.Owner, item.Folder);
|
||||
|
||||
if (UUID.Zero == item.Folder)
|
||||
{
|
||||
InventoryFolderBase f = m_InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||
if (f != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
|
||||
// f.Name, (AssetType)f.Type, item.Name);
|
||||
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = m_InventoryService.GetRootFolder(item.Owner);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||
item.Owner, item.Name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return m_InventoryService.AddItem(item);
|
||||
}
|
||||
|
|
|
@ -227,31 +227,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
|
|||
public bool AddItem(InventoryItemBase item)
|
||||
{
|
||||
if (item == null)
|
||||
return false;
|
||||
|
||||
if (UUID.Zero == item.Folder)
|
||||
{
|
||||
InventoryFolderBase f = m_RemoteConnector.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = m_RemoteConnector.GetRootFolder(item.Owner);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[LOCAL INVENTORY SERVICES CONNECTOR]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||
item.Owner, item.Name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return m_RemoteConnector.AddItem(item);
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
|
|||
item.CurrentPermissions |= 16; // Slam!
|
||||
item.CreationDate = Util.UnixTimeSinceEpoch();
|
||||
|
||||
if (m_scene.InventoryService.AddItem(item))
|
||||
if (m_scene.AddInventoryItem(item))
|
||||
{
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
}
|
||||
|
|
|
@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
|
||||
public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item)
|
||||
{
|
||||
IMoneyModule money=RequestModuleInterface<IMoneyModule>();
|
||||
IMoneyModule money = RequestModuleInterface<IMoneyModule>();
|
||||
if (money != null)
|
||||
{
|
||||
money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload");
|
||||
}
|
||||
|
||||
AddInventoryItem(agentID, item);
|
||||
AddInventoryItem(item);
|
||||
}
|
||||
|
||||
public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item)
|
||||
{
|
||||
if (InventoryService.AddItem(item))
|
||||
if (AddInventoryItem(item))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
|
@ -96,8 +96,36 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// Add the given inventory item to a user's inventory.
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
public void AddInventoryItem(InventoryItemBase item)
|
||||
public bool AddInventoryItem(InventoryItemBase item)
|
||||
{
|
||||
if (UUID.Zero == item.Folder)
|
||||
{
|
||||
InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType);
|
||||
if (f != null)
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}",
|
||||
// f.Name, (AssetType)f.Type, item.Name);
|
||||
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
f = InventoryService.GetRootFolder(item.Owner);
|
||||
if (f != null)
|
||||
{
|
||||
item.Folder = f.ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified",
|
||||
item.Owner, item.Name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (InventoryService.AddItem(item))
|
||||
{
|
||||
int userlevel = 0;
|
||||
|
@ -106,6 +134,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
userlevel = 1;
|
||||
}
|
||||
EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel);
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -113,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
"[AGENT INVENTORY]: Agent {0} could not add item {1} {2}",
|
||||
item.Owner, item.Name, item.ID);
|
||||
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -538,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
itemCopy.SalePrice = item.SalePrice;
|
||||
itemCopy.SaleType = item.SaleType;
|
||||
|
||||
if (InventoryService.AddItem(itemCopy))
|
||||
if (AddInventoryItem(itemCopy))
|
||||
{
|
||||
IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>();
|
||||
if (invAccess != null)
|
||||
|
@ -764,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
item.BasePermissions = baseMask;
|
||||
item.CreationDate = creationDate;
|
||||
|
||||
if (InventoryService.AddItem(item))
|
||||
if (AddInventoryItem(item))
|
||||
{
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, callbackID);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item");
|
||||
|
@ -1886,7 +1918,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// sets itemID so client can show item as 'attached' in inventory
|
||||
grp.SetFromItemID(item.ID);
|
||||
|
||||
if (InventoryService.AddItem(item))
|
||||
if (AddInventoryItem(item))
|
||||
remoteClient.SendInventoryItemCreateUpdate(item, 0);
|
||||
else
|
||||
m_dialogModule.SendAlertToUser(remoteClient, "Operation failed");
|
||||
|
|
Loading…
Reference in New Issue