diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | 64 |
1 files changed, 38 insertions, 26 deletions
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) |