diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | 279 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs (renamed from OpenSim/Framework/Communications/Tests/UserProfileCacheServiceTests.cs) | 0 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | 286 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 14 |
4 files changed, 291 insertions, 288 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs index 46df2b7..958ef4e 100644 --- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs +++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs | |||
@@ -185,289 +185,10 @@ namespace OpenSim.Framework.Communications.Cache | |||
185 | } | 185 | } |
186 | else | 186 | else |
187 | { | 187 | { |
188 | |||
189 | CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userData); | 188 | CachedUserInfo userInfo = new CachedUserInfo(m_commsManager, userData); |
190 | m_userProfiles.Add(userID, userInfo); | 189 | m_userProfiles.Add(userID, userInfo); |
191 | } | 190 | } |
192 | } | 191 | } |
193 | } | 192 | } |
194 | |||
195 | /// <summary> | ||
196 | /// Handle an inventory folder creation request from the client. | ||
197 | /// </summary> | ||
198 | /// <param name="remoteClient"></param> | ||
199 | /// <param name="folderID"></param> | ||
200 | /// <param name="folderType"></param> | ||
201 | /// <param name="folderName"></param> | ||
202 | /// <param name="parentID"></param> | ||
203 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, | ||
204 | string folderName, UUID parentID) | ||
205 | { | ||
206 | CachedUserInfo userProfile; | ||
207 | |||
208 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
209 | { | ||
210 | if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) | ||
211 | { | ||
212 | m_log.ErrorFormat( | ||
213 | "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", | ||
214 | remoteClient.Name, remoteClient.AgentId); | ||
215 | } | ||
216 | } | ||
217 | else | ||
218 | { | ||
219 | m_log.ErrorFormat( | ||
220 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
221 | remoteClient.Name, remoteClient.AgentId); | ||
222 | } | ||
223 | } | ||
224 | |||
225 | /// <summary> | ||
226 | /// Handle a client request to update the inventory folder | ||
227 | /// </summary> | ||
228 | /// | ||
229 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE | ||
230 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, | ||
231 | /// and needs to be changed. | ||
232 | /// | ||
233 | /// <param name="remoteClient"></param> | ||
234 | /// <param name="folderID"></param> | ||
235 | /// <param name="type"></param> | ||
236 | /// <param name="name"></param> | ||
237 | /// <param name="parentID"></param> | ||
238 | public void HandleUpdateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort type, string name, | ||
239 | UUID parentID) | ||
240 | { | ||
241 | // m_log.DebugFormat( | ||
242 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | ||
243 | |||
244 | CachedUserInfo userProfile; | ||
245 | |||
246 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
247 | { | ||
248 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) | ||
249 | { | ||
250 | m_log.ErrorFormat( | ||
251 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | ||
252 | remoteClient.Name, remoteClient.AgentId); | ||
253 | } | ||
254 | } | ||
255 | else | ||
256 | { | ||
257 | m_log.ErrorFormat( | ||
258 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
259 | remoteClient.Name, remoteClient.AgentId); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | /// <summary> | ||
264 | /// Handle an inventory folder move request from the client. | ||
265 | /// </summary> | ||
266 | /// <param name="remoteClient"></param> | ||
267 | /// <param name="folderID"></param> | ||
268 | /// <param name="parentID"></param> | ||
269 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | ||
270 | { | ||
271 | CachedUserInfo userProfile; | ||
272 | |||
273 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
274 | { | ||
275 | if (!userProfile.MoveFolder(folderID, parentID)) | ||
276 | { | ||
277 | m_log.ErrorFormat( | ||
278 | "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", | ||
279 | folderID, parentID, remoteClient.Name); | ||
280 | } | ||
281 | } | ||
282 | else | ||
283 | { | ||
284 | m_log.ErrorFormat( | ||
285 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
286 | remoteClient.Name, remoteClient.AgentId); | ||
287 | } | ||
288 | } | ||
289 | |||
290 | /// <summary> | ||
291 | /// Tell the client about the various child items and folders contained in the requested folder. | ||
292 | /// </summary> | ||
293 | /// <param name="remoteClient"></param> | ||
294 | /// <param name="folderID"></param> | ||
295 | /// <param name="ownerID"></param> | ||
296 | /// <param name="fetchFolders"></param> | ||
297 | /// <param name="fetchItems"></param> | ||
298 | /// <param name="sortOrder"></param> | ||
299 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, | ||
300 | bool fetchFolders, bool fetchItems, int sortOrder) | ||
301 | { | ||
302 | // FIXME MAYBE: We're not handling sortOrder! | ||
303 | |||
304 | InventoryFolderImpl fold = null; | ||
305 | if ((fold = LibraryRoot.FindFolder(folderID)) != null) | ||
306 | { | ||
307 | remoteClient.SendInventoryFolderDetails( | ||
308 | LibraryRoot.Owner, folderID, fold.RequestListOfItems(), | ||
309 | fold.RequestListOfFolders(), fetchFolders, fetchItems); | ||
310 | |||
311 | return; | ||
312 | } | ||
313 | |||
314 | CachedUserInfo userProfile; | ||
315 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
316 | { | ||
317 | userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems); | ||
318 | } | ||
319 | else | ||
320 | { | ||
321 | m_log.ErrorFormat( | ||
322 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
323 | remoteClient.Name, remoteClient.AgentId); | ||
324 | } | ||
325 | } | ||
326 | |||
327 | /// <summary> | ||
328 | /// Handle the caps inventory descendents fetch. | ||
329 | /// | ||
330 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. | ||
331 | /// </summary> | ||
332 | /// <param name="agentID"></param> | ||
333 | /// <param name="folderID"></param> | ||
334 | /// <param name="ownerID"></param> | ||
335 | /// <param name="fetchFolders"></param> | ||
336 | /// <param name="fetchItems"></param> | ||
337 | /// <param name="sortOrder"></param> | ||
338 | /// <returns>null if the inventory look up failed</returns> | ||
339 | public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | ||
340 | bool fetchFolders, bool fetchItems, int sortOrder) | ||
341 | { | ||
342 | // m_log.DebugFormat( | ||
343 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | ||
344 | // fetchFolders, fetchItems, folderID, agentID); | ||
345 | |||
346 | // FIXME MAYBE: We're not handling sortOrder! | ||
347 | |||
348 | InventoryFolderImpl fold; | ||
349 | if ((fold = LibraryRoot.FindFolder(folderID)) != null) | ||
350 | { | ||
351 | return fold.RequestListOfItems(); | ||
352 | } | ||
353 | |||
354 | CachedUserInfo userProfile; | ||
355 | if (m_userProfiles.TryGetValue(agentID, out userProfile)) | ||
356 | { | ||
357 | // XXX: When a client crosses into a scene, their entire inventory is fetched | ||
358 | // asynchronously. If the client makes a request before the inventory is received, we need | ||
359 | // to give the inventory a chance to come in. | ||
360 | // | ||
361 | // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad | ||
362 | // in CAPS as doing this with the udp request, since here it won't hold up other packets. | ||
363 | // In fact, here we'll be generous and try for longer. | ||
364 | if (!userProfile.HasReceivedInventory) | ||
365 | { | ||
366 | int attempts = 0; | ||
367 | while (attempts++ < 30) | ||
368 | { | ||
369 | m_log.DebugFormat( | ||
370 | "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", | ||
371 | attempts, folderID, agentID); | ||
372 | |||
373 | Thread.Sleep(2000); | ||
374 | |||
375 | if (userProfile.HasReceivedInventory) | ||
376 | { | ||
377 | break; | ||
378 | } | ||
379 | } | ||
380 | } | ||
381 | |||
382 | if (userProfile.HasReceivedInventory) | ||
383 | { | ||
384 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
385 | { | ||
386 | return fold.RequestListOfItems(); | ||
387 | } | ||
388 | else | ||
389 | { | ||
390 | m_log.WarnFormat( | ||
391 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", | ||
392 | folderID, agentID); | ||
393 | |||
394 | return null; | ||
395 | } | ||
396 | } | ||
397 | else | ||
398 | { | ||
399 | m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID); | ||
400 | |||
401 | return null; | ||
402 | } | ||
403 | } | ||
404 | else | ||
405 | { | ||
406 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); | ||
407 | |||
408 | return null; | ||
409 | } | ||
410 | } | ||
411 | |||
412 | /// <summary> | ||
413 | /// This should delete all the items and folders in the given directory. | ||
414 | /// </summary> | ||
415 | /// <param name="remoteClient"></param> | ||
416 | /// <param name="folderID"></param> | ||
417 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | ||
418 | { | ||
419 | CachedUserInfo userProfile; | ||
420 | |||
421 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
422 | { | ||
423 | if (!userProfile.PurgeFolder(folderID)) | ||
424 | { | ||
425 | m_log.ErrorFormat( | ||
426 | "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", | ||
427 | remoteClient.Name, remoteClient.AgentId); | ||
428 | } | ||
429 | } | ||
430 | else | ||
431 | { | ||
432 | m_log.ErrorFormat( | ||
433 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
434 | remoteClient.Name, remoteClient.AgentId); | ||
435 | } | ||
436 | } | ||
437 | |||
438 | public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) | ||
439 | { | ||
440 | if (ownerID == LibraryRoot.Owner) | ||
441 | { | ||
442 | //Console.WriteLine("request info for library item"); | ||
443 | |||
444 | return; | ||
445 | } | ||
446 | |||
447 | CachedUserInfo userProfile; | ||
448 | if (m_userProfiles.TryGetValue(remoteClient.AgentId, out userProfile)) | ||
449 | { | ||
450 | if (userProfile.HasReceivedInventory) | ||
451 | { | ||
452 | InventoryItemBase item = null; | ||
453 | if ( userProfile.RootFolder == null ) | ||
454 | m_log.ErrorFormat( | ||
455 | "[AGENT INVENTORY]: User {0} {1} does not have a root folder.", | ||
456 | remoteClient.Name, remoteClient.AgentId); | ||
457 | else | ||
458 | item = userProfile.RootFolder.FindItem(itemID); | ||
459 | if (item != null) | ||
460 | { | ||
461 | remoteClient.SendInventoryItemDetails(ownerID, item); | ||
462 | } | ||
463 | } | ||
464 | } | ||
465 | else | ||
466 | { | ||
467 | m_log.ErrorFormat( | ||
468 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
469 | remoteClient.Name, remoteClient.AgentId); | ||
470 | } | ||
471 | } | ||
472 | } | 193 | } |
473 | } | 194 | } |
diff --git a/OpenSim/Framework/Communications/Tests/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs index 0d239aa..0d239aa 100644 --- a/OpenSim/Framework/Communications/Tests/UserProfileCacheServiceTests.cs +++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs | |||
diff --git a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs index 8d12a94..3334e81 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.PacketHandlers.cs | |||
@@ -26,9 +26,12 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.Collections.Generic; | 28 | using System.Collections.Generic; |
29 | using System.Threading; | ||
29 | using OpenMetaverse; | 30 | using OpenMetaverse; |
30 | using OpenMetaverse.Packets; | 31 | using OpenMetaverse.Packets; |
31 | using OpenSim.Framework; | 32 | using OpenSim.Framework; |
33 | using OpenSim.Framework.Communications; | ||
34 | using OpenSim.Framework.Communications.Cache; | ||
32 | 35 | ||
33 | namespace OpenSim.Region.Environment.Scenes | 36 | namespace OpenSim.Region.Environment.Scenes |
34 | { | 37 | { |
@@ -214,7 +217,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
214 | 217 | ||
215 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) | 218 | public virtual void ProcessObjectGrab(uint localID, Vector3 offsetPos, IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) |
216 | { | 219 | { |
217 | |||
218 | List<EntityBase> EntityList = GetEntities(); | 220 | List<EntityBase> EntityList = GetEntities(); |
219 | 221 | ||
220 | SurfaceTouchEventArgs surfaceArg = null; | 222 | SurfaceTouchEventArgs surfaceArg = null; |
@@ -253,7 +255,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
253 | 255 | ||
254 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) | 256 | public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient) |
255 | { | 257 | { |
256 | |||
257 | List<EntityBase> EntityList = GetEntities(); | 258 | List<EntityBase> EntityList = GetEntities(); |
258 | 259 | ||
259 | foreach (EntityBase ent in EntityList) | 260 | foreach (EntityBase ent in EntityList) |
@@ -346,5 +347,286 @@ namespace OpenSim.Region.Environment.Scenes | |||
346 | EventManager.TriggerScriptReset(part.LocalId, itemID); | 347 | EventManager.TriggerScriptReset(part.LocalId, itemID); |
347 | } | 348 | } |
348 | } | 349 | } |
350 | |||
351 | /// <summary> | ||
352 | /// Handle a fetch inventory request from the client | ||
353 | /// </summary> | ||
354 | /// <param name="remoteClient"></param> | ||
355 | /// <param name="itemID"></param> | ||
356 | /// <param name="ownerID"></param> | ||
357 | public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID) | ||
358 | { | ||
359 | if (ownerID == CommsManager.UserProfileCacheService.LibraryRoot.Owner) | ||
360 | { | ||
361 | //Console.WriteLine("request info for library item"); | ||
362 | return; | ||
363 | } | ||
364 | |||
365 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
366 | |||
367 | if (null == userProfile) | ||
368 | { | ||
369 | m_log.ErrorFormat( | ||
370 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
371 | remoteClient.Name, remoteClient.AgentId); | ||
372 | return; | ||
373 | } | ||
374 | |||
375 | if (userProfile.HasReceivedInventory) | ||
376 | { | ||
377 | InventoryItemBase item = null; | ||
378 | if (userProfile.RootFolder == null) | ||
379 | m_log.ErrorFormat( | ||
380 | "[AGENT INVENTORY]: User {0} {1} does not have a root folder.", | ||
381 | remoteClient.Name, remoteClient.AgentId); | ||
382 | else | ||
383 | item = userProfile.RootFolder.FindItem(itemID); | ||
384 | |||
385 | if (item != null) | ||
386 | { | ||
387 | remoteClient.SendInventoryItemDetails(ownerID, item); | ||
388 | } | ||
389 | } | ||
390 | } | ||
391 | |||
392 | /// <summary> | ||
393 | /// Tell the client about the various child items and folders contained in the requested folder. | ||
394 | /// </summary> | ||
395 | /// <param name="remoteClient"></param> | ||
396 | /// <param name="folderID"></param> | ||
397 | /// <param name="ownerID"></param> | ||
398 | /// <param name="fetchFolders"></param> | ||
399 | /// <param name="fetchItems"></param> | ||
400 | /// <param name="sortOrder"></param> | ||
401 | public void HandleFetchInventoryDescendents(IClientAPI remoteClient, UUID folderID, UUID ownerID, | ||
402 | bool fetchFolders, bool fetchItems, int sortOrder) | ||
403 | { | ||
404 | // FIXME MAYBE: We're not handling sortOrder! | ||
405 | |||
406 | // TODO: This code for looking in the folder for the library should be folded back into the | ||
407 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. | ||
408 | // can be handled transparently). | ||
409 | InventoryFolderImpl fold = null; | ||
410 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | ||
411 | { | ||
412 | remoteClient.SendInventoryFolderDetails( | ||
413 | fold.Owner, folderID, fold.RequestListOfItems(), | ||
414 | fold.RequestListOfFolders(), fetchFolders, fetchItems); | ||
415 | return; | ||
416 | } | ||
417 | |||
418 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
419 | |||
420 | if (null == userProfile) | ||
421 | { | ||
422 | m_log.ErrorFormat( | ||
423 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
424 | remoteClient.Name, remoteClient.AgentId); | ||
425 | return; | ||
426 | } | ||
427 | |||
428 | userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems); | ||
429 | } | ||
430 | |||
431 | /// <summary> | ||
432 | /// Handle the caps inventory descendents fetch. | ||
433 | /// | ||
434 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. | ||
435 | /// </summary> | ||
436 | /// <param name="agentID"></param> | ||
437 | /// <param name="folderID"></param> | ||
438 | /// <param name="ownerID"></param> | ||
439 | /// <param name="fetchFolders"></param> | ||
440 | /// <param name="fetchItems"></param> | ||
441 | /// <param name="sortOrder"></param> | ||
442 | /// <returns>null if the inventory look up failed</returns> | ||
443 | public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | ||
444 | bool fetchFolders, bool fetchItems, int sortOrder) | ||
445 | { | ||
446 | // m_log.DebugFormat( | ||
447 | // "[INVENTORY CACHE]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | ||
448 | // fetchFolders, fetchItems, folderID, agentID); | ||
449 | |||
450 | // FIXME MAYBE: We're not handling sortOrder! | ||
451 | |||
452 | // TODO: This code for looking in the folder for the library should be folded back into the | ||
453 | // CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc. | ||
454 | // can be handled transparently). | ||
455 | InventoryFolderImpl fold; | ||
456 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | ||
457 | { | ||
458 | return fold.RequestListOfItems(); | ||
459 | } | ||
460 | |||
461 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
462 | |||
463 | if (null == userProfile) | ||
464 | { | ||
465 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); | ||
466 | return null; | ||
467 | } | ||
468 | |||
469 | // XXX: When a client crosses into a scene, their entire inventory is fetched | ||
470 | // asynchronously. If the client makes a request before the inventory is received, we need | ||
471 | // to give the inventory a chance to come in. | ||
472 | // | ||
473 | // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad | ||
474 | // in CAPS as doing this with the udp request, since here it won't hold up other packets. | ||
475 | // In fact, here we'll be generous and try for longer. | ||
476 | if (!userProfile.HasReceivedInventory) | ||
477 | { | ||
478 | int attempts = 0; | ||
479 | while (attempts++ < 30) | ||
480 | { | ||
481 | m_log.DebugFormat( | ||
482 | "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", | ||
483 | attempts, folderID, agentID); | ||
484 | |||
485 | Thread.Sleep(2000); | ||
486 | |||
487 | if (userProfile.HasReceivedInventory) | ||
488 | { | ||
489 | break; | ||
490 | } | ||
491 | } | ||
492 | } | ||
493 | |||
494 | if (userProfile.HasReceivedInventory) | ||
495 | { | ||
496 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
497 | { | ||
498 | return fold.RequestListOfItems(); | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | m_log.WarnFormat( | ||
503 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", | ||
504 | folderID, agentID); | ||
505 | return null; | ||
506 | } | ||
507 | } | ||
508 | else | ||
509 | { | ||
510 | m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID); | ||
511 | return null; | ||
512 | } | ||
513 | } | ||
514 | |||
515 | /// <summary> | ||
516 | /// Handle an inventory folder creation request from the client. | ||
517 | /// </summary> | ||
518 | /// <param name="remoteClient"></param> | ||
519 | /// <param name="folderID"></param> | ||
520 | /// <param name="folderType"></param> | ||
521 | /// <param name="folderName"></param> | ||
522 | /// <param name="parentID"></param> | ||
523 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, | ||
524 | string folderName, UUID parentID) | ||
525 | { | ||
526 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
527 | |||
528 | if (null == userProfile) | ||
529 | { | ||
530 | m_log.ErrorFormat( | ||
531 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
532 | remoteClient.Name, remoteClient.AgentId); | ||
533 | return; | ||
534 | } | ||
535 | |||
536 | if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) | ||
537 | { | ||
538 | m_log.ErrorFormat( | ||
539 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", | ||
540 | remoteClient.Name, remoteClient.AgentId); | ||
541 | } | ||
542 | } | ||
543 | |||
544 | /// <summary> | ||
545 | /// Handle a client request to update the inventory folder | ||
546 | /// </summary> | ||
547 | /// | ||
548 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE | ||
549 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, | ||
550 | /// and needs to be changed. | ||
551 | /// | ||
552 | /// <param name="remoteClient"></param> | ||
553 | /// <param name="folderID"></param> | ||
554 | /// <param name="type"></param> | ||
555 | /// <param name="name"></param> | ||
556 | /// <param name="parentID"></param> | ||
557 | public void HandleUpdateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort type, string name, | ||
558 | UUID parentID) | ||
559 | { | ||
560 | // m_log.DebugFormat( | ||
561 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | ||
562 | |||
563 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
564 | |||
565 | if (null == userProfile) | ||
566 | { | ||
567 | m_log.ErrorFormat( | ||
568 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
569 | remoteClient.Name, remoteClient.AgentId); | ||
570 | return; | ||
571 | } | ||
572 | |||
573 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) | ||
574 | { | ||
575 | m_log.ErrorFormat( | ||
576 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | ||
577 | remoteClient.Name, remoteClient.AgentId); | ||
578 | } | ||
579 | } | ||
580 | |||
581 | /// <summary> | ||
582 | /// Handle an inventory folder move request from the client. | ||
583 | /// </summary> | ||
584 | /// <param name="remoteClient"></param> | ||
585 | /// <param name="folderID"></param> | ||
586 | /// <param name="parentID"></param> | ||
587 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | ||
588 | { | ||
589 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
590 | |||
591 | if (null == userProfile) | ||
592 | { | ||
593 | m_log.ErrorFormat( | ||
594 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
595 | remoteClient.Name, remoteClient.AgentId); | ||
596 | return; | ||
597 | } | ||
598 | |||
599 | if (!userProfile.MoveFolder(folderID, parentID)) | ||
600 | { | ||
601 | m_log.ErrorFormat( | ||
602 | "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", | ||
603 | folderID, parentID, remoteClient.Name); | ||
604 | } | ||
605 | } | ||
606 | |||
607 | /// <summary> | ||
608 | /// This should delete all the items and folders in the given directory. | ||
609 | /// </summary> | ||
610 | /// <param name="remoteClient"></param> | ||
611 | /// <param name="folderID"></param> | ||
612 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | ||
613 | { | ||
614 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
615 | |||
616 | if (null == userProfile) | ||
617 | { | ||
618 | m_log.ErrorFormat( | ||
619 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
620 | remoteClient.Name, remoteClient.AgentId); | ||
621 | return; | ||
622 | } | ||
623 | |||
624 | if (!userProfile.PurgeFolder(folderID)) | ||
625 | { | ||
626 | m_log.ErrorFormat( | ||
627 | "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", | ||
628 | remoteClient.Name, remoteClient.AgentId); | ||
629 | } | ||
630 | } | ||
349 | } | 631 | } |
350 | } | 632 | } |
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index bef79f8..4087471 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -2415,12 +2415,12 @@ namespace OpenSim.Region.Environment.Scenes | |||
2415 | client.OnGodKickUser += HandleGodlikeKickUser; | 2415 | client.OnGodKickUser += HandleGodlikeKickUser; |
2416 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; | 2416 | client.OnObjectPermissions += HandleObjectPermissionsUpdate; |
2417 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; | 2417 | client.OnCreateNewInventoryItem += CreateNewInventoryItem; |
2418 | client.OnCreateNewInventoryFolder += CommsManager.UserProfileCacheService.HandleCreateInventoryFolder; | 2418 | client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder; |
2419 | client.OnUpdateInventoryFolder += CommsManager.UserProfileCacheService.HandleUpdateInventoryFolder; | 2419 | client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder; |
2420 | client.OnMoveInventoryFolder += CommsManager.UserProfileCacheService.HandleMoveInventoryFolder; | 2420 | client.OnMoveInventoryFolder += HandleMoveInventoryFolder; |
2421 | client.OnFetchInventoryDescendents += CommsManager.UserProfileCacheService.HandleFetchInventoryDescendents; | 2421 | client.OnFetchInventoryDescendents += HandleFetchInventoryDescendents; |
2422 | client.OnPurgeInventoryDescendents += CommsManager.UserProfileCacheService.HandlePurgeInventoryDescendents; | 2422 | client.OnPurgeInventoryDescendents += HandlePurgeInventoryDescendents; |
2423 | client.OnFetchInventory += CommsManager.UserProfileCacheService.HandleFetchInventory; | 2423 | client.OnFetchInventory += HandleFetchInventory; |
2424 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; | 2424 | client.OnUpdateInventoryItem += UpdateInventoryItemAsset; |
2425 | client.OnCopyInventoryItem += CopyInventoryItem; | 2425 | client.OnCopyInventoryItem += CopyInventoryItem; |
2426 | client.OnMoveInventoryItem += MoveInventoryItem; | 2426 | client.OnMoveInventoryItem += MoveInventoryItem; |
@@ -2982,7 +2982,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
2982 | cap.AddNewInventoryItem = AddUploadedInventoryItem; | 2982 | cap.AddNewInventoryItem = AddUploadedInventoryItem; |
2983 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; | 2983 | cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; |
2984 | cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; | 2984 | cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; |
2985 | cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; | 2985 | cap.CAPSFetchInventoryDescendents = HandleFetchInventoryDescendentsCAPS; |
2986 | cap.GetClient = m_sceneGraph.GetControllingClient; | 2986 | cap.GetClient = m_sceneGraph.GetControllingClient; |
2987 | m_capsHandlers[agentId] = cap; | 2987 | m_capsHandlers[agentId] = cap; |
2988 | } | 2988 | } |