From 13b4ce81991736cf424f598233fc43a5103cc939 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sat, 27 Jan 2018 04:32:03 +0000 Subject: add Cap_FetchLib2 note that this is still local to regions, not using grid as it possible should, but this needs more work, and issue with HG older grids/regions --- .../Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 ++-- .../Linden/Caps/FetchInventory2Module.cs | 35 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index bbfe68c..b8d423f 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs @@ -1381,7 +1381,7 @@ namespace OpenSim.Region.ClientStack.Linden StringBuilder lsl = LLSDxmlEncode.Start(); if(object_ids.Count == 0) - LLSDxmlEncode.AddEmpyMap(lsl); + LLSDxmlEncode.AddEmptyMap(lsl); else { LLSDxmlEncode.AddMap(lsl); @@ -1419,7 +1419,7 @@ namespace OpenSim.Region.ClientStack.Linden StringBuilder lsl = LLSDxmlEncode.Start(512); if(object_ids.Count == 0) - LLSDxmlEncode.AddEmpyMap(lsl); + LLSDxmlEncode.AddEmptyMap(lsl); else { bool haveone = false; @@ -1854,7 +1854,7 @@ namespace OpenSim.Region.ClientStack.Linden StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); LLSDxmlEncode.AddMap(lsl); if(names.Count == 0) - LLSDxmlEncode.AddEmpyArray("agents", lsl); + LLSDxmlEncode.AddEmptyArray("agents", lsl); else { LLSDxmlEncode.AddArray("agents", lsl); diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs index e0a11cc..c5cad8e 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs @@ -51,8 +51,9 @@ namespace OpenSim.Region.ClientStack.Linden private Scene m_scene; private IInventoryService m_inventoryService; - + private ILibraryService m_LibraryService; private string m_fetchInventory2Url; + private string m_fetchLib2Url; #region ISharedRegionModule Members @@ -63,6 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden return; m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); + m_fetchLib2Url = config.GetString("Cap_FetchLib2", "localhost"); if (m_fetchInventory2Url != string.Empty) Enabled = true; @@ -91,7 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden return; m_inventoryService = m_scene.InventoryService; - + m_LibraryService = m_scene.LibraryService; m_scene.EventManager.OnRegisterCaps += RegisterCaps; } @@ -111,6 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden private void RegisterCaps(UUID agentID, Caps caps) { RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); + RegisterFetchLibCap(agentID, caps, "FetchLib2", m_fetchLib2Url); } private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) @@ -140,5 +143,33 @@ namespace OpenSim.Region.ClientStack.Linden // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); } + + private void RegisterFetchLibCap(UUID agentID, Caps caps, string capName, string url) + { + string capUrl; + + if (url == "localhost") + { + capUrl = "/CAPS/" + UUID.Random(); + + FetchLib2Handler fetchHandler = new FetchLib2Handler(m_inventoryService, m_LibraryService, agentID); + + IRequestHandler reqHandler + = new RestStreamHandler( + "POST", capUrl, fetchHandler.FetchLibRequest, capName, agentID.ToString()); + + caps.RegisterHandler(capName, reqHandler); + } + else + { + capUrl = url; + + caps.RegisterHandler(capName, capUrl); + } + +// m_log.DebugFormat( +// "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", +// capName, capUrl, m_scene.RegionInfo.RegionName, agentID); + } } } -- cgit v1.1