From 8a9677a5319793ff630d0761e204ae8961f375aa Mon Sep 17 00:00:00 2001
From: Diva Canto
Date: Fri, 1 Jan 2010 21:12:46 -0800
Subject: The Library Service is now working.
UserProfileCacheService.LibraryRoot is obsolete. Didn't delete it yet to
avoid merge conflicts later -- want to stay out of core as much as possible.
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 ++++----
.../Framework/Scenes/Scene.PacketHandlers.cs | 34 ++++++++++++----------
OpenSim/Region/Framework/Scenes/Scene.cs | 13 +++++++++
3 files changed, 38 insertions(+), 21 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 89ce4ae..f322af3 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -573,7 +573,9 @@ namespace OpenSim.Region.Framework.Scenes
"[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}",
remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName);
- InventoryItemBase item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(oldItemID);
+ InventoryItemBase item = null;
+ if (LibraryService != null && LibraryService.LibraryRootFolder != null)
+ item = LibraryService.LibraryRootFolder.FindItem(oldItemID);
if (item == null)
{
@@ -1211,9 +1213,9 @@ namespace OpenSim.Region.Framework.Scenes
item = InventoryService.GetItem(item);
// Try library
- if (null == item)
+ if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
{
- item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
+ item = LibraryService.LibraryRootFolder.FindItem(itemID);
}
if (item != null)
@@ -1280,9 +1282,9 @@ namespace OpenSim.Region.Framework.Scenes
// Try library
// XXX clumsy, possibly should be one call
- if (null == item)
+ if (null == item && LibraryService != null && LibraryService.LibraryRootFolder != null)
{
- item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
+ item = LibraryService.LibraryRootFolder.FindItem(itemID);
}
if (item != null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 47fbeb4..022d79d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void HandleFetchInventory(IClientAPI remoteClient, UUID itemID, UUID ownerID)
{
- if (ownerID == CommsManager.UserProfileCacheService.LibraryRoot.Owner)
+ if (LibraryService != null && LibraryService.LibraryRootFolder != null && ownerID == LibraryService.LibraryRootFolder.Owner)
{
//m_log.Debug("request info for library item");
return;
@@ -458,13 +458,14 @@ namespace OpenSim.Region.Framework.Scenes
// CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
// can be handled transparently).
InventoryFolderImpl fold = null;
- if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null)
- {
- remoteClient.SendInventoryFolderDetails(
- fold.Owner, folderID, fold.RequestListOfItems(),
- fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
- return;
- }
+ if (LibraryService != null && LibraryService.LibraryRootFolder != null)
+ if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
+ {
+ remoteClient.SendInventoryFolderDetails(
+ fold.Owner, folderID, fold.RequestListOfItems(),
+ fold.RequestListOfFolders(), fold.Version, fetchFolders, fetchItems);
+ return;
+ }
// We're going to send the reply async, because there may be
// an enormous quantity of packets -- basically the entire inventory!
@@ -512,15 +513,16 @@ namespace OpenSim.Region.Framework.Scenes
// CachedUserInfo so that this class doesn't have to know the details (and so that multiple libraries, etc.
// can be handled transparently).
InventoryFolderImpl fold;
- if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null)
- {
- version = 0;
- InventoryCollection ret = new InventoryCollection();
- ret.Folders = new List();
- ret.Items = fold.RequestListOfItems();
+ if (LibraryService != null && LibraryService.LibraryRootFolder != null)
+ if ((fold = LibraryService.LibraryRootFolder.FindFolder(folderID)) != null)
+ {
+ version = 0;
+ InventoryCollection ret = new InventoryCollection();
+ ret.Folders = new List();
+ ret.Items = fold.RequestListOfItems();
- return ret;
- }
+ return ret;
+ }
InventoryCollection contents = new InventoryCollection();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 418cfbf..ae189b5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -240,6 +240,19 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ protected ILibraryService m_LibraryService;
+
+ public ILibraryService LibraryService
+ {
+ get
+ {
+ if (m_LibraryService == null)
+ m_LibraryService = RequestModuleInterface();
+
+ return m_LibraryService;
+ }
+ }
+
protected IXMLRPC m_xmlrpcModule;
protected IWorldComm m_worldCommModule;
protected IAvatarFactory m_AvatarFactory;
--
cgit v1.1