diff options
author | UbitUmarov | 2018-01-27 04:32:03 +0000 |
---|---|---|
committer | UbitUmarov | 2018-01-27 04:32:03 +0000 |
commit | 13b4ce81991736cf424f598233fc43a5103cc939 (patch) | |
tree | 51966348c41505aa88363f18712421b706288654 | |
parent | Let MrOpenSim have simple hardcoded profile (diff) | |
download | opensim-SC-13b4ce81991736cf424f598233fc43a5103cc939.zip opensim-SC-13b4ce81991736cf424f598233fc43a5103cc939.tar.gz opensim-SC-13b4ce81991736cf424f598233fc43a5103cc939.tar.bz2 opensim-SC-13b4ce81991736cf424f598233fc43a5103cc939.tar.xz |
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
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs | 141 | ||||
-rw-r--r-- | OpenSim/Framework/LLSDxmlEncode.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/FetchInventory2Module.cs | 35 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/ILibraryService.cs | 3 | ||||
-rw-r--r-- | OpenSim/Services/InventoryService/LibraryService.cs | 54 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 1 |
7 files changed, 228 insertions, 20 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs new file mode 100644 index 0000000..a43158b --- /dev/null +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs | |||
@@ -0,0 +1,141 @@ | |||
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 | { | ||
55 | m_inventoryService = invService; | ||
56 | m_agentID = agentId; | ||
57 | m_LibraryService = libraryService; | ||
58 | if(libraryService != null) | ||
59 | libOwner = m_LibraryService.LibraryRootFolder.Owner; | ||
60 | } | ||
61 | |||
62 | public string FetchLibRequest(string request, string path, string param, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | ||
63 | { | ||
64 | //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request); | ||
65 | |||
66 | if (m_LibraryService == null) | ||
67 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; | ||
68 | |||
69 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); | ||
70 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; | ||
71 | |||
72 | if (m_agentID == UUID.Zero) | ||
73 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; | ||
74 | |||
75 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | ||
76 | int i = 0; | ||
77 | |||
78 | foreach (OSDMap osdItemId in itemsRequested) | ||
79 | itemIDs[i++] = osdItemId["item_id"].AsUUID(); | ||
80 | |||
81 | InventoryItemBase[] items = null; | ||
82 | |||
83 | // items = m_inventoryService.GetMultipleItems(libOwner, itemIDs); | ||
84 | items = m_LibraryService.GetMultipleItems(itemIDs); | ||
85 | |||
86 | StringBuilder lsl = LLSDxmlEncode.Start(2048); | ||
87 | LLSDxmlEncode.AddMap(lsl); | ||
88 | LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl); | ||
89 | if(items == null || items.Length == 0) | ||
90 | { | ||
91 | LLSDxmlEncode.AddEmptyArray("items",lsl); | ||
92 | } | ||
93 | else | ||
94 | { | ||
95 | LLSDxmlEncode.AddArray("items",lsl); | ||
96 | foreach (InventoryItemBase item in items) | ||
97 | { | ||
98 | if (item != null) | ||
99 | { | ||
100 | LLSDxmlEncode.AddMap(lsl); | ||
101 | LLSDxmlEncode.AddElem("parent_id", item.Folder, lsl); | ||
102 | LLSDxmlEncode.AddElem("asset_id", item.AssetID, lsl); | ||
103 | LLSDxmlEncode.AddElem("item_id", item.ID, lsl); | ||
104 | |||
105 | LLSDxmlEncode.AddMap("permissions",lsl); | ||
106 | LLSDxmlEncode.AddElem("creator_id", item.CreatorIdAsUuid, lsl); | ||
107 | LLSDxmlEncode.AddElem("owner_id", item.Owner, lsl); | ||
108 | LLSDxmlEncode.AddElem("group_id", item.GroupID, lsl); | ||
109 | LLSDxmlEncode.AddElem("base_mask", (int)item.CurrentPermissions, lsl); | ||
110 | LLSDxmlEncode.AddElem("owner_mask", (int)item.CurrentPermissions, lsl); | ||
111 | LLSDxmlEncode.AddElem("group_mask", (int)item.GroupPermissions, lsl); | ||
112 | LLSDxmlEncode.AddElem("everyone_mask", (int)item.EveryOnePermissions, lsl); | ||
113 | LLSDxmlEncode.AddElem("next_owner_mask", (int)item.NextPermissions, lsl); | ||
114 | LLSDxmlEncode.AddElem("is_owner_group", item.GroupOwned, lsl); | ||
115 | LLSDxmlEncode.AddEndMap(lsl); | ||
116 | |||
117 | LLSDxmlEncode.AddElem("type", item.AssetType, lsl); | ||
118 | LLSDxmlEncode.AddElem("inv_type", item.InvType, lsl); | ||
119 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
120 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
121 | |||
122 | LLSDxmlEncode.AddMap("sale_info",lsl); | ||
123 | LLSDxmlEncode.AddElem("sale_price", item.SalePrice, lsl); | ||
124 | LLSDxmlEncode.AddElem("sale_type", item.SaleType, lsl); | ||
125 | LLSDxmlEncode.AddEndMap(lsl); | ||
126 | |||
127 | LLSDxmlEncode.AddElem("name", item.Name, lsl); | ||
128 | LLSDxmlEncode.AddElem("desc", item.Description, lsl); | ||
129 | LLSDxmlEncode.AddElem("created_at", item.CreationDate, lsl); | ||
130 | |||
131 | LLSDxmlEncode.AddEndMap(lsl); | ||
132 | } | ||
133 | } | ||
134 | LLSDxmlEncode.AddEndArray(lsl); | ||
135 | } | ||
136 | |||
137 | LLSDxmlEncode.AddEndMap(lsl); | ||
138 | return LLSDxmlEncode.End(lsl);; | ||
139 | } | ||
140 | } | ||
141 | } | ||
diff --git a/OpenSim/Framework/LLSDxmlEncode.cs b/OpenSim/Framework/LLSDxmlEncode.cs index 5447963..bd99cd6 100644 --- a/OpenSim/Framework/LLSDxmlEncode.cs +++ b/OpenSim/Framework/LLSDxmlEncode.cs | |||
@@ -81,7 +81,7 @@ namespace OpenSim.Framework | |||
81 | sb.Append("</map>"); | 81 | sb.Append("</map>"); |
82 | } | 82 | } |
83 | 83 | ||
84 | public static void AddEmpyMap(StringBuilder sb) | 84 | public static void AddEmptyMap(StringBuilder sb) |
85 | { | 85 | { |
86 | sb.Append("<map />"); | 86 | sb.Append("<map />"); |
87 | } | 87 | } |
@@ -97,7 +97,7 @@ namespace OpenSim.Framework | |||
97 | sb.Append("</array>"); | 97 | sb.Append("</array>"); |
98 | } | 98 | } |
99 | 99 | ||
100 | public static void AddEmpyArray(StringBuilder sb) | 100 | public static void AddEmptyArray(StringBuilder sb) |
101 | { | 101 | { |
102 | sb.Append("<array />"); | 102 | sb.Append("<array />"); |
103 | } | 103 | } |
@@ -254,7 +254,7 @@ namespace OpenSim.Framework | |||
254 | sb.Append("</key><map>"); | 254 | sb.Append("</key><map>"); |
255 | } | 255 | } |
256 | 256 | ||
257 | public static void AddEmpyMap(string name, StringBuilder sb) | 257 | public static void AddEmptyMap(string name, StringBuilder sb) |
258 | { | 258 | { |
259 | sb.Append("<key>"); | 259 | sb.Append("<key>"); |
260 | sb.Append(name); | 260 | sb.Append(name); |
@@ -269,7 +269,7 @@ namespace OpenSim.Framework | |||
269 | sb.Append("</key><array>"); | 269 | sb.Append("</key><array>"); |
270 | } | 270 | } |
271 | 271 | ||
272 | public static void AddEmpyArray(string name, StringBuilder sb) | 272 | public static void AddEmptyArray(string name, StringBuilder sb) |
273 | { | 273 | { |
274 | sb.Append("<key>"); | 274 | sb.Append("<key>"); |
275 | sb.Append(name); | 275 | sb.Append(name); |
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 | |||
1381 | StringBuilder lsl = LLSDxmlEncode.Start(); | 1381 | StringBuilder lsl = LLSDxmlEncode.Start(); |
1382 | 1382 | ||
1383 | if(object_ids.Count == 0) | 1383 | if(object_ids.Count == 0) |
1384 | LLSDxmlEncode.AddEmpyMap(lsl); | 1384 | LLSDxmlEncode.AddEmptyMap(lsl); |
1385 | else | 1385 | else |
1386 | { | 1386 | { |
1387 | LLSDxmlEncode.AddMap(lsl); | 1387 | LLSDxmlEncode.AddMap(lsl); |
@@ -1419,7 +1419,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1419 | StringBuilder lsl = LLSDxmlEncode.Start(512); | 1419 | StringBuilder lsl = LLSDxmlEncode.Start(512); |
1420 | 1420 | ||
1421 | if(object_ids.Count == 0) | 1421 | if(object_ids.Count == 0) |
1422 | LLSDxmlEncode.AddEmpyMap(lsl); | 1422 | LLSDxmlEncode.AddEmptyMap(lsl); |
1423 | else | 1423 | else |
1424 | { | 1424 | { |
1425 | bool haveone = false; | 1425 | bool haveone = false; |
@@ -1854,7 +1854,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1854 | StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); | 1854 | StringBuilder lsl = LLSDxmlEncode.Start(names.Count * 256 + 256); |
1855 | LLSDxmlEncode.AddMap(lsl); | 1855 | LLSDxmlEncode.AddMap(lsl); |
1856 | if(names.Count == 0) | 1856 | if(names.Count == 0) |
1857 | LLSDxmlEncode.AddEmpyArray("agents", lsl); | 1857 | LLSDxmlEncode.AddEmptyArray("agents", lsl); |
1858 | else | 1858 | else |
1859 | { | 1859 | { |
1860 | LLSDxmlEncode.AddArray("agents", lsl); | 1860 | 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 | |||
51 | private Scene m_scene; | 51 | private Scene m_scene; |
52 | 52 | ||
53 | private IInventoryService m_inventoryService; | 53 | private IInventoryService m_inventoryService; |
54 | 54 | private ILibraryService m_LibraryService; | |
55 | private string m_fetchInventory2Url; | 55 | private string m_fetchInventory2Url; |
56 | private string m_fetchLib2Url; | ||
56 | 57 | ||
57 | #region ISharedRegionModule Members | 58 | #region ISharedRegionModule Members |
58 | 59 | ||
@@ -63,6 +64,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
63 | return; | 64 | return; |
64 | 65 | ||
65 | m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); | 66 | m_fetchInventory2Url = config.GetString("Cap_FetchInventory2", string.Empty); |
67 | m_fetchLib2Url = config.GetString("Cap_FetchLib2", "localhost"); | ||
66 | 68 | ||
67 | if (m_fetchInventory2Url != string.Empty) | 69 | if (m_fetchInventory2Url != string.Empty) |
68 | Enabled = true; | 70 | Enabled = true; |
@@ -91,7 +93,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
91 | return; | 93 | return; |
92 | 94 | ||
93 | m_inventoryService = m_scene.InventoryService; | 95 | m_inventoryService = m_scene.InventoryService; |
94 | 96 | m_LibraryService = m_scene.LibraryService; | |
95 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; | 97 | m_scene.EventManager.OnRegisterCaps += RegisterCaps; |
96 | } | 98 | } |
97 | 99 | ||
@@ -111,6 +113,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
111 | private void RegisterCaps(UUID agentID, Caps caps) | 113 | private void RegisterCaps(UUID agentID, Caps caps) |
112 | { | 114 | { |
113 | RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); | 115 | RegisterFetchCap(agentID, caps, "FetchInventory2", m_fetchInventory2Url); |
116 | RegisterFetchLibCap(agentID, caps, "FetchLib2", m_fetchLib2Url); | ||
114 | } | 117 | } |
115 | 118 | ||
116 | private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) | 119 | private void RegisterFetchCap(UUID agentID, Caps caps, string capName, string url) |
@@ -140,5 +143,33 @@ namespace OpenSim.Region.ClientStack.Linden | |||
140 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", | 143 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", |
141 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | 144 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); |
142 | } | 145 | } |
146 | |||
147 | private void RegisterFetchLibCap(UUID agentID, Caps caps, string capName, string url) | ||
148 | { | ||
149 | string capUrl; | ||
150 | |||
151 | if (url == "localhost") | ||
152 | { | ||
153 | capUrl = "/CAPS/" + UUID.Random(); | ||
154 | |||
155 | FetchLib2Handler fetchHandler = new FetchLib2Handler(m_inventoryService, m_LibraryService, agentID); | ||
156 | |||
157 | IRequestHandler reqHandler | ||
158 | = new RestStreamHandler( | ||
159 | "POST", capUrl, fetchHandler.FetchLibRequest, capName, agentID.ToString()); | ||
160 | |||
161 | caps.RegisterHandler(capName, reqHandler); | ||
162 | } | ||
163 | else | ||
164 | { | ||
165 | capUrl = url; | ||
166 | |||
167 | caps.RegisterHandler(capName, capUrl); | ||
168 | } | ||
169 | |||
170 | // m_log.DebugFormat( | ||
171 | // "[FETCH INVENTORY2 MODULE]: Registered capability {0} at {1} in region {2} for {3}", | ||
172 | // capName, capUrl, m_scene.RegionInfo.RegionName, agentID); | ||
173 | } | ||
143 | } | 174 | } |
144 | } | 175 | } |
diff --git a/OpenSim/Services/Interfaces/ILibraryService.cs b/OpenSim/Services/Interfaces/ILibraryService.cs index 861cf0e..ea914da 100644 --- a/OpenSim/Services/Interfaces/ILibraryService.cs +++ b/OpenSim/Services/Interfaces/ILibraryService.cs | |||
@@ -38,6 +38,7 @@ namespace OpenSim.Services.Interfaces | |||
38 | InventoryFolderImpl LibraryRootFolder { get; } | 38 | InventoryFolderImpl LibraryRootFolder { get; } |
39 | 39 | ||
40 | Dictionary<UUID, InventoryFolderImpl> GetAllFolders(); | 40 | Dictionary<UUID, InventoryFolderImpl> GetAllFolders(); |
41 | InventoryItemBase GetItem(UUID itemID); | ||
42 | InventoryItemBase[] GetMultipleItems(UUID[] itemIDs); | ||
41 | } | 43 | } |
42 | |||
43 | } | 44 | } |
diff --git a/OpenSim/Services/InventoryService/LibraryService.cs b/OpenSim/Services/InventoryService/LibraryService.cs index c4a5572..89967a7 100644 --- a/OpenSim/Services/InventoryService/LibraryService.cs +++ b/OpenSim/Services/InventoryService/LibraryService.cs | |||
@@ -50,25 +50,35 @@ namespace OpenSim.Services.InventoryService | |||
50 | { | 50 | { |
51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 51 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
52 | 52 | ||
53 | private InventoryFolderImpl m_LibraryRootFolder; | 53 | static private InventoryFolderImpl m_LibraryRootFolder; |
54 | 54 | ||
55 | public InventoryFolderImpl LibraryRootFolder | 55 | public InventoryFolderImpl LibraryRootFolder |
56 | { | 56 | { |
57 | get { return m_LibraryRootFolder; } | 57 | get { return m_LibraryRootFolder; } |
58 | } | 58 | } |
59 | 59 | ||
60 | private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); | 60 | static private UUID libOwner = new UUID("11111111-1111-0000-0000-000100bba000"); |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Holds the root library folder and all its descendents. This is really only used during inventory | 63 | /// Holds the root library folder and all its descendents. This is really only used during inventory |
64 | /// setup so that we don't have to repeatedly search the tree of library folders. | 64 | /// setup so that we don't have to repeatedly search the tree of library folders. |
65 | /// </summary> | 65 | /// </summary> |
66 | protected Dictionary<UUID, InventoryFolderImpl> libraryFolders | 66 | static protected Dictionary<UUID, InventoryFolderImpl> libraryFolders |
67 | = new Dictionary<UUID, InventoryFolderImpl>(); | 67 | = new Dictionary<UUID, InventoryFolderImpl>(32); |
68 | 68 | ||
69 | public LibraryService(IConfigSource config) | 69 | static protected Dictionary<UUID, InventoryItemBase> m_items = new Dictionary<UUID, InventoryItemBase>(256); |
70 | : base(config) | 70 | static LibraryService m_root; |
71 | static object m_rootLock = new object(); | ||
72 | |||
73 | public LibraryService(IConfigSource config):base(config) | ||
71 | { | 74 | { |
75 | lock(m_rootLock) | ||
76 | { | ||
77 | if(m_root != null) | ||
78 | return; | ||
79 | m_root = this; | ||
80 | } | ||
81 | |||
72 | string pLibrariesLocation = Path.Combine("inventory", "Libraries.xml"); | 82 | string pLibrariesLocation = Path.Combine("inventory", "Libraries.xml"); |
73 | string pLibName = "OpenSim Library"; | 83 | string pLibName = "OpenSim Library"; |
74 | 84 | ||
@@ -187,7 +197,8 @@ namespace OpenSim.Services.InventoryService | |||
187 | InventoryItemBase item = new InventoryItemBase(); | 197 | InventoryItemBase item = new InventoryItemBase(); |
188 | item.Owner = libOwner; | 198 | item.Owner = libOwner; |
189 | item.CreatorId = libOwner.ToString(); | 199 | item.CreatorId = libOwner.ToString(); |
190 | item.ID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString())); | 200 | UUID itID = new UUID(config.GetString("inventoryID", m_LibraryRootFolder.ID.ToString())); |
201 | item.ID = itID; | ||
191 | item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); | 202 | item.AssetID = new UUID(config.GetString("assetID", item.ID.ToString())); |
192 | item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); | 203 | item.Folder = new UUID(config.GetString("folderID", m_LibraryRootFolder.ID.ToString())); |
193 | item.Name = config.GetString("name", String.Empty); | 204 | item.Name = config.GetString("name", String.Empty); |
@@ -204,11 +215,12 @@ namespace OpenSim.Services.InventoryService | |||
204 | if (libraryFolders.ContainsKey(item.Folder)) | 215 | if (libraryFolders.ContainsKey(item.Folder)) |
205 | { | 216 | { |
206 | InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; | 217 | InventoryFolderImpl parentFolder = libraryFolders[item.Folder]; |
207 | try | 218 | if(!parentFolder.Items.ContainsKey(itID)) |
208 | { | 219 | { |
209 | parentFolder.Items.Add(item.ID, item); | 220 | parentFolder.Items.Add(itID, item); |
221 | m_items[itID] = item; | ||
210 | } | 222 | } |
211 | catch (Exception) | 223 | else |
212 | { | 224 | { |
213 | m_log.WarnFormat("[LIBRARY INVENTORY] Item {1} [{0}] not added, duplicate item", item.ID, item.Name); | 225 | m_log.WarnFormat("[LIBRARY INVENTORY] Item {1} [{0}] not added, duplicate item", item.ID, item.Name); |
214 | } | 226 | } |
@@ -281,5 +293,27 @@ namespace OpenSim.Services.InventoryService | |||
281 | folders.AddRange(subs); | 293 | folders.AddRange(subs); |
282 | return folders; | 294 | return folders; |
283 | } | 295 | } |
296 | |||
297 | public InventoryItemBase GetItem(UUID itemID) | ||
298 | { | ||
299 | if(m_items.ContainsKey(itemID)) | ||
300 | return m_items[itemID]; | ||
301 | return null; | ||
302 | } | ||
303 | |||
304 | public InventoryItemBase[] GetMultipleItems(UUID[] ids) | ||
305 | { | ||
306 | List<InventoryItemBase> items = new List<InventoryItemBase>(); | ||
307 | int i = 0; | ||
308 | foreach (UUID id in ids) | ||
309 | { | ||
310 | if(m_items.ContainsKey(id)) | ||
311 | items.Add(m_items[id]); | ||
312 | } | ||
313 | |||
314 | if(items.Count == 0) | ||
315 | return null; | ||
316 | return items.ToArray(); | ||
317 | } | ||
284 | } | 318 | } |
285 | } | 319 | } |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 51f6c9c..6c32c9b 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -843,6 +843,7 @@ | |||
843 | Cap_WebFetchInventoryDescendents = "" | 843 | Cap_WebFetchInventoryDescendents = "" |
844 | Cap_FetchInventoryDescendents2 = "localhost" | 844 | Cap_FetchInventoryDescendents2 = "localhost" |
845 | Cap_FetchInventory2 = "localhost" | 845 | Cap_FetchInventory2 = "localhost" |
846 | Cap_FetchLib2 = "localhost" | ||
846 | 847 | ||
847 | ; Capability for searching for people | 848 | ; Capability for searching for people |
848 | Cap_AvatarPickerSearch = "localhost" | 849 | Cap_AvatarPickerSearch = "localhost" |