Inventory redirects from CachedUserInfo to InventoryService COMPLETE!

This commit is contained in:
Diva Canto
2009-08-13 11:30:29 -07:00
parent 6a0f7c2275
commit 6b9cc6c48d
10 changed files with 144 additions and 388 deletions

View File

@@ -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

View File

@@ -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)

View File

@@ -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);