aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs44
1 files changed, 12 insertions, 32 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 5ae5b4b..6f8fa3c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -48,8 +48,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
48 protected TarArchiveReader archive; 48 protected TarArchiveReader archive;
49 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding(); 49 private static ASCIIEncoding m_asciiEncoding = new ASCIIEncoding();
50 50
51 private string m_firstName; 51 private CachedUserInfo m_userInfo;
52 private string m_lastName;
53 private string m_invPath; 52 private string m_invPath;
54 53
55 /// <value> 54 /// <value>
@@ -60,10 +59,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
60 CommunicationsManager commsManager; 59 CommunicationsManager commsManager;
61 60
62 public InventoryArchiveReadRequest( 61 public InventoryArchiveReadRequest(
63 string firstName, string lastName, string invPath, string loadPath, CommunicationsManager commsManager) 62 CachedUserInfo userInfo, string invPath, string loadPath, CommunicationsManager commsManager)
64 : this( 63 : this(
65 firstName, 64 userInfo,
66 lastName,
67 invPath, 65 invPath,
68 new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress), 66 new GZipStream(new FileStream(loadPath, FileMode.Open), CompressionMode.Decompress),
69 commsManager) 67 commsManager)
@@ -71,10 +69,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
71 } 69 }
72 70
73 public InventoryArchiveReadRequest( 71 public InventoryArchiveReadRequest(
74 string firstName, string lastName, string invPath, Stream loadStream, CommunicationsManager commsManager) 72 CachedUserInfo userInfo, string invPath, Stream loadStream, CommunicationsManager commsManager)
75 { 73 {
76 m_firstName = firstName; 74 m_userInfo = userInfo;
77 m_lastName = lastName;
78 m_invPath = invPath; 75 m_invPath = invPath;
79 m_loadStream = loadStream; 76 m_loadStream = loadStream;
80 this.commsManager = commsManager; 77 this.commsManager = commsManager;
@@ -174,33 +171,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
174 int successfulItemRestores = 0; 171 int successfulItemRestores = 0;
175 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>(); 172 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
176 173
177 UserProfileData userProfile = commsManager.UserService.GetUserProfile(m_firstName, m_lastName); 174 if (!m_userInfo.HasReceivedInventory)
178 if (null == userProfile)
179 {
180 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Failed to find user {0} {1}", m_firstName, m_lastName);
181 return nodesLoaded;
182 }
183
184 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID);
185 if (null == userInfo)
186 {
187 m_log.ErrorFormat(
188 "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1} {2}",
189 m_firstName, m_lastName, userProfile.ID);
190
191 return nodesLoaded;
192 }
193
194 if (!userInfo.HasReceivedInventory)
195 { 175 {
196 m_log.ErrorFormat( 176 m_log.ErrorFormat(
197 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1} {2}", 177 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1}",
198 m_firstName, m_lastName, userProfile.ID); 178 m_userInfo.UserProfile.Name, m_userInfo.UserProfile.ID);
199 179
200 return nodesLoaded; 180 return nodesLoaded;
201 } 181 }
202 182
203 InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(m_invPath); 183 InventoryFolderImpl inventoryFolder = m_userInfo.RootFolder.FindFolderByPath(m_invPath);
204 184
205 if (null == inventoryFolder) 185 if (null == inventoryFolder)
206 { 186 {
@@ -232,15 +212,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
232 212
233 if (item != null) 213 if (item != null)
234 { 214 {
235 item.Creator = userProfile.ID; 215 item.Creator = m_userInfo.UserProfile.ID;
236 item.Owner = userProfile.ID; 216 item.Owner = m_userInfo.UserProfile.ID;
237 217
238 // Reset folder ID to the one in which we want to load it 218 // Reset folder ID to the one in which we want to load it
239 // TODO: Properly restore entire folder structure. At the moment all items are dumped in this 219 // TODO: Properly restore entire folder structure. At the moment all items are dumped in this
240 // single folder no matter where in the saved folder structure they are. 220 // single folder no matter where in the saved folder structure they are.
241 item.Folder = inventoryFolder.ID; 221 item.Folder = inventoryFolder.ID;
242 222
243 userInfo.AddItem(item); 223 m_userInfo.AddItem(item);
244 successfulItemRestores++; 224 successfulItemRestores++;
245 nodesLoaded.Add(item); 225 nodesLoaded.Add(item);
246 } 226 }