aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Capabilities/Handlers')
-rw-r--r--OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs104
1 files changed, 0 insertions, 104 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
28using System.Reflection;
29using System.Text;
30using OpenMetaverse;
31using OpenMetaverse.StructuredData;
32using OpenSim.Framework;
33using OpenSim.Framework.Capabilities;
34using OpenSim.Framework.Servers.HttpServer;
35using OpenSim.Services.Interfaces;
36using OSDArray = OpenMetaverse.StructuredData.OSDArray;
37using OSDMap = OpenMetaverse.StructuredData.OSDMap;
38
39using log4net;
40
41namespace 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}