a few more changes on inventory library and inv fetch
parent
4c65bb4196
commit
5548b66dc0
|
@ -90,7 +90,7 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
|
items[i++] = m_inventoryService.GetItem(UUID.Zero, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder lsl = LLSDxmlEncode.Start(2048);
|
StringBuilder lsl = LLSDxmlEncode.Start(4096);
|
||||||
LLSDxmlEncode.AddMap(lsl);
|
LLSDxmlEncode.AddMap(lsl);
|
||||||
|
|
||||||
if(m_agentID == UUID.Zero && items.Length > 0)
|
if(m_agentID == UUID.Zero && items.Length > 0)
|
||||||
|
@ -100,49 +100,15 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
|
|
||||||
if(items == null || items.Length == 0)
|
if(items == null || items.Length == 0)
|
||||||
{
|
{
|
||||||
LLSDxmlEncode.AddEmptyArray("items",lsl);
|
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLSDxmlEncode.AddArray("items",lsl);
|
LLSDxmlEncode.AddArray("items", lsl);
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
item.ToLLSDxml(lsl);
|
||||||
// this is as FecthLib, possible to move to a shared location later
|
|
||||||
LLSDxmlEncode.AddMap(lsl);
|
|
||||||
LLSDxmlEncode.AddElem("parent_id", item.Folder, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("asset_id", item.AssetID, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("item_id", item.ID, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddMap("permissions",lsl);
|
|
||||||
LLSDxmlEncode.AddElem("creator_id", item.CreatorIdAsUuid, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("owner_id", item.Owner, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("group_id", item.GroupID, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("base_mask", (int)item.CurrentPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("owner_mask", (int)item.CurrentPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("group_mask", (int)item.GroupPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("everyone_mask", (int)item.EveryOnePermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("next_owner_mask", (int)item.NextPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("is_owner_group", item.GroupOwned, lsl);
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddElem("type", item.AssetType, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("inv_type", item.InvType, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddMap("sale_info",lsl);
|
|
||||||
LLSDxmlEncode.AddElem("sale_price", item.SalePrice, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("sale_type", item.SaleType, lsl);
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddElem("name", item.Name, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("desc", item.Description, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("created_at", item.CreationDate, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LLSDxmlEncode.AddEndArray(lsl);
|
LLSDxmlEncode.AddEndArray(lsl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,6 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
private UUID libOwner;
|
private UUID libOwner;
|
||||||
|
|
||||||
public FetchLib2Handler(IInventoryService invService, ILibraryService libraryService, UUID agentId)
|
public FetchLib2Handler(IInventoryService invService, ILibraryService libraryService, UUID agentId)
|
||||||
|
|
||||||
{
|
{
|
||||||
m_inventoryService = invService;
|
m_inventoryService = invService;
|
||||||
m_agentID = agentId;
|
m_agentID = agentId;
|
||||||
|
@ -63,15 +62,12 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
|
//m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request);
|
||||||
|
|
||||||
if (m_LibraryService == null)
|
if (m_LibraryService == null || m_agentID == UUID.Zero)
|
||||||
return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>";
|
return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>";
|
||||||
|
|
||||||
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request));
|
||||||
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
OSDArray itemsRequested = (OSDArray)requestmap["items"];
|
||||||
|
|
||||||
if (m_agentID == UUID.Zero)
|
|
||||||
return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>";
|
|
||||||
|
|
||||||
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
UUID[] itemIDs = new UUID[itemsRequested.Count];
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
@ -88,48 +84,15 @@ namespace OpenSim.Capabilities.Handlers
|
||||||
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl);
|
||||||
if(items == null || items.Length == 0)
|
if(items == null || items.Length == 0)
|
||||||
{
|
{
|
||||||
LLSDxmlEncode.AddEmptyArray("items",lsl);
|
LLSDxmlEncode.AddEmptyArray("items", lsl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLSDxmlEncode.AddArray("items",lsl);
|
LLSDxmlEncode.AddArray("items", lsl);
|
||||||
foreach (InventoryItemBase item in items)
|
foreach (InventoryItemBase item in items)
|
||||||
{
|
{
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
item.ToLLSDxml(lsl);
|
||||||
LLSDxmlEncode.AddMap(lsl);
|
|
||||||
LLSDxmlEncode.AddElem("parent_id", item.Folder, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("asset_id", item.AssetID, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("item_id", item.ID, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddMap("permissions",lsl);
|
|
||||||
LLSDxmlEncode.AddElem("creator_id", item.CreatorIdAsUuid, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("owner_id", item.Owner, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("group_id", item.GroupID, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("base_mask", (int)item.CurrentPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("owner_mask", (int)item.CurrentPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("group_mask", (int)item.GroupPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("everyone_mask", (int)item.EveryOnePermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("next_owner_mask", (int)item.NextPermissions, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("is_owner_group", item.GroupOwned, lsl);
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddElem("type", item.AssetType, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("inv_type", item.InvType, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddMap("sale_info",lsl);
|
|
||||||
LLSDxmlEncode.AddElem("sale_price", item.SalePrice, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("sale_type", item.SaleType, lsl);
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddElem("name", item.Name, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("desc", item.Description, lsl);
|
|
||||||
LLSDxmlEncode.AddElem("created_at", item.CreationDate, lsl);
|
|
||||||
|
|
||||||
LLSDxmlEncode.AddEndMap(lsl);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
LLSDxmlEncode.AddEndArray(lsl);
|
LLSDxmlEncode.AddEndArray(lsl);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Text;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
|
|
||||||
namespace OpenSim.Framework
|
namespace OpenSim.Framework
|
||||||
|
@ -415,5 +416,41 @@ namespace OpenSim.Framework
|
||||||
{
|
{
|
||||||
return MemberwiseClone();
|
return MemberwiseClone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ToLLSDxml(StringBuilder lsl)
|
||||||
|
{
|
||||||
|
LLSDxmlEncode.AddMap(lsl);
|
||||||
|
LLSDxmlEncode.AddElem("parent_id", Folder, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("asset_id", AssetID, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("item_id", ID, lsl);
|
||||||
|
|
||||||
|
LLSDxmlEncode.AddMap("permissions",lsl);
|
||||||
|
LLSDxmlEncode.AddElem("creator_id", CreatorIdAsUuid, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("owner_id", Owner, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("group_id", GroupID, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("base_mask", (int)CurrentPermissions, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("owner_mask", (int)CurrentPermissions, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("group_mask", (int)GroupPermissions, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("everyone_mask", (int)EveryOnePermissions, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("next_owner_mask", (int)NextPermissions, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("is_owner_group", GroupOwned, lsl);
|
||||||
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
|
|
||||||
|
LLSDxmlEncode.AddElem("type", AssetType, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("inv_type", InvType, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("flags", ((int)Flags) & 0xff, lsl);
|
||||||
|
|
||||||
|
LLSDxmlEncode.AddMap("sale_info",lsl);
|
||||||
|
LLSDxmlEncode.AddElem("sale_price", SalePrice, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("sale_type", SaleType, lsl);
|
||||||
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
|
|
||||||
|
LLSDxmlEncode.AddElem("name", Name, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("desc", Description, lsl);
|
||||||
|
LLSDxmlEncode.AddElem("created_at", CreationDate, lsl);
|
||||||
|
|
||||||
|
LLSDxmlEncode.AddEndMap(lsl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
|
|
||||||
public bool Enabled { get; private set; }
|
public bool Enabled { get; private set; }
|
||||||
|
private bool m_enabledLib;
|
||||||
|
|
||||||
private Scene m_scene;
|
private Scene m_scene;
|
||||||
|
|
||||||
|
@ -68,6 +69,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
|
|
||||||
if (m_fetchInventory2Url != string.Empty)
|
if (m_fetchInventory2Url != string.Empty)
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
|
if (m_fetchInventory2Url != string.Empty)
|
||||||
|
m_enabledLib = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddRegion(Scene s)
|
public void AddRegion(Scene s)
|
||||||
|
@ -113,7 +116,8 @@ namespace OpenSim.Region.ClientStack.Linden
|
||||||
private void RegisterCaps(UUID agentID, Caps caps)
|
private void RegisterCaps(UUID agentID, Caps caps)
|
||||||
{
|
{
|
||||||
RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url);
|
RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url);
|
||||||
RegisterFetchLibCap(agentID, caps, "FetchLib2", m_fetchLib2Url);
|
if(m_enabledLib)
|
||||||
|
RegisterFetchLibCap(agentID, caps, "FetchLib2", m_fetchLib2Url);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
|
private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url)
|
||||||
|
|
Loading…
Reference in New Issue