diff options
author | Justin Clarke Casey | 2009-02-12 19:54:19 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-02-12 19:54:19 +0000 |
commit | 9177f2871086ba211c9c84490f322cfe8ad74494 (patch) | |
tree | 27771a64d3642832cf48b8ff27ed62c79fd2c408 /OpenSim/Region/CoreModules | |
parent | large scale fix for svn props after "the great refactor" (diff) | |
download | opensim-SC-9177f2871086ba211c9c84490f322cfe8ad74494.zip opensim-SC-9177f2871086ba211c9c84490f322cfe8ad74494.tar.gz opensim-SC-9177f2871086ba211c9c84490f322cfe8ad74494.tar.bz2 opensim-SC-9177f2871086ba211c9c84490f322cfe8ad74494.tar.xz |
* Make it possible to load and save inventory archives while a user is not logged in on standalone mode but not on grid mode
* No user functionality yet
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 58 insertions, 33 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index d8234bc..7189e36 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -170,14 +170,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
170 | int failedAssetRestores = 0; | 170 | int failedAssetRestores = 0; |
171 | int successfulItemRestores = 0; | 171 | int successfulItemRestores = 0; |
172 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); | 172 | List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); |
173 | 173 | ||
174 | if (!m_userInfo.HasReceivedInventory) | 174 | if (!m_userInfo.HasReceivedInventory) |
175 | { | 175 | { |
176 | m_log.ErrorFormat( | 176 | // If the region server has access to the user admin service (by which users are created), |
177 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", | 177 | // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the |
178 | m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); | 178 | // server. |
179 | // | ||
180 | // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might | ||
181 | // use a remote inventory service, though this is vanishingly rare at the moment. | ||
182 | if (null == commsManager.UserAdminService) | ||
183 | { | ||
184 | m_log.ErrorFormat( | ||
185 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", | ||
186 | m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); | ||
179 | 187 | ||
180 | return nodesLoaded; | 188 | return nodesLoaded; |
189 | } | ||
190 | else | ||
191 | { | ||
192 | m_userInfo.FetchInventory(); | ||
193 | } | ||
181 | } | 194 | } |
182 | 195 | ||
183 | InventoryFolderImpl inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); | 196 | InventoryFolderImpl inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index c00c80f..d916eba 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -183,42 +183,54 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
183 | InventoryFolderImpl inventoryFolder = null; | 183 | InventoryFolderImpl inventoryFolder = null; |
184 | InventoryItemBase inventoryItem = null; | 184 | InventoryItemBase inventoryItem = null; |
185 | 185 | ||
186 | if (m_userInfo.HasReceivedInventory) | 186 | if (!m_userInfo.HasReceivedInventory) |
187 | { | 187 | { |
188 | // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl | 188 | // If the region server has access to the user admin service (by which users are created), |
189 | // itself (possibly at a small loss in efficiency). | 189 | // then we'll assume that it's okay to fiddle with the user's inventory even if they are not on the |
190 | string[] components | 190 | // server. |
191 | = m_invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); | 191 | // |
192 | m_invPath = String.Empty; | 192 | // FIXME: FetchInventory should probably be assumed to by async anyway, since even standalones might |
193 | foreach (string c in components) | 193 | // use a remote inventory service, though this is vanishingly rare at the moment. |
194 | if (null == commsManager.UserAdminService) | ||
194 | { | 195 | { |
195 | m_invPath += c + InventoryFolderImpl.PATH_DELIMITER; | 196 | m_log.ErrorFormat( |
196 | } | 197 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", |
198 | m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); | ||
197 | 199 | ||
198 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters | 200 | return; |
199 | // Therefore if we still start with a / after the split, then we need the root folder | ||
200 | if (m_invPath.Length == 0) | ||
201 | { | ||
202 | inventoryFolder = m_userInfo.RootFolder; | ||
203 | } | 201 | } |
204 | else | 202 | else |
205 | { | 203 | { |
206 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); | 204 | m_userInfo.FetchInventory(); |
207 | inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); | ||
208 | } | 205 | } |
206 | } | ||
207 | |||
208 | // Eliminate double slashes and any leading / on the path. This might be better done within InventoryFolderImpl | ||
209 | // itself (possibly at a small loss in efficiency). | ||
210 | string[] components | ||
211 | = m_invPath.Split(new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries); | ||
212 | m_invPath = String.Empty; | ||
213 | foreach (string c in components) | ||
214 | { | ||
215 | m_invPath += c + InventoryFolderImpl.PATH_DELIMITER; | ||
216 | } | ||
209 | 217 | ||
210 | // The path may point to an item instead | 218 | // Annoyingly Split actually returns the original string if the input string consists only of delimiters |
211 | if (inventoryFolder == null) | 219 | // Therefore if we still start with a / after the split, then we need the root folder |
212 | { | 220 | if (m_invPath.Length == 0) |
213 | inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); | 221 | { |
214 | } | 222 | inventoryFolder = m_userInfo.RootFolder; |
215 | } | 223 | } |
216 | else | 224 | else |
217 | { | 225 | { |
218 | m_log.ErrorFormat( | 226 | m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER)); |
219 | "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}", | 227 | inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath); |
220 | m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID); | 228 | } |
221 | return; | 229 | |
230 | // The path may point to an item instead | ||
231 | if (inventoryFolder == null) | ||
232 | { | ||
233 | inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath); | ||
222 | } | 234 | } |
223 | 235 | ||
224 | if (null == inventoryFolder) | 236 | if (null == inventoryFolder) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index 82ea6cf..7660546 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -66,11 +66,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
66 | private CommunicationsManager m_commsManager; | 66 | private CommunicationsManager m_commsManager; |
67 | 67 | ||
68 | public void Initialise(Scene scene, IConfigSource source) | 68 | public void Initialise(Scene scene, IConfigSource source) |
69 | { | 69 | { |
70 | if (m_scenes.Count == 0) | 70 | if (m_scenes.Count == 0) |
71 | { | 71 | { |
72 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 72 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
73 | m_commsManager = scene.CommsManager; | 73 | m_commsManager = scene.CommsManager; |
74 | 74 | ||
75 | scene.AddCommand( | 75 | scene.AddCommand( |
76 | this, "load iar", | 76 | this, "load iar", |