mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 03:45:35 +08:00
Fixed handling of inventory a bit
- AssetType isn't InventoryType. Those enums contain different numbers. Use AssetType for the asset type, InventoryType for the inventory type. - The ToString method (or ToLower) of AssetType/InventoryType doesn't necessarily return the correct LLSD string. - Replaced several magic numbers by their corresponding enum. - Fixed the invType for gestures and animations in the library. This should fix Mantis #3610 and the non-terminating inventory loading
This commit is contained in:
@@ -2045,7 +2045,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
// good as having type be specified in the XML.
|
||||
|
||||
if (ic.Item.AssetType == (int) AssetType.Unknown ||
|
||||
ic.Item.InvType == (int) AssetType.Unknown)
|
||||
ic.Item.InvType == (int) InventoryType.Unknown)
|
||||
{
|
||||
Rest.Log.DebugFormat("{0} Attempting to infer item type", MsgId);
|
||||
|
||||
@@ -2078,8 +2078,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
MsgId, parts[parts.Length-1]);
|
||||
if (ic.Item.AssetType == (int) AssetType.Unknown)
|
||||
ic.Item.AssetType = (int) AssetType.ImageJPEG;
|
||||
if (ic.Item.InvType == (int) AssetType.Unknown)
|
||||
ic.Item.InvType = (int) AssetType.ImageJPEG;
|
||||
if (ic.Item.InvType == (int) InventoryType.Unknown)
|
||||
ic.Item.InvType = (int) InventoryType.Texture;
|
||||
break;
|
||||
case "jpg" :
|
||||
case "jpeg" :
|
||||
@@ -2087,8 +2087,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
MsgId, parts[parts.Length - 1]);
|
||||
if (ic.Item.AssetType == (int) AssetType.Unknown)
|
||||
ic.Item.AssetType = (int) AssetType.ImageJPEG;
|
||||
if (ic.Item.InvType == (int) AssetType.Unknown)
|
||||
ic.Item.InvType = (int) AssetType.ImageJPEG;
|
||||
if (ic.Item.InvType == (int) InventoryType.Unknown)
|
||||
ic.Item.InvType = (int) InventoryType.Texture;
|
||||
break;
|
||||
case "tga" :
|
||||
if (parts[parts.Length - 2].IndexOf("_texture") != -1)
|
||||
@@ -2096,14 +2096,14 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
|
||||
if (ic.Item.AssetType == (int) AssetType.Unknown)
|
||||
ic.Item.AssetType = (int) AssetType.TextureTGA;
|
||||
if (ic.Item.InvType == (int) AssetType.Unknown)
|
||||
ic.Item.InvType = (int) AssetType.TextureTGA;
|
||||
ic.Item.InvType = (int) InventoryType.Texture;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ic.Item.AssetType == (int) AssetType.Unknown)
|
||||
ic.Item.AssetType = (int) AssetType.ImageTGA;
|
||||
if (ic.Item.InvType == (int) AssetType.Unknown)
|
||||
ic.Item.InvType = (int) AssetType.ImageTGA;
|
||||
if (ic.Item.InvType == (int) InventoryType.Unknown)
|
||||
ic.Item.InvType = (int) InventoryType.Snapshot;
|
||||
}
|
||||
break;
|
||||
default :
|
||||
|
||||
@@ -365,7 +365,7 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||
|
||||
public string FetchInventoryDescendentsRequest(string request, string path, string param,OSHttpRequest httpRequest, OSHttpResponse httpResponse)
|
||||
{
|
||||
m_log.Debug("[CAPS]: FetchInventoryDescendentsRequest in region: " + m_regionName + "request is "+request);
|
||||
m_log.Debug("[CAPS]: FetchInventoryDescendentsRequest in region: " + m_regionName + " request is "+request);
|
||||
|
||||
// nasty temporary hack here, the linden client falsely identifies the uuid 00000000-0000-0000-0000-000000000000 as a string which breaks us
|
||||
// correctly mark it as a uuid
|
||||
@@ -512,8 +512,16 @@ namespace OpenSim.Framework.Communications.Capabilities
|
||||
llsdItem.item_id = invItem.ID;
|
||||
llsdItem.name = invItem.Name;
|
||||
llsdItem.parent_id = invItem.Folder;
|
||||
llsdItem.type = Enum.GetName(typeof(AssetType), invItem.AssetType).ToLower();
|
||||
llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.InvType).ToLower();
|
||||
try
|
||||
{
|
||||
// TODO reevaluate after upgrade to libomv >= r2566. Probably should use UtilsConversions.
|
||||
llsdItem.type = TaskInventoryItem.Types[invItem.AssetType];
|
||||
llsdItem.inv_type = TaskInventoryItem.InvTypes[invItem.InvType];
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
m_log.Error("[CAPS]: Problem setting asset/inventory type while converting inventory item " + invItem.Name + " to LLSD:", e);
|
||||
}
|
||||
llsdItem.permissions = new LLSDPermissions();
|
||||
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
|
||||
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
|
||||
|
||||
@@ -490,7 +490,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if (Permissions.PropagatePermissions())
|
||||
{
|
||||
if (item.InvType == 6)
|
||||
if (item.InvType == (int)InventoryType.Object)
|
||||
{
|
||||
itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer);
|
||||
itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13;
|
||||
@@ -899,7 +899,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
TryGetAvatar(remoteClient.AgentId, out presence);
|
||||
byte[] data = null;
|
||||
|
||||
if (invType == 3 && presence != null) // OpenMetaverse.asset.assettype.landmark = 3 - needs to be turned into an enum
|
||||
if (invType == (sbyte)InventoryType.Landmark && presence != null)
|
||||
{
|
||||
Vector3 pos = presence.AbsolutePosition;
|
||||
string strdata = String.Format(
|
||||
@@ -1098,7 +1098,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
if ((part.OwnerID != destAgent) && Permissions.PropagatePermissions())
|
||||
{
|
||||
if (taskItem.InvType == 6)
|
||||
if (taskItem.InvType == (int)InventoryType.Object)
|
||||
agentItem.BasePermissions = taskItem.BasePermissions & ((taskItem.CurrentPermissions & 7) << 13);
|
||||
else
|
||||
agentItem.BasePermissions = taskItem.BasePermissions;
|
||||
|
||||
@@ -776,7 +776,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType != 6)
|
||||
if (item.InvType != (int)InventoryType.Object)
|
||||
{
|
||||
if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
|
||||
mask &= ~((uint)PermissionMask.Copy >> 13);
|
||||
@@ -809,7 +809,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType == 6 && (item.CurrentPermissions & 7) != 0)
|
||||
if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
|
||||
{
|
||||
if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
|
||||
item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
|
||||
@@ -840,7 +840,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
{
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType == 10)
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -866,7 +866,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType == 10)
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
{
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
@@ -890,7 +890,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
|
||||
foreach (TaskInventoryItem item in m_items.Values)
|
||||
{
|
||||
if (item.InvType == 10)
|
||||
if (item.InvType == (int)InventoryType.LSL)
|
||||
{
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
|
||||
@@ -1351,8 +1351,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
taskItem.CreationDate = (uint)Util.UnixTimeSinceEpoch();
|
||||
taskItem.Name = asset.Name;
|
||||
taskItem.Description = asset.Description;
|
||||
taskItem.Type = 7;
|
||||
taskItem.InvType = 7;
|
||||
taskItem.Type = (int)AssetType.Notecard;
|
||||
taskItem.InvType = (int)InventoryType.Notecard;
|
||||
taskItem.OwnerID = m_host.OwnerID;
|
||||
taskItem.CreatorID = m_host.OwnerID;
|
||||
taskItem.BasePermissions = (uint)PermissionMask.All;
|
||||
|
||||
Reference in New Issue
Block a user