Inventory redirects from CachedUserInfo to InventoryService COMPLETE!
parent
6a0f7c2275
commit
6b9cc6c48d
|
@ -6609,20 +6609,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.QueryItem(new InventoryItemBase(itemID));
|
||||
if (assetRequestItem == null)
|
||||
{
|
||||
assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
|
|
|
@ -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,7 +218,8 @@ 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
|
||||
|
|
|
@ -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.QueryItem(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,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
|
|||
|
||||
//m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
|
||||
|
||||
if (profile != null)
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (profile.RootFolder != null)
|
||||
if (wear.Type < 13)
|
||||
{
|
||||
foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
|
||||
{
|
||||
if (wear.Type < 13)
|
||||
{
|
||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
SetAppearanceAssets(profile, ref avatAppearance);
|
||||
avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
|
||||
avatar.Appearance = avatAppearance;
|
||||
}
|
||||
|
||||
public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
|
||||
|
|
|
@ -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.QueryItem(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.QueryItem(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.QueryItem(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,25 +117,20 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
|
|||
|
||||
if (fromTaskID.Equals(UUID.Zero))
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
if (userInfo != null)
|
||||
InventoryItemBase item = new InventoryItemBase(itemID);
|
||||
item.Owner = remoteClient.AgentId;
|
||||
item = InventoryService.QueryItem(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)
|
||||
{
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
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);
|
||||
m_assMapper.Get(item.AssetID, remoteClient.AgentId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -558,24 +558,9 @@ 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;
|
||||
}
|
||||
item = InventoryService.QueryItem(new InventoryItemBase(oldItemID));
|
||||
|
||||
if (userInfo.RootFolder != null)
|
||||
{
|
||||
item = userInfo.RootFolder.FindItem(oldItemID);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (item == null)
|
||||
{
|
||||
m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
|
||||
return;
|
||||
|
@ -822,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1060,20 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
|
||||
}
|
||||
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)
|
||||
|
@ -1265,39 +1224,33 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
UUID copyID = UUID.Random();
|
||||
if (itemID != UUID.Zero)
|
||||
{
|
||||
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
// Try library
|
||||
if (null == item)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
}
|
||||
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item)
|
||||
if (item != null)
|
||||
{
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
|
||||
m_log.InfoFormat(
|
||||
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
||||
item.Name, primLocalID, remoteClient.Name);
|
||||
part.GetProperties(remoteClient);
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
}
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
|
||||
m_log.InfoFormat(
|
||||
"[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
|
||||
item.Name, primLocalID, remoteClient.Name);
|
||||
part.GetProperties(remoteClient);
|
||||
if (!Permissions.BypassPermissions())
|
||||
{
|
||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
RemoveInventoryItem(remoteClient, itemID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
|
||||
itemID, remoteClient.Name);
|
||||
if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
RemoveInventoryItem(remoteClient, itemID);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
|
||||
itemID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Updating existing item with new perms etc
|
||||
|
@ -1334,53 +1287,48 @@ 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);
|
||||
InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (userInfo != null && userInfo.RootFolder != null)
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item)
|
||||
{
|
||||
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
|
||||
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
}
|
||||
|
||||
// Try library
|
||||
// XXX clumsy, possibly should be one call
|
||||
if (null == item)
|
||||
if (item != null)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null)
|
||||
{
|
||||
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
|
||||
}
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
SceneObjectPart part = GetSceneObjectPart(localID);
|
||||
if (part != null)
|
||||
{
|
||||
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
|
||||
return;
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||
// TODO: switch to posting on_rez here when scripts
|
||||
// have state in inventory
|
||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||
|
||||
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
|
||||
// TODO: switch to posting on_rez here when scripts
|
||||
// have state in inventory
|
||||
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
|
||||
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
// item.inventoryName, localID, remoteClient.Name);
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Could not rez script {0} into prim local ID {1} for user {2}"
|
||||
+ " because the prim could not be found in the region!",
|
||||
item.Name, localID, remoteClient.Name);
|
||||
}
|
||||
// m_log.InfoFormat("[PRIMINVENTORY]: " +
|
||||
// "Rezzed script {0} into prim local ID {1} for user {2}",
|
||||
// item.inventoryName, localID, remoteClient.Name);
|
||||
part.GetProperties(remoteClient);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
|
||||
itemID, remoteClient.Name);
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Could not rez script {0} into prim local ID {1} for user {2}"
|
||||
+ " because the prim could not be found in the region!",
|
||||
item.Name, localID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
|
||||
itemID, remoteClient.Name);
|
||||
}
|
||||
}
|
||||
else // script has been rezzed directly into a prim's inventory
|
||||
{
|
||||
|
@ -1670,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.
|
||||
|
|
|
@ -382,31 +382,13 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
|
||||
|
||||
if (null == userProfile)
|
||||
InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
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);
|
||||
|
||||
if (item != null)
|
||||
{
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
remoteClient.SendInventoryItemDetails(ownerID, item);
|
||||
}
|
||||
// else shouldn't we send an alert message?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -442,6 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// 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>
|
||||
|
@ -467,59 +450,10 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
return fold.RequestListOfItems();
|
||||
}
|
||||
|
||||
CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID);
|
||||
|
||||
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);
|
||||
InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
|
||||
return contents.Items;
|
||||
|
||||
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>
|
||||
|
@ -579,33 +513,7 @@ 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);
|
||||
|
@ -628,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);
|
||||
|
||||
|
|
|
@ -1249,11 +1249,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
|
||||
|
|
|
@ -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
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue