diff options
author | UbitUmarov | 2018-01-31 15:19:16 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-31 15:19:16 +0000 |
commit | 3635943d39c337f75a3be48fdb4be2cae20e4bd4 (patch) | |
tree | 2d56e43c6c3196ac322bcc7114949291b3a59bd5 | |
parent | disable the new Cap_FetchLib2 because viewers do not suport it for opensim. T... (diff) | |
download | opensim-SC-3635943d39c337f75a3be48fdb4be2cae20e4bd4.zip opensim-SC-3635943d39c337f75a3be48fdb4be2cae20e4bd4.tar.gz opensim-SC-3635943d39c337f75a3be48fdb4be2cae20e4bd4.tar.bz2 opensim-SC-3635943d39c337f75a3be48fdb4be2cae20e4bd4.tar.xz |
remove cap FetchLib2 suport code
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs | 104 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs | 35 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 5 |
3 files changed, 0 insertions, 144 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs deleted file mode 100644 index 264c41d..0000000 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs +++ /dev/null | |||
@@ -1,104 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System.Reflection; | ||
29 | using System.Text; | ||
30 | using OpenMetaverse; | ||
31 | using OpenMetaverse.StructuredData; | ||
32 | using OpenSim.Framework; | ||
33 | using OpenSim.Framework.Capabilities; | ||
34 | using OpenSim.Framework.Servers.HttpServer; | ||
35 | using OpenSim.Services.Interfaces; | ||
36 | using OSDArray = OpenMetaverse.StructuredData.OSDArray; | ||
37 | using OSDMap = OpenMetaverse.StructuredData.OSDMap; | ||
38 | |||
39 | using log4net; | ||
40 | |||
41 | namespace OpenSim.Capabilities.Handlers | ||
42 | { | ||
43 | public class FetchLib2Handler | ||
44 | { | ||
45 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
46 | |||
47 | private IInventoryService m_inventoryService; | ||
48 | private ILibraryService m_LibraryService; | ||
49 | private UUID m_agentID; | ||
50 | private UUID libOwner; | ||
51 | |||
52 | public FetchLib2Handler(IInventoryService invService, ILibraryService libraryService, UUID agentId) | ||
53 | { | ||
54 | m_inventoryService = invService; | ||
55 | m_agentID = agentId; | ||
56 | m_LibraryService = libraryService; | ||
57 | if(libraryService != null) | ||
58 | libOwner = m_LibraryService.LibraryRootFolder.Owner; | ||
59 | } | ||
60 | |||
61 | public string FetchLibRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
62 | { | ||
63 | //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request); | ||
64 | |||
65 | if (m_LibraryService == null || m_agentID == UUID.Zero) | ||
66 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; | ||
67 | |||
68 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); | ||
69 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; | ||
70 | |||
71 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | ||
72 | int i = 0; | ||
73 | |||
74 | foreach (OSDMap osdItemId in itemsRequested) | ||
75 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); | ||
76 | |||
77 | InventoryItemBase[] items = null; | ||
78 | |||
79 | // items = m_inventoryService.GetMultipleItems(libOwner, itemIDs); | ||
80 | items = m_LibraryService.GetMultipleItems(itemIDs); | ||
81 | |||
82 | StringBuilder lsl = LLSDxmlEncode.Start(2048); | ||
83 | LLSDxmlEncode.AddMap(lsl); | ||
84 | LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl); | ||
85 | if(items == null || items.Length == 0) | ||
86 | { | ||
87 | LLSDxmlEncode.AddEmptyArray("items", lsl); | ||
88 | } | ||
89 | else | ||
90 | { | ||
91 | LLSDxmlEncode.AddArray("items", lsl); | ||
92 | foreach (InventoryItemBase item in items) | ||
93 | { | ||
94 | if (item != null) | ||
95 | item.ToLLSDxml(lsl); | ||
96 | } | ||
97 | LLSDxmlEncode.AddEndArray(lsl); | ||
98 | } | ||
99 | |||
100 | LLSDxmlEncode.AddEndMap(lsl); | ||
101 | return LLSDxmlEncode.End(lsl);; | ||
102 | } | ||
103 | } | ||
104 | } | ||
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs index 0ea4bdb..eef9435 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs | |||
@@ -47,14 +47,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 47 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
48 | 48 | ||
49 | public bool Enabled { get; private set; } | 49 | public bool Enabled { get; private set; } |
50 | private bool m_enabledLib; | ||
51 | 50 | ||
52 | private Scene m_scene; | 51 | private Scene m_scene; |
53 | 52 | ||
54 | private IInventoryService m_inventoryService; | 53 | private IInventoryService m_inventoryService; |
55 | private ILibraryService m_LibraryService; | 54 | private ILibraryService m_LibraryService; |
56 | private string m_fetchInventory2Url; | 55 | private string m_fetchInventory2Url; |
57 | private string m_fetchLib2Url; | ||
58 | 56 | ||
59 | #region ISharedRegionModule Members | 57 | #region ISharedRegionModule Members |
60 | 58 | ||
@@ -65,12 +63,9 @@ namespace OpenSim.Region.ClientStack.Linden | |||
65 | return; | 63 | return; |
66 | 64 | ||
67 | m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); | 65 | m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); |
68 | m_fetchLib2Url = config.GetString("Cap_FetchLib2", "localhost"); | ||
69 | 66 | ||
70 | if (m_fetchInventory2Url != string.Empty) | 67 | if (m_fetchInventory2Url != string.Empty) |
71 | Enabled = true; | 68 | Enabled = true; |
72 | if (m_fetchInventory2Url != string.Empty) | ||
73 | m_enabledLib = true; | ||
74 | } | 69 | } |
75 | 70 | ||
76 | public void AddRegion(Scene s) | 71 | public void AddRegion(Scene s) |
@@ -116,8 +111,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
116 | private void RegisterCaps(UUID agentID, Caps caps) | 111 | private void RegisterCaps(UUID agentID, Caps caps) |
117 | { | 112 | { |
118 | RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); | 113 | RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); |
119 | if(m_enabledLib) | ||
120 | RegisterFetchLibCap(agentID, caps, "FetchLib2", m_fetchLib2Url); | ||
121 | } | 114 | } |
122 | 115 | ||
123 | private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) | 116 | private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) |
@@ -147,33 +140,5 @@ namespace OpenSim.Region.ClientStack.Linden | |||
147 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", | 140 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", |
148 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | 141 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); |
149 | } | 142 | } |
150 | |||
151 | private void RegisterFetchLibCap(UUID agentID, Caps caps, string capName, string url) | ||
152 | { | ||
153 | string capUrl; | ||
154 | |||
155 | if (url == "localhost") | ||
156 | { | ||
157 | capUrl = "/CAPS/" + UUID.Random(); | ||
158 | |||
159 | FetchLib2Handler fetchHandler = new FetchLib2Handler(m_inventoryService, m_LibraryService, agentID); | ||
160 | |||
161 | IRequestHandler reqHandler | ||
162 | = new RestStreamHandler( | ||
163 | "POST", capUrl, fetchHandler.FetchLibRequest, capName, agentID.ToString()); | ||
164 | |||
165 | caps.RegisterHandler(capName, reqHandler); | ||
166 | } | ||
167 | else | ||
168 | { | ||
169 | capUrl = url; | ||
170 | |||
171 | caps.RegisterHandler(capName, capUrl); | ||
172 | } | ||
173 | |||
174 | // m_log.DebugFormat( | ||
175 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", | ||
176 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | ||
177 | } | ||
178 | } | 143 | } |
179 | } | 144 | } |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index d96ab4f..51f6c9c 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -844,11 +844,6 @@ | |||
844 | Cap_FetchInventoryDescendents2 = "localhost" | 844 | Cap_FetchInventoryDescendents2 = "localhost" |
845 | Cap_FetchInventory2 = "localhost" | 845 | Cap_FetchInventory2 = "localhost" |
846 | 846 | ||
847 | ; do uncomment Cap_FetchLib2 for now | ||
848 | ; Current viewers do not suport it for opensim. | ||
849 | ; in same requests they use a hard coded ll library owner id. | ||
850 | ;Cap_FetchLib2 = "localhost" | ||
851 | |||
852 | ; Capability for searching for people | 847 | ; Capability for searching for people |
853 | Cap_AvatarPickerSearch = "localhost" | 848 | Cap_AvatarPickerSearch = "localhost" |
854 | 849 | ||