diff options
Diffstat (limited to 'OpenSim/Region')
3 files changed, 166 insertions, 807 deletions
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs new file mode 100644 index 0000000..525dda7 --- /dev/null +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryModule.cs | |||
@@ -0,0 +1,165 @@ | |||
1 | /** | ||
2 | * Copyright (c) 2008, Contributors. All rights reserved. | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without modification, | ||
6 | * are permitted provided that the following conditions are met: | ||
7 | * | ||
8 | * * Redistributions of source code must retain the above copyright notice, | ||
9 | * this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright notice, | ||
11 | * this list of conditions and the following disclaimer in the documentation | ||
12 | * and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the Organizations nor the names of Individual | ||
14 | * Contributors may be used to endorse or promote products derived from | ||
15 | * this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using OpenSim.Framework.Communications.Services; | ||
41 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
42 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; | ||
43 | using OpenSim.Framework.Servers; | ||
44 | using OpenSim.Framework.Servers.Interfaces; | ||
45 | using OpenSim.Region.Framework.Interfaces; | ||
46 | using OpenSim.Region.Framework.Scenes; | ||
47 | using OpenSim.Region.CoreModules.Communications.REST; | ||
48 | |||
49 | using OpenMetaverse.StructuredData; | ||
50 | |||
51 | namespace OpenSim.Region.CoreModules.Hypergrid | ||
52 | { | ||
53 | public class HGStandaloneInventoryModule : IRegionModule | ||
54 | { | ||
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
56 | private static bool initialized = false; | ||
57 | private static bool enabled = false; | ||
58 | |||
59 | private bool m_doLookup = false; | ||
60 | Scene m_scene; | ||
61 | HGInventoryService m_inventoryService; | ||
62 | InventoryServiceBase m_inventoryBase; | ||
63 | |||
64 | public bool DoLookup | ||
65 | { | ||
66 | get { return m_doLookup; } | ||
67 | set { m_doLookup = value; } | ||
68 | } | ||
69 | |||
70 | #region IRegionModule interface | ||
71 | |||
72 | public void Initialise(Scene scene, IConfigSource config) | ||
73 | { | ||
74 | if (!initialized) | ||
75 | { | ||
76 | initialized = true; | ||
77 | m_scene = scene; | ||
78 | |||
79 | // This module is only on for standalones | ||
80 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | ||
81 | } | ||
82 | } | ||
83 | |||
84 | public void PostInitialise() | ||
85 | { | ||
86 | if (enabled) | ||
87 | { | ||
88 | m_log.Info("[HGStandaloneInvModule]: Starting..."); | ||
89 | //m_inventoryService = new InventoryService(m_scene); | ||
90 | m_inventoryBase = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | ||
91 | |||
92 | m_inventoryService = new HGInventoryService(m_inventoryBase, | ||
93 | ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin, | ||
94 | (UserManagerBase)m_scene.CommsManager.UserService, m_scene.CommsManager.HttpServer, | ||
95 | m_scene.CommsManager.NetworkServersInfo.InventoryURL); | ||
96 | |||
97 | AddHttpHandlers(m_scene.CommsManager.HttpServer); | ||
98 | m_inventoryService.AddHttpHandlers(); | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public void Close() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public string Name | ||
107 | { | ||
108 | get { return "HGStandaloneInventoryModule"; } | ||
109 | } | ||
110 | |||
111 | public bool IsSharedModule | ||
112 | { | ||
113 | get { return true; } | ||
114 | } | ||
115 | |||
116 | #endregion | ||
117 | |||
118 | public virtual void AddHttpHandlers(IHttpServer httpServer) | ||
119 | { | ||
120 | |||
121 | httpServer.AddStreamHandler( | ||
122 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
123 | "POST", "/GetInventory/", m_inventoryService.GetUserInventory, CheckAuthSession)); | ||
124 | |||
125 | httpServer.AddStreamHandler( | ||
126 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
127 | "POST", "/NewFolder/", m_inventoryBase.AddFolder, CheckAuthSession)); | ||
128 | |||
129 | httpServer.AddStreamHandler( | ||
130 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
131 | "POST", "/UpdateFolder/", m_inventoryBase.UpdateFolder, CheckAuthSession)); | ||
132 | |||
133 | httpServer.AddStreamHandler( | ||
134 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
135 | "POST", "/MoveFolder/", m_inventoryBase.MoveFolder, CheckAuthSession)); | ||
136 | |||
137 | httpServer.AddStreamHandler( | ||
138 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
139 | "POST", "/PurgeFolder/", m_inventoryBase.PurgeFolder, CheckAuthSession)); | ||
140 | |||
141 | httpServer.AddStreamHandler( | ||
142 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
143 | "POST", "/NewItem/", m_inventoryBase.AddItem, CheckAuthSession)); | ||
144 | |||
145 | httpServer.AddStreamHandler( | ||
146 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
147 | "POST", "/DeleteItem/", m_inventoryBase.DeleteItem, CheckAuthSession)); | ||
148 | |||
149 | } | ||
150 | |||
151 | /// <summary> | ||
152 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | ||
153 | /// that agent. | ||
154 | /// </summary> | ||
155 | /// <param name="session_id"></param> | ||
156 | /// <param name="avatar_id"></param> | ||
157 | /// <returns></returns> | ||
158 | public bool CheckAuthSession(string session_id, string avatar_id) | ||
159 | { | ||
160 | return true; | ||
161 | } | ||
162 | |||
163 | } | ||
164 | |||
165 | } | ||
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs deleted file mode 100644 index e619f13..0000000 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneInventoryService.cs +++ /dev/null | |||
@@ -1,807 +0,0 @@ | |||
1 | /** | ||
2 | * Copyright (c) 2008, Contributors. All rights reserved. | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without modification, | ||
6 | * are permitted provided that the following conditions are met: | ||
7 | * | ||
8 | * * Redistributions of source code must retain the above copyright notice, | ||
9 | * this list of conditions and the following disclaimer. | ||
10 | * * Redistributions in binary form must reproduce the above copyright notice, | ||
11 | * this list of conditions and the following disclaimer in the documentation | ||
12 | * and/or other materials provided with the distribution. | ||
13 | * * Neither the name of the Organizations nor the names of Individual | ||
14 | * Contributors may be used to endorse or promote products derived from | ||
15 | * this software without specific prior written permission. | ||
16 | * | ||
17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | ||
19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL | ||
20 | * THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | ||
21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE | ||
22 | * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | ||
23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
24 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | ||
25 | * OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | using System.Collections; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using log4net; | ||
34 | using Nini.Config; | ||
35 | using OpenMetaverse; | ||
36 | using OpenSim.Data; | ||
37 | using OpenSim.Framework; | ||
38 | using OpenSim.Framework.Communications; | ||
39 | using OpenSim.Framework.Communications.Cache; | ||
40 | using Caps = OpenSim.Framework.Communications.Capabilities.Caps; | ||
41 | using LLSDHelpers = OpenSim.Framework.Communications.Capabilities.LLSDHelpers; | ||
42 | using OpenSim.Framework.Servers; | ||
43 | using OpenSim.Framework.Servers.Interfaces; | ||
44 | using OpenSim.Region.Framework.Interfaces; | ||
45 | using OpenSim.Region.Framework.Scenes; | ||
46 | using OpenSim.Region.CoreModules.Communications.REST; | ||
47 | |||
48 | using OpenMetaverse.StructuredData; | ||
49 | |||
50 | namespace OpenSim.Region.CoreModules.Hypergrid | ||
51 | { | ||
52 | public class HGStandaloneInventoryService : IRegionModule | ||
53 | { | ||
54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
55 | private static bool initialized = false; | ||
56 | private static bool enabled = false; | ||
57 | |||
58 | Scene m_scene; | ||
59 | //InventoryService m_inventoryService; | ||
60 | |||
61 | #region IRegionModule interface | ||
62 | |||
63 | public void Initialise(Scene scene, IConfigSource config) | ||
64 | { | ||
65 | if (!initialized) | ||
66 | { | ||
67 | initialized = true; | ||
68 | m_scene = scene; | ||
69 | |||
70 | // This module is only on for standalones | ||
71 | enabled = !config.Configs["Startup"].GetBoolean("gridmode", true) && config.Configs["Startup"].GetBoolean("hypergrid", false); | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public void PostInitialise() | ||
76 | { | ||
77 | if (enabled) | ||
78 | { | ||
79 | m_log.Info("[HGStandaloneInvService]: Starting..."); | ||
80 | //m_inventoryService = new InventoryService(m_scene); | ||
81 | new InventoryService(m_scene); | ||
82 | } | ||
83 | } | ||
84 | |||
85 | public void Close() | ||
86 | { | ||
87 | } | ||
88 | |||
89 | public string Name | ||
90 | { | ||
91 | get { return "HGStandaloneInventoryService"; } | ||
92 | } | ||
93 | |||
94 | public bool IsSharedModule | ||
95 | { | ||
96 | get { return true; } | ||
97 | } | ||
98 | |||
99 | #endregion | ||
100 | } | ||
101 | |||
102 | public class InventoryService | ||
103 | { | ||
104 | private static readonly ILog m_log | ||
105 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
106 | |||
107 | private InventoryServiceBase m_inventoryService; | ||
108 | private UserManagerBase m_userService; | ||
109 | IAssetDataPlugin m_assetProvider; | ||
110 | private Scene m_scene; | ||
111 | private bool m_doLookup = false; | ||
112 | private string m_thisInventoryUrl = "http://localhost:9000"; | ||
113 | private string m_thisHostname = "127.0.0.1"; | ||
114 | private uint m_thisPort = 9000; | ||
115 | |||
116 | public bool DoLookup | ||
117 | { | ||
118 | get { return m_doLookup; } | ||
119 | set { m_doLookup = value; } | ||
120 | } | ||
121 | |||
122 | public InventoryService(Scene _m_scene) | ||
123 | { | ||
124 | m_scene = _m_scene; | ||
125 | m_inventoryService = (InventoryServiceBase)m_scene.CommsManager.SecureInventoryService; | ||
126 | m_userService = (UserManagerBase)m_scene.CommsManager.UserService; | ||
127 | m_thisInventoryUrl = m_scene.CommsManager.NetworkServersInfo.InventoryURL; | ||
128 | if (!m_thisInventoryUrl.EndsWith("/")) | ||
129 | m_thisInventoryUrl += "/"; | ||
130 | |||
131 | Uri uri = new Uri(m_thisInventoryUrl); | ||
132 | if (uri != null) | ||
133 | { | ||
134 | m_thisHostname = uri.Host; | ||
135 | m_thisPort = (uint)uri.Port; | ||
136 | } | ||
137 | |||
138 | m_assetProvider = ((AssetServerBase)m_scene.CommsManager.AssetCache.AssetServer).AssetProviderPlugin; | ||
139 | |||
140 | AddHttpHandlers(); | ||
141 | } | ||
142 | |||
143 | protected void AddHttpHandlers() | ||
144 | { | ||
145 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; | ||
146 | |||
147 | httpServer.AddHTTPHandler("/InvCap/", CapHandler); | ||
148 | |||
149 | httpServer.AddStreamHandler( | ||
150 | new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
151 | "POST", "/GetInventory/", GetUserInventory, CheckAuthSession)); | ||
152 | |||
153 | httpServer.AddStreamHandler( | ||
154 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
155 | "POST", "/NewFolder/", m_inventoryService.AddFolder, CheckAuthSession)); | ||
156 | |||
157 | httpServer.AddStreamHandler( | ||
158 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
159 | "POST", "/UpdateFolder/", m_inventoryService.UpdateFolder, CheckAuthSession)); | ||
160 | |||
161 | httpServer.AddStreamHandler( | ||
162 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
163 | "POST", "/MoveFolder/", m_inventoryService.MoveFolder, CheckAuthSession)); | ||
164 | |||
165 | httpServer.AddStreamHandler( | ||
166 | new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
167 | "POST", "/PurgeFolder/", m_inventoryService.PurgeFolder, CheckAuthSession)); | ||
168 | |||
169 | httpServer.AddStreamHandler( | ||
170 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
171 | "POST", "/NewItem/", m_inventoryService.AddItem, CheckAuthSession)); | ||
172 | |||
173 | httpServer.AddStreamHandler( | ||
174 | new RestDeserialiseSecureHandler<InventoryItemBase, bool>( | ||
175 | "POST", "/DeleteItem/", m_inventoryService.DeleteItem, CheckAuthSession)); | ||
176 | |||
177 | //// WARNING: Root folders no longer just delivers the root and immediate child folders (e.g | ||
178 | //// system folders such as Objects, Textures), but it now returns the entire inventory skeleton. | ||
179 | //// It would have been better to rename this request, but complexities in the BaseHttpServer | ||
180 | //// (e.g. any http request not found is automatically treated as an xmlrpc request) make it easier | ||
181 | //// to do this for now. | ||
182 | //m_scene.AddStreamHandler( | ||
183 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryFolderBase>> | ||
184 | // ("POST", "/RootFolders/", GetInventorySkeleton, CheckTrustSource)); | ||
185 | |||
186 | //// for persistent active gestures | ||
187 | //m_scene.AddStreamHandler( | ||
188 | // new RestDeserialiseTrustedHandler<Guid, List<InventoryItemBase>> | ||
189 | // ("POST", "/ActiveGestures/", GetActiveGestures, CheckTrustSource)); | ||
190 | } | ||
191 | |||
192 | |||
193 | ///// <summary> | ||
194 | ///// Check that the source of an inventory request is one that we trust. | ||
195 | ///// </summary> | ||
196 | ///// <param name="peer"></param> | ||
197 | ///// <returns></returns> | ||
198 | //public bool CheckTrustSource(IPEndPoint peer) | ||
199 | //{ | ||
200 | // if (m_doLookup) | ||
201 | // { | ||
202 | // m_log.InfoFormat("[GRID AGENT INVENTORY]: Checking trusted source {0}", peer); | ||
203 | // UriBuilder ub = new UriBuilder(m_userserver_url); | ||
204 | // IPAddress[] uaddrs = Dns.GetHostAddresses(ub.Host); | ||
205 | // foreach (IPAddress uaddr in uaddrs) | ||
206 | // { | ||
207 | // if (uaddr.Equals(peer.Address)) | ||
208 | // { | ||
209 | // return true; | ||
210 | // } | ||
211 | // } | ||
212 | |||
213 | // m_log.WarnFormat( | ||
214 | // "[GRID AGENT INVENTORY]: Rejecting request since source {0} was not in the list of trusted sources", | ||
215 | // peer); | ||
216 | |||
217 | // return false; | ||
218 | // } | ||
219 | // else | ||
220 | // { | ||
221 | // return true; | ||
222 | // } | ||
223 | //} | ||
224 | |||
225 | /// <summary> | ||
226 | /// Check that the source of an inventory request for a particular agent is a current session belonging to | ||
227 | /// that agent. | ||
228 | /// </summary> | ||
229 | /// <param name="session_id"></param> | ||
230 | /// <param name="avatar_id"></param> | ||
231 | /// <returns></returns> | ||
232 | public bool CheckAuthSession(string session_id, string avatar_id) | ||
233 | { | ||
234 | if (m_doLookup) | ||
235 | { | ||
236 | m_log.InfoFormat("[HGStandaloneInvService]: checking authed session {0} {1}", session_id, avatar_id); | ||
237 | UUID userID = UUID.Zero; | ||
238 | UUID sessionID = UUID.Zero; | ||
239 | UUID.TryParse(avatar_id, out userID); | ||
240 | UUID.TryParse(session_id, out sessionID); | ||
241 | if (userID.Equals(UUID.Zero) || sessionID.Equals(UUID.Zero)) | ||
242 | { | ||
243 | m_log.Info("[HGStandaloneInvService]: Invalid user or session id " + avatar_id + "; " + session_id); | ||
244 | return false; | ||
245 | } | ||
246 | UserProfileData userProfile = m_userService.GetUserProfile(userID); | ||
247 | if (userProfile != null && userProfile.CurrentAgent != null && | ||
248 | userProfile.CurrentAgent.SessionID == sessionID) | ||
249 | { | ||
250 | m_log.Info("[HGStandaloneInvService]: user is logged in and session is valid. Authorizing access."); | ||
251 | return true; | ||
252 | } | ||
253 | |||
254 | m_log.Warn("[HGStandaloneInvService]: unknown user or session_id, request rejected"); | ||
255 | return false; | ||
256 | } | ||
257 | else | ||
258 | { | ||
259 | return true; | ||
260 | } | ||
261 | } | ||
262 | |||
263 | // In truth, this is not called from the outside, for standalones. I'm just making it | ||
264 | // a handler already so that this can be reused for the InventoryServer. | ||
265 | public string CreateCapUrl(Guid _userid) | ||
266 | { | ||
267 | UUID userID = new UUID(_userid); | ||
268 | UUID random = UUID.Random(); | ||
269 | string url = m_thisInventoryUrl + random.ToString() + "/"; | ||
270 | m_log.InfoFormat("[HGStandaloneInvService] Creating Cap URL {0} for user {1}", url, userID.ToString()); | ||
271 | return url; | ||
272 | } | ||
273 | |||
274 | |||
275 | /// <summary> | ||
276 | /// Return a user's entire inventory | ||
277 | /// </summary> | ||
278 | /// <param name="rawUserID"></param> | ||
279 | /// <returns>The user's inventory. If an inventory cannot be found then an empty collection is returned.</returns> | ||
280 | public InventoryCollection GetUserInventory(Guid rawUserID) | ||
281 | { | ||
282 | UUID userID = new UUID(rawUserID); | ||
283 | |||
284 | m_log.Info("[HGStandaloneInvService]: Processing request for inventory of " + userID); | ||
285 | |||
286 | // Uncomment me to simulate a slow responding inventory server | ||
287 | //Thread.Sleep(16000); | ||
288 | |||
289 | InventoryCollection invCollection = new InventoryCollection(); | ||
290 | |||
291 | List<InventoryFolderBase> allFolders = ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | ||
292 | |||
293 | if (null == allFolders) | ||
294 | { | ||
295 | m_log.WarnFormat("[HGStandaloneInvService]: No inventory found for user {0}", rawUserID); | ||
296 | |||
297 | return invCollection; | ||
298 | } | ||
299 | |||
300 | List<InventoryItemBase> allItems = new List<InventoryItemBase>(); | ||
301 | |||
302 | foreach (InventoryFolderBase folder in allFolders) | ||
303 | { | ||
304 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(folder.ID); | ||
305 | |||
306 | if (items != null) | ||
307 | { | ||
308 | allItems.InsertRange(0, items); | ||
309 | } | ||
310 | } | ||
311 | |||
312 | invCollection.UserID = userID; | ||
313 | invCollection.Folders = allFolders; | ||
314 | invCollection.Items = allItems; | ||
315 | |||
316 | // foreach (InventoryFolderBase folder in invCollection.Folders) | ||
317 | // { | ||
318 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back folder {0} {1}", folder.Name, folder.ID); | ||
319 | // } | ||
320 | // | ||
321 | // foreach (InventoryItemBase item in invCollection.Items) | ||
322 | // { | ||
323 | // m_log.DebugFormat("[GRID AGENT INVENTORY]: Sending back item {0} {1}, folder {2}", item.Name, item.ID, item.Folder); | ||
324 | // } | ||
325 | |||
326 | m_log.InfoFormat( | ||
327 | "[HGStandaloneInvService]: Sending back inventory response to user {0} containing {1} folders and {2} items", | ||
328 | invCollection.UserID, invCollection.Folders.Count, invCollection.Items.Count); | ||
329 | |||
330 | return invCollection; | ||
331 | } | ||
332 | |||
333 | public InventoryCollection FetchDescendants(InventoryFolderBase fb) | ||
334 | { | ||
335 | m_log.Info("[HGStandaloneInvService]: Processing request for folder " + fb.ID); | ||
336 | |||
337 | // Uncomment me to simulate a slow responding inventory server | ||
338 | //Thread.Sleep(16000); | ||
339 | |||
340 | InventoryCollection invCollection = new InventoryCollection(); | ||
341 | |||
342 | List<InventoryItemBase> items = ((InventoryServiceBase)m_inventoryService).RequestFolderItems(fb.ID); | ||
343 | List<InventoryFolderBase> folders = ((InventoryServiceBase)m_inventoryService).RequestSubFolders(fb.ID); | ||
344 | |||
345 | invCollection.UserID = fb.Owner; | ||
346 | invCollection.Folders = folders; | ||
347 | invCollection.Items = items; | ||
348 | |||
349 | m_log.DebugFormat("[HGStandaloneInvService]: Found {0} items and {1} folders", items.Count, folders.Count); | ||
350 | |||
351 | return invCollection; | ||
352 | } | ||
353 | |||
354 | public bool RemoveFolder(InventoryFolderBase folder) | ||
355 | { | ||
356 | m_log.Debug("[HGStandaloneInvService]: Removefolder: Operation not implemented yet."); | ||
357 | return false; | ||
358 | } | ||
359 | |||
360 | public InventoryItemBase GetInventoryItem(InventoryItemBase item) | ||
361 | { | ||
362 | m_log.Info("[HGStandaloneInvService]: Get item " + item.ID); | ||
363 | |||
364 | item = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); | ||
365 | if (item == null) | ||
366 | m_log.Debug("[HGStandaloneInvService]: null item"); | ||
367 | return item; | ||
368 | } | ||
369 | |||
370 | public InventoryItemBase AddItem(InventoryItemBase item) | ||
371 | { | ||
372 | m_log.DebugFormat("[HGStandaloneInvService]: Add item {0} from {1}", item.ID, item.Owner); | ||
373 | if (m_inventoryService.AddItem(item)) | ||
374 | return item; | ||
375 | else | ||
376 | { | ||
377 | item.ID = UUID.Zero; | ||
378 | return item; | ||
379 | } | ||
380 | } | ||
381 | |||
382 | public InventoryItemBase UpdateItem(InventoryItemBase item) | ||
383 | { | ||
384 | m_log.DebugFormat("[HGStandaloneInvService]: Update item {0} from {1}", item.ID, item.Owner); | ||
385 | InventoryItemBase it = m_inventoryService.GetInventoryItem(item.ID); | ||
386 | item.CurrentPermissions = it.CurrentPermissions; | ||
387 | item.AssetID = it.AssetID; | ||
388 | if (m_inventoryService.UpdateItem(item)) | ||
389 | return item; | ||
390 | else | ||
391 | { | ||
392 | item.ID = UUID.Zero; | ||
393 | return item; | ||
394 | } | ||
395 | } | ||
396 | |||
397 | public InventoryItemBase MoveItem(InventoryItemBase newitem) | ||
398 | { | ||
399 | m_log.DebugFormat("[HGStandaloneInvService]: Move item {0} from {1}", newitem.ID, newitem.Owner); | ||
400 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(newitem.ID); | ||
401 | if (Item != null) | ||
402 | { | ||
403 | if (newitem.Name != String.Empty) | ||
404 | { | ||
405 | Item.Name = newitem.Name; | ||
406 | } | ||
407 | Item.Folder = newitem.Folder; | ||
408 | m_inventoryService.UpdateItem(Item); | ||
409 | return Item; | ||
410 | } | ||
411 | else | ||
412 | { | ||
413 | m_log.Debug("[HGStandaloneInvService]: Failed to find item " + newitem.ID); | ||
414 | newitem.ID = UUID.Zero; | ||
415 | return newitem; | ||
416 | } | ||
417 | |||
418 | } | ||
419 | |||
420 | public InventoryItemBase DeleteItem(InventoryItemBase item) | ||
421 | { | ||
422 | item = m_inventoryService.GetInventoryItem(item.ID); | ||
423 | if (m_inventoryService.DeleteItem(item)) | ||
424 | return item; | ||
425 | else | ||
426 | { | ||
427 | item.ID = UUID.Zero; | ||
428 | return item; | ||
429 | } | ||
430 | } | ||
431 | |||
432 | public InventoryItemBase CopyItem(InventoryItemBase olditem) | ||
433 | { | ||
434 | m_log.DebugFormat("[HGStandaloneInvService]: Copy item {0} from {1}", olditem.ID, olditem.Owner); | ||
435 | InventoryItemBase Item = m_inventoryService.GetInventoryItem(olditem.ID); // this is the old item id | ||
436 | // BIG HACK here | ||
437 | UUID newID = olditem.AssetID; | ||
438 | if (Item != null) | ||
439 | { | ||
440 | if (olditem.Name != String.Empty) | ||
441 | { | ||
442 | Item.Name = olditem.Name; | ||
443 | } | ||
444 | Item.ID = newID; | ||
445 | Item.Folder = olditem.Folder; | ||
446 | Item.Owner = olditem.Owner; | ||
447 | // There should be some tests here about the owner, etc but I'm going to ignore that | ||
448 | // because I'm not sure it makes any sense | ||
449 | // Also I should probably close the asset... | ||
450 | m_inventoryService.AddItem(Item); | ||
451 | return Item; | ||
452 | } | ||
453 | else | ||
454 | { | ||
455 | m_log.Debug("[HGStandaloneInvService]: Failed to find item " + olditem.ID); | ||
456 | olditem.ID = UUID.Zero; | ||
457 | return olditem; | ||
458 | } | ||
459 | |||
460 | } | ||
461 | |||
462 | /// <summary> | ||
463 | /// Guid to UUID wrapper for same name IInventoryServices method | ||
464 | /// </summary> | ||
465 | /// <param name="rawUserID"></param> | ||
466 | /// <returns></returns> | ||
467 | public List<InventoryFolderBase> GetInventorySkeleton(Guid rawUserID) | ||
468 | { | ||
469 | UUID userID = new UUID(rawUserID); | ||
470 | return ((InventoryServiceBase)m_inventoryService).GetInventorySkeleton(userID); | ||
471 | } | ||
472 | |||
473 | public List<InventoryItemBase> GetActiveGestures(Guid rawUserID) | ||
474 | { | ||
475 | UUID userID = new UUID(rawUserID); | ||
476 | |||
477 | m_log.InfoFormat("[HGStandaloneInvService]: fetching active gestures for user {0}", userID); | ||
478 | |||
479 | return ((InventoryServiceBase)m_inventoryService).GetActiveGestures(userID); | ||
480 | } | ||
481 | |||
482 | public AssetBase GetAsset(InventoryItemBase item) | ||
483 | { | ||
484 | m_log.Info("[HGStandaloneInvService]: Get asset " + item.AssetID + " for item " + item.ID); | ||
485 | AssetBase asset = new AssetBase(item.AssetID, "NULL"); // send an asset with no data | ||
486 | InventoryItemBase item2 = ((InventoryServiceBase)m_inventoryService).GetInventoryItem(item.ID); | ||
487 | if (item2 == null) | ||
488 | { | ||
489 | m_log.Debug("[HGStandaloneInvService]: null item"); | ||
490 | return asset; | ||
491 | } | ||
492 | if (item2.Owner != item.Owner) | ||
493 | { | ||
494 | m_log.DebugFormat("[HGStandaloneInvService]: client with uuid {0} is trying to get an item of owner {1}", item.Owner, item2.Owner); | ||
495 | return asset; | ||
496 | } | ||
497 | |||
498 | // All good, get the asset | ||
499 | AssetBase theasset = m_assetProvider.FetchAsset(item.AssetID); | ||
500 | m_log.Debug("[HGStandaloneInvService] Found asset " + ((theasset == null)? "NULL" : "Not Null")); | ||
501 | if (theasset != null) | ||
502 | { | ||
503 | asset = theasset; | ||
504 | //m_log.Debug(" >> Sending assetID " + item.AssetID); | ||
505 | } | ||
506 | return asset; | ||
507 | } | ||
508 | |||
509 | public bool PostAsset(AssetBase asset) | ||
510 | { | ||
511 | m_log.Info("[HGStandaloneInvService]: Post asset " + asset.FullID); | ||
512 | m_assetProvider.CreateAsset(asset); | ||
513 | |||
514 | return true; | ||
515 | } | ||
516 | |||
517 | /// <summary> | ||
518 | /// <see>CapsUpdatedInventoryItemAsset(IClientAPI, UUID, byte[])</see> | ||
519 | /// </summary> | ||
520 | public UUID UpdateInventoryItemAsset(UUID userID, UUID itemID, byte[] data) | ||
521 | { | ||
522 | m_log.Debug("[HGStandaloneInvService]: UpdateInventoryitemAsset for user " + userID + " item " + itemID); | ||
523 | InventoryItemBase item = m_inventoryService.GetInventoryItem(itemID); | ||
524 | |||
525 | if (item != null) | ||
526 | { | ||
527 | // We're still not dealing with permissions | ||
528 | //if ((InventoryType)item.InvType == InventoryType.Notecard) | ||
529 | //{ | ||
530 | // if (!Permissions.CanEditNotecard(itemID, UUID.Zero, userID)) | ||
531 | // { | ||
532 | // //remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
533 | // return UUID.Zero; | ||
534 | // } | ||
535 | |||
536 | // //remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
537 | //} | ||
538 | //else if ((InventoryType)item.InvType == InventoryType.LSL) | ||
539 | //{ | ||
540 | // if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | ||
541 | // { | ||
542 | // //remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | ||
543 | // return UUID.Zero; | ||
544 | // } | ||
545 | |||
546 | // //remoteClient.SendAgentAlertMessage("Script saved", false); | ||
547 | //} | ||
548 | |||
549 | AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); | ||
550 | PostAsset(asset); | ||
551 | |||
552 | item.AssetID = asset.FullID; | ||
553 | item.Owner = userID; | ||
554 | m_inventoryService.UpdateItem(item); | ||
555 | |||
556 | return (asset.FullID); | ||
557 | } | ||
558 | return UUID.Zero; | ||
559 | } | ||
560 | |||
561 | private AssetBase CreateAsset(string name, string description, sbyte assetType, byte[] data) | ||
562 | { | ||
563 | AssetBase asset = new AssetBase(); | ||
564 | asset.Name = name; | ||
565 | asset.Description = description; | ||
566 | asset.Type = assetType; | ||
567 | asset.FullID = UUID.Random(); | ||
568 | asset.Data = (data == null) ? new byte[1] : data; | ||
569 | |||
570 | return asset; | ||
571 | } | ||
572 | |||
573 | #region Caps | ||
574 | |||
575 | Dictionary<UUID, Hashtable> invCaps = new Dictionary<UUID, Hashtable>(); | ||
576 | |||
577 | public Hashtable CapHandler(Hashtable request) | ||
578 | { | ||
579 | m_log.Debug("[CONNECTION DEBUGGING]: InvCapHandler Called"); | ||
580 | |||
581 | m_log.Debug("---------------------------"); | ||
582 | m_log.Debug(" >> uri=" + request["uri"]); | ||
583 | m_log.Debug(" >> content-type=" + request["content-type"]); | ||
584 | m_log.Debug(" >> http-method=" + request["http-method"]); | ||
585 | m_log.Debug("---------------------------\n"); | ||
586 | |||
587 | // these are requests if the type | ||
588 | // http://inventoryserver/InvCap/uuuuuuuu-uuuu-uuuu-uuuu-uuuuuuuuuuuu/kkkkkkkk-kkkk-kkkk-kkkk-kkkkkkkkkkkk/ | ||
589 | |||
590 | Hashtable responsedata = new Hashtable(); | ||
591 | responsedata["content_type"] = "text/plain"; | ||
592 | |||
593 | UUID userID; | ||
594 | string authToken = string.Empty; | ||
595 | string authority = string.Empty; | ||
596 | if (!GetParams(request, out userID, out authority, out authToken)) | ||
597 | { | ||
598 | m_log.InfoFormat("[HGStandaloneInvService]: Invalid parameters for InvCap message {0}", request["uri"]); | ||
599 | responsedata["int_response_code"] = 404; | ||
600 | responsedata["str_response_string"] = "Not found"; | ||
601 | |||
602 | return responsedata; | ||
603 | } | ||
604 | |||
605 | // Next, let's parse the verb | ||
606 | string method = (string)request["http-method"]; | ||
607 | if (method.Equals("GET")) | ||
608 | { | ||
609 | DoInvCapPost(request, responsedata, userID, authToken); | ||
610 | return responsedata; | ||
611 | } | ||
612 | //else if (method.Equals("DELETE")) | ||
613 | //{ | ||
614 | // DoAgentDelete(request, responsedata, agentID, action, regionHandle); | ||
615 | |||
616 | // return responsedata; | ||
617 | //} | ||
618 | else | ||
619 | { | ||
620 | m_log.InfoFormat("[HGStandaloneInvService]: method {0} not supported in agent message", method); | ||
621 | responsedata["int_response_code"] = 405; | ||
622 | responsedata["str_response_string"] = "Method not allowed"; | ||
623 | |||
624 | return responsedata; | ||
625 | } | ||
626 | |||
627 | } | ||
628 | |||
629 | public virtual void DoInvCapPost(Hashtable request, Hashtable responsedata, UUID userID, string authToken) | ||
630 | { | ||
631 | |||
632 | // This is the meaning of POST agent | ||
633 | |||
634 | // Check Auth Token | ||
635 | if (!(m_userService is IAuthentication)) | ||
636 | { | ||
637 | m_log.Debug("[HGStandaloneInvService]: UserService is not IAuthentication. Denying access to inventory."); | ||
638 | responsedata["int_response_code"] = 501; | ||
639 | responsedata["str_response_string"] = "Not implemented"; | ||
640 | return; | ||
641 | } | ||
642 | |||
643 | bool success = ((IAuthentication)m_userService).VerifyKey(userID, authToken); | ||
644 | |||
645 | if (success) | ||
646 | { | ||
647 | |||
648 | m_log.DebugFormat("[HGStandaloneInvService]: User has been authorized. Creating service handlers."); | ||
649 | |||
650 | // Then establish secret service handlers | ||
651 | |||
652 | Hashtable usercaps = RegisterCaps(userID, authToken); | ||
653 | |||
654 | responsedata["int_response_code"] = 200; | ||
655 | //responsedata["str_response_string"] = "OK"; | ||
656 | responsedata["str_response_string"] = SerializeHashtable(usercaps); | ||
657 | } | ||
658 | else | ||
659 | { | ||
660 | m_log.DebugFormat("[HGStandaloneInvService]: User has is unauthorized. Denying service handlers."); | ||
661 | responsedata["int_response_code"] = 403; | ||
662 | responsedata["str_response_string"] = "Forbidden"; | ||
663 | } | ||
664 | } | ||
665 | |||
666 | |||
667 | /// <summary> | ||
668 | /// Extract the params from a request. | ||
669 | /// </summary> | ||
670 | public static bool GetParams(Hashtable request, out UUID uuid, out string authority, out string authKey) | ||
671 | { | ||
672 | uuid = UUID.Zero; | ||
673 | authority = string.Empty; | ||
674 | authKey = string.Empty; | ||
675 | |||
676 | string uri = (string)request["uri"]; | ||
677 | uri = uri.Trim(new char[] { '/' }); | ||
678 | string[] parts = uri.Split('/'); | ||
679 | if (parts.Length <= 1) | ||
680 | { | ||
681 | return false; | ||
682 | } | ||
683 | else | ||
684 | { | ||
685 | if (!UUID.TryParse(parts[1], out uuid)) | ||
686 | return false; | ||
687 | |||
688 | if (parts.Length >= 3) | ||
689 | { | ||
690 | authKey = parts[2]; | ||
691 | return true; | ||
692 | } | ||
693 | } | ||
694 | |||
695 | Uri authUri; | ||
696 | Hashtable headers = (Hashtable)request["headers"]; | ||
697 | |||
698 | // Authorization keys look like this: | ||
699 | // http://orgrid.org:8002/<uuid> | ||
700 | if (headers.ContainsKey("authorization")) | ||
701 | { | ||
702 | if (Uri.TryCreate((string)headers["authorization"], UriKind.Absolute, out authUri)) | ||
703 | { | ||
704 | authority = authUri.Authority; | ||
705 | authKey = authUri.PathAndQuery.Trim('/'); | ||
706 | m_log.DebugFormat("[HGStandaloneInvService]: Got authority {0} and key {1}", authority, authKey); | ||
707 | return true; | ||
708 | } | ||
709 | else | ||
710 | m_log.Debug("[HGStandaloneInvService]: Wrong format for Authorization header: " + (string)headers["authorization"]); | ||
711 | } | ||
712 | else | ||
713 | m_log.Debug("[HGStandaloneInvService]: Authorization header not found"); | ||
714 | |||
715 | return false; | ||
716 | } | ||
717 | |||
718 | string SerializeHashtable(Hashtable hash) | ||
719 | { | ||
720 | string result = string.Empty; | ||
721 | foreach (object key in hash.Keys) | ||
722 | { | ||
723 | result += key.ToString() + "," + hash[key].ToString() + ";"; | ||
724 | } | ||
725 | return result; | ||
726 | } | ||
727 | |||
728 | Hashtable RegisterCaps(UUID userID, string authToken) | ||
729 | { | ||
730 | IHttpServer httpServer = m_scene.CommsManager.HttpServer; | ||
731 | |||
732 | lock (invCaps) | ||
733 | { | ||
734 | if (invCaps.ContainsKey(userID)) | ||
735 | { | ||
736 | // Remove the old ones | ||
737 | DeregisterCaps(httpServer, invCaps[userID]); | ||
738 | invCaps.Remove(userID); | ||
739 | } | ||
740 | } | ||
741 | |||
742 | Caps caps = new Caps(null, httpServer, m_thisHostname, m_thisPort, authToken, userID, false, "Inventory"); | ||
743 | caps.RegisterInventoryServiceHandlers("/" + authToken + "/InventoryCap/"); | ||
744 | caps.ItemUpdatedCall = UpdateInventoryItemAsset; | ||
745 | Hashtable capsHandlers = caps.CapsHandlers.CapsDetails; | ||
746 | |||
747 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<Guid, InventoryCollection>( | ||
748 | "POST", AddAndGetCapUrl(authToken, "GetInventory", capsHandlers), GetUserInventory, CheckAuthSession)); | ||
749 | |||
750 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryCollection>( | ||
751 | "POST", AddAndGetCapUrl(authToken, "FetchDescendants", capsHandlers), FetchDescendants, CheckAuthSession)); | ||
752 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
753 | "POST", AddAndGetCapUrl(authToken, "NewFolder", capsHandlers), m_inventoryService.AddFolder, CheckAuthSession)); | ||
754 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
755 | "POST", AddAndGetCapUrl(authToken, "UpdateFolder", capsHandlers), m_inventoryService.UpdateFolder, CheckAuthSession)); | ||
756 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
757 | "POST", AddAndGetCapUrl(authToken, "MoveFolder", capsHandlers), m_inventoryService.MoveFolder, CheckAuthSession)); | ||
758 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
759 | "POST", AddAndGetCapUrl(authToken, "PurgeFolder", capsHandlers), m_inventoryService.PurgeFolder, CheckAuthSession)); | ||
760 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryFolderBase, bool>( | ||
761 | "POST", AddAndGetCapUrl(authToken, "RemoveFolder", capsHandlers), RemoveFolder, CheckAuthSession)); | ||
762 | |||
763 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
764 | "POST", AddAndGetCapUrl(authToken, "GetItem", capsHandlers), GetInventoryItem, CheckAuthSession)); | ||
765 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
766 | "POST", AddAndGetCapUrl(authToken, "NewItem", capsHandlers), AddItem, CheckAuthSession)); | ||
767 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
768 | "POST", AddAndGetCapUrl(authToken, "UpdateItem", capsHandlers), UpdateItem, CheckAuthSession)); | ||
769 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
770 | "POST", AddAndGetCapUrl(authToken, "MoveItem", capsHandlers), MoveItem, CheckAuthSession)); | ||
771 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
772 | "POST", AddAndGetCapUrl(authToken, "DeleteItem", capsHandlers), DeleteItem, CheckAuthSession)); | ||
773 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( | ||
774 | "POST", AddAndGetCapUrl(authToken, "CopyItem", capsHandlers), CopyItem, CheckAuthSession)); | ||
775 | |||
776 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<InventoryItemBase, AssetBase>( | ||
777 | "POST", AddAndGetCapUrl(authToken, "GetAsset", capsHandlers), GetAsset, CheckAuthSession)); | ||
778 | httpServer.AddStreamHandler(new RestDeserialiseSecureHandler<AssetBase, bool>( | ||
779 | "POST", AddAndGetCapUrl(authToken, "PostAsset", capsHandlers), PostAsset, CheckAuthSession)); | ||
780 | |||
781 | lock (invCaps) | ||
782 | invCaps.Add(userID, capsHandlers); | ||
783 | |||
784 | return capsHandlers; | ||
785 | } | ||
786 | |||
787 | string AddAndGetCapUrl(string authToken, string capType, Hashtable caps) | ||
788 | { | ||
789 | string capUrl = "/" + authToken + "/" + capType + "/"; | ||
790 | |||
791 | m_log.Debug("[HGStandaloneInvService] Adding inventory cap " + capUrl); | ||
792 | caps.Add(capType, capUrl); | ||
793 | return capUrl; | ||
794 | } | ||
795 | |||
796 | void DeregisterCaps(IHttpServer httpServer, Hashtable caps) | ||
797 | { | ||
798 | foreach (string capUrl in caps.Values) | ||
799 | { | ||
800 | m_log.Debug("[HGStandaloneInvService] Removing inventory cap " + capUrl); | ||
801 | httpServer.RemoveStreamHandler("POST", capUrl); | ||
802 | } | ||
803 | } | ||
804 | |||
805 | #endregion Caps | ||
806 | } | ||
807 | } | ||
diff --git a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs index 3f4d875..9e134be 100644 --- a/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs +++ b/OpenSim/Region/CoreModules/Hypergrid/HGStandaloneLoginModule.cs | |||
@@ -36,6 +36,7 @@ using Nini.Config; | |||
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Framework.Communications; | 38 | using OpenSim.Framework.Communications; |
39 | using OpenSim.Framework.Communications.Services; | ||
39 | using OpenSim.Framework.Communications.Cache; | 40 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Framework.Communications.Capabilities; | 41 | using OpenSim.Framework.Communications.Capabilities; |
41 | using OpenSim.Framework.Servers.Interfaces; | 42 | using OpenSim.Framework.Servers.Interfaces; |