Part 2 of fixing inventory for client 1.19.1 (RC), inventory items should now show up.

Most likely still some problems and most like needs some more work (and still a couple of things to finish off).
0.6.0-stable
MW 2008-03-15 12:53:03 +00:00
parent 70e55205a1
commit c04899b60a
4 changed files with 126 additions and 17 deletions

View File

@ -254,6 +254,66 @@ namespace OpenSim.Framework.Communications.Cache
folderID, remoteClient.Name);
}
public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder)
{
// XXX We're not handling sortOrder yet!
// with CAPS we are only return items in the folders at the moment
// need to find the format that sub folder details are sent in
// if (fetchItems)
// {
InventoryFolderImpl fold = null;
if (folderID == libraryRoot.folderID)
{
return libraryRoot.RequestListOfItems();
}
if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
{
return fold.RequestListOfItems();
}
CachedUserInfo userProfile;
if (m_userProfiles.TryGetValue(agentID, out userProfile))
{
if (userProfile.RootFolder != null)
{
if (userProfile.RootFolder.folderID == folderID)
{
return userProfile.RootFolder.RequestListOfItems();
}
else
{
if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
{
return fold.RequestListOfItems();
}
}
}
else
{
m_log.ErrorFormat("[INVENTORYCACHE]: Could not find root folder for user {0}", agentID.ToString());
return new List<InventoryItemBase>(); ;
}
}
else
{
m_log.ErrorFormat("[INVENTORYCACHE]: " +
"Could not find user profile for {0} for folder {1}",
agentID.ToString(), folderID);
return new List<InventoryItemBase>();
}
// If we've reached this point then we couldn't find the folder, even though the client thinks
// it exists
m_log.ErrorFormat("[INVENTORYCACHE]: " +
"Could not find folder {0} for user {1}",
folderID, agentID.ToString());
// }
return new List<InventoryItemBase>();
}
public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
{
// m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}",

View File

@ -52,6 +52,9 @@ namespace OpenSim.Region.Capabilities
public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID,
bool isScriptRunning, byte[] data);
public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder);
public class Caps
{
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -81,6 +84,9 @@ namespace OpenSim.Region.Capabilities
public NewInventoryItem AddNewInventoryItem = null;
public ItemUpdatedCallback ItemUpdatedCall = null;
public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null;
//
public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null;
public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath,
LLUUID agent, bool dumpAssetsToFile)
@ -191,14 +197,56 @@ namespace OpenSim.Region.Capabilities
LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
contents.agent___id = m_agentID;
contents.owner___id = m_agentID;
contents.owner___id = invFetch.owner_id;
contents.folder___id = invFetch.folder_id;
contents.version = 1;
contents.version = 1; //FixMe
contents.descendents = 0;
reply.folders.Array.Add(contents);
List<InventoryItemBase> itemList = null;
if (CAPSFetchInventoryDescendents != null)
{
itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order);
}
if (itemList != null)
{
foreach (InventoryItemBase invItem in itemList)
{
contents.items.Array.Add(ConvertInventoryItem(invItem));
}
}
contents.descendents = contents.items.Array.Count;
return reply;
}
private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem)
{
LLSDInventoryItem llsdItem = new LLSDInventoryItem();
llsdItem.asset_id = invItem.assetID;
llsdItem.created_at = 1000;
llsdItem.desc = invItem.inventoryDescription;
llsdItem.flags = 0;
llsdItem.item_id = invItem.inventoryID;
llsdItem.name = invItem.inventoryName;
llsdItem.parent_id = invItem.parentFolderID;
llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower();
llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower();
llsdItem.permissions = new LLSDPermissions();
llsdItem.permissions.creator_id = invItem.creatorsID;
llsdItem.permissions.base_mask = (int)invItem.inventoryBasePermissions;
llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions;
llsdItem.permissions.group_id = LLUUID.Zero;
llsdItem.permissions.group_mask = 0;
llsdItem.permissions.is_owner_group = false;
llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions;
llsdItem.permissions.owner_id = m_agentID; // FixMe
llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions;
llsdItem.sale_info = new LLSDSaleInfo();
llsdItem.sale_info.sale_price = 10;
llsdItem.sale_info.sale_type = "not";
return llsdItem;
}
/// <summary>
///
/// </summary>

View File

@ -4,15 +4,15 @@ using System.Text;
using libsecondlife;
namespace OpenSim.Region.Capabilities
{
{
[LLSDMap]
public class LLSDInventoryItem
{
public LLUUID parent_id;
public LLUUID asset_id;
public LLUUID item_id;
public LLSDPermissions permissions;
public string type;
public string inv_type;
public int flags;
@ -45,19 +45,19 @@ namespace OpenSim.Region.Capabilities
public string sale_type;
}
/* [LLSDMap]
public class LLSDFolderItem
{
public LLUUID folder_id;
public LLUUID parent_id;
public int type;
public string name;
}*/
/* [LLSDMap]
public class LLSDFolderItem
{
public LLUUID folder_id;
public LLUUID parent_id;
public int type;
public string name;
}*/
[LLSDMap]
public class LLSDInventoryDescendents
{
public LLSDArray folders= new LLSDArray();
public LLSDArray folders = new LLSDArray();
}
[LLSDMap]
@ -73,11 +73,11 @@ namespace OpenSim.Region.Capabilities
[LLSDMap]
public class LLSDInventoryFolderContents
{
public LLUUID agent___id;
public LLUUID agent___id; // the (three "_") "___" so the serialising knows to change this to a "-"
public int descendents;
public LLUUID folder___id; // the (three "_") "___" so the serialising knows to change this to a "-"
public LLUUID folder___id; //as LL can't decide if they are going to use "_" or "-" to separate words in the field names
public LLSDArray items = new LLSDArray();
public LLUUID owner___id;
public LLUUID owner___id; // and of course we can't have field names with "-" in
public int version;
}
}

View File

@ -1656,6 +1656,7 @@ namespace OpenSim.Region.Environment.Scenes
cap.AddNewInventoryItem = AddInventoryItem;
cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset;
cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset;
cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS;
if (m_capsHandlers.ContainsKey(agent.AgentID))
{