From 76e74a7667867932ef08c0f402dcfc424fb51b0c Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Sun, 30 Dec 2007 19:40:44 +0000 Subject: Add an extra check that we don't create new inventory folders for a user that already has a root folder --- .../Communications/InventoryServiceBase.cs | 26 ++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework/Communications/InventoryServiceBase.cs') diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs index 098d08e..2f466a3 100644 --- a/OpenSim/Framework/Communications/InventoryServiceBase.cs +++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs @@ -112,8 +112,10 @@ namespace OpenSim.Framework.Communications } /// - /// + /// Get the root folder for a user /// + /// + /// null if no root folder was found public InventoryFolderBase RequestUsersRoot(LLUUID userID) { foreach (KeyValuePair plugin in m_plugins) @@ -204,11 +206,27 @@ namespace OpenSim.Framework.Communications } } + /// + /// Create a new set of inventory folders for the given user. + /// + /// public void CreateNewUserInventory(LLUUID user) { - UsersInventory inven = new UsersInventory(); - inven.CreateNewInventorySet(user); - AddNewInventorySet(inven); + InventoryFolderBase existingRootFolder = RequestUsersRoot(user); + + if (null != existingRootFolder) + { + MainLog.Instance.Error( + "AGENTINVENTORY", + "Did not create a new inventory for user {0} since they already have " + + "a root inventory folder with id {1}", user, existingRootFolder); + } + else + { + UsersInventory inven = new UsersInventory(); + inven.CreateNewInventorySet(user); + AddNewInventorySet(inven); + } } public class UsersInventory -- cgit v1.1