aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2009-11-09 17:04:05 +0000
committerJustin Clark-Casey (justincc)2009-11-09 17:04:05 +0000
commitae92bbcb95a94b71c74d2ff64e76eb2d0e12af7d (patch)
treeba55027aa1a983908ac08206d68d89462c70e8c2 /OpenSim
parentminor: remove some old commented out load iar code (diff)
downloadopensim-SC-ae92bbcb95a94b71c74d2ff64e76eb2d0e12af7d.zip
opensim-SC-ae92bbcb95a94b71c74d2ff64e76eb2d0e12af7d.tar.gz
opensim-SC-ae92bbcb95a94b71c74d2ff64e76eb2d0e12af7d.tar.bz2
opensim-SC-ae92bbcb95a94b71c74d2ff64e76eb2d0e12af7d.tar.xz
refactor: break actual item load in iar into separate method
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs74
1 files changed, 46 insertions, 28 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 4023c8f..d82d0e3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -138,35 +138,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
138 rootDestinationFolder, foldersCreated, nodesLoaded); 138 rootDestinationFolder, foldersCreated, nodesLoaded);
139 139
140 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType) 140 if (TarArchiveReader.TarEntryType.TYPE_DIRECTORY != entryType)
141 { 141 {
142 // Escape back characters 142 InventoryItemBase item = LoadItem(data, foundFolder);
143 filePath = filePath.Replace("/", "/");
144 filePath = filePath.Replace("&", "&");
145
146 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
147
148 // Don't use the item ID that's in the file
149 item.ID = UUID.Random();
150
151 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
152 if (UUID.Zero != ospResolvedId)
153 item.CreatorIdAsUuid = ospResolvedId;
154 else
155 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
156
157 item.Owner = m_userInfo.UserProfile.ID;
158
159 // Reset folder ID to the one in which we want to load it
160 item.Folder = foundFolder.ID;
161
162 //m_userInfo.AddItem(item);
163 m_scene.InventoryService.AddItem(item);
164 successfulItemRestores++;
165 143
166 // If we're loading an item directly into the given destination folder then we need to record 144 if (item != null)
167 // it separately from any loaded root folders 145 {
168 if (rootDestinationFolder == foundFolder) 146 successfulItemRestores++;
169 nodesLoaded.Add(item); 147
148 // If we're loading an item directly into the given destination folder then we need to record
149 // it separately from any loaded root folders
150 if (rootDestinationFolder == foundFolder)
151 nodesLoaded.Add(item);
152 }
170 } 153 }
171 } 154 }
172 } 155 }
@@ -340,6 +323,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
340 } 323 }
341 324
342 /// <summary> 325 /// <summary>
326 /// Load an item from the archive
327 /// </summary>
328 /// <param name="filePath">The archive path for the item</param>
329 /// <param name="data">The raw item data</param>
330 /// <param name="rootDestinationFolder">The root destination folder for loaded items</param>
331 /// <param name="nodesLoaded">All the inventory nodes (items and folders) loaded so far</param>
332 protected InventoryItemBase LoadItem(byte[] data, InventoryFolderBase loadFolder)
333 {
334 // Escape back characters
335// filePath = filePath.Replace("&#47;", "/");
336// filePath = filePath.Replace("&amp;", "&");
337
338 InventoryItemBase item = UserInventoryItemSerializer.Deserialize(data);
339
340 // Don't use the item ID that's in the file
341 item.ID = UUID.Random();
342
343 UUID ospResolvedId = OspResolver.ResolveOspa(item.CreatorId, m_scene.CommsManager);
344 if (UUID.Zero != ospResolvedId)
345 item.CreatorIdAsUuid = ospResolvedId;
346 else
347 item.CreatorIdAsUuid = m_userInfo.UserProfile.ID;
348
349 item.Owner = m_userInfo.UserProfile.ID;
350
351 // Reset folder ID to the one in which we want to load it
352 item.Folder = loadFolder.ID;
353
354 //m_userInfo.AddItem(item);
355 m_scene.InventoryService.AddItem(item);
356
357 return item;
358 }
359
360 /// <summary>
343 /// Load an asset 361 /// Load an asset
344 /// </summary> 362 /// </summary>
345 /// <param name="assetFilename"></param> 363 /// <param name="assetFilename"></param>