aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs21
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs62
2 files changed, 62 insertions, 21 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 7e57275..c5cffa3 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -161,18 +161,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
161 return item; 161 return item;
162 } 162 }
163 163
164 public void Execute() 164 /// <summary>
165 /// Execute the request
166 /// </summary>
167 /// <returns>
168 /// A list of the inventory nodes loaded. If folders were loaded then only the root folders are
169 /// returned
170 /// </returns>
171 public List<InventoryNodeBase> Execute()
165 { 172 {
166 string filePath = "ERROR"; 173 string filePath = "ERROR";
167 int successfulAssetRestores = 0; 174 int successfulAssetRestores = 0;
168 int failedAssetRestores = 0; 175 int failedAssetRestores = 0;
169 int successfulItemRestores = 0; 176 int successfulItemRestores = 0;
177 List<InventoryNodeBase> nodesLoaded = new List<InventoryNodeBase>();
170 178
171 UserProfileData userProfile = commsManager.UserService.GetUserProfile(m_firstName, m_lastName); 179 UserProfileData userProfile = commsManager.UserService.GetUserProfile(m_firstName, m_lastName);
172 if (null == userProfile) 180 if (null == userProfile)
173 { 181 {
174 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Failed to find user {0} {1}", m_firstName, m_lastName); 182 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Failed to find user {0} {1}", m_firstName, m_lastName);
175 return; 183 return nodesLoaded;
176 } 184 }
177 185
178 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID); 186 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userProfile.ID);
@@ -182,7 +190,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
182 "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1} {2}", 190 "[INVENTORY ARCHIVER]: Failed to find user info for {0} {1} {2}",
183 m_firstName, m_lastName, userProfile.ID); 191 m_firstName, m_lastName, userProfile.ID);
184 192
185 return; 193 return nodesLoaded;
186 } 194 }
187 195
188 if (!userInfo.HasReceivedInventory) 196 if (!userInfo.HasReceivedInventory)
@@ -191,7 +199,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
191 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1} {2}", 199 "[INVENTORY ARCHIVER]: Have not yet received inventory info for user {0} {1} {2}",
192 m_firstName, m_lastName, userProfile.ID); 200 m_firstName, m_lastName, userProfile.ID);
193 201
194 return; 202 return nodesLoaded;
195 } 203 }
196 204
197 InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(m_invPath); 205 InventoryFolderImpl inventoryFolder = userInfo.RootFolder.FindFolderByPath(m_invPath);
@@ -201,7 +209,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
201 // TODO: Later on, automatically create this folder if it does not exist 209 // TODO: Later on, automatically create this folder if it does not exist
202 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath); 210 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
203 211
204 return; 212 return nodesLoaded;
205 } 213 }
206 214
207 archive = new TarArchiveReader(m_loadStream); 215 archive = new TarArchiveReader(m_loadStream);
@@ -236,6 +244,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
236 244
237 userInfo.AddItem(item); 245 userInfo.AddItem(item);
238 successfulItemRestores++; 246 successfulItemRestores++;
247 nodesLoaded.Add(item);
239 } 248 }
240 } 249 }
241 } 250 }
@@ -244,6 +253,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
244 253
245 m_log.DebugFormat("[INVENTORY ARCHIVER]: Restored {0} assets", successfulAssetRestores); 254 m_log.DebugFormat("[INVENTORY ARCHIVER]: Restored {0} assets", successfulAssetRestores);
246 m_log.InfoFormat("[INVENTORY ARCHIVER]: Restored {0} items", successfulItemRestores); 255 m_log.InfoFormat("[INVENTORY ARCHIVER]: Restored {0} items", successfulItemRestores);
256
257 return nodesLoaded;
247 } 258 }
248 259
249 /// <summary> 260 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index ab914c4..a684b69 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -31,6 +31,7 @@ using System.Reflection;
31using log4net; 31using log4net;
32using Nini.Config; 32using Nini.Config;
33using OpenMetaverse; 33using OpenMetaverse;
34using OpenSim.Framework;
34using OpenSim.Framework.Communications; 35using OpenSim.Framework.Communications;
35using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
@@ -96,7 +97,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
96 { 97 {
97 if (m_scenes.Count > 0) 98 if (m_scenes.Count > 0)
98 { 99 {
99 new InventoryArchiveReadRequest(firstName, lastName, invPath, loadStream, m_commsManager).Execute(); 100 InventoryArchiveReadRequest request =
101 new InventoryArchiveReadRequest(firstName, lastName, invPath, loadStream, m_commsManager);
102
103 UpdateClientWithLoadedNodes(firstName, lastName, request.Execute());
100 } 104 }
101 } 105 }
102 106
@@ -111,20 +115,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
111 public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath) 115 public void DearchiveInventory(string firstName, string lastName, string invPath, string loadPath)
112 { 116 {
113 if (m_scenes.Count > 0) 117 if (m_scenes.Count > 0)
114 { 118 {
115 new InventoryArchiveReadRequest(firstName, lastName, invPath, loadPath, m_commsManager).Execute(); 119 InventoryArchiveReadRequest request =
116 } 120 new InventoryArchiveReadRequest(firstName, lastName, invPath, loadPath, m_commsManager);
117 121
118 /* 122 UpdateClientWithLoadedNodes(firstName, lastName, request.Execute());
119 foreach (Scene scene in m_scenes.Values) 123 }
120 {
121 ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
122 if (user != null && !user.IsChildAgent)
123 {
124 user.ControllingClient.SendBulkUpdateInventory(folderCopy);
125 }
126 }
127 */
128 } 124 }
129 125
130 public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath) 126 public void ArchiveInventory(string firstName, string lastName, string invPath, string savePath)
@@ -175,6 +171,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
175 string savePath = (cmdparams.Length > 5 ? cmdparams[5] : DEFAULT_INV_BACKUP_FILENAME); 171 string savePath = (cmdparams.Length > 5 ? cmdparams[5] : DEFAULT_INV_BACKUP_FILENAME);
176 172
177 ArchiveInventory(firstName, lastName, invPath, savePath); 173 ArchiveInventory(firstName, lastName, invPath, savePath);
178 } 174 }
175
176 /// <summary>
177 /// Notify the client of loaded nodes if they are logged in
178 /// </summary>
179 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param>
180 private void UpdateClientWithLoadedNodes(string firstName, string lastName, List<InventoryNodeBase> loadedNodes)
181 {
182 if (loadedNodes.Count == 0)
183 return;
184
185 UserProfileData userProfile = m_commsManager.UserService.GetUserProfile(firstName, lastName);
186
187 if (null == userProfile)
188 return;
189
190 foreach (Scene scene in m_scenes.Values)
191 {
192 ScenePresence user = scene.GetScenePresence(userProfile.ID);
193
194 if (user != null && !user.IsChildAgent)
195 {
196 foreach (InventoryNodeBase node in loadedNodes)
197 {
198 m_log.DebugFormat(
199 "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}",
200 user.Name, node.Name);
201
202 user.ControllingClient.SendBulkUpdateInventory(node);
203 }
204
205 break;
206 }
207 }
208 }
179 } 209 }
180} 210}