aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs217
1 files changed, 144 insertions, 73 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 9c005e4..d50ebf5 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -50,6 +50,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
50 { 50 {
51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 51 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
52 52
53 /// <value>
54 /// Enable or disable checking whether the iar user is actually logged in
55 /// </value>
56// public bool DisablePresenceChecks { get; set; }
57
53 public event InventoryArchiveSaved OnInventoryArchiveSaved; 58 public event InventoryArchiveSaved OnInventoryArchiveSaved;
54 public event InventoryArchiveLoaded OnInventoryArchiveLoaded; 59 public event InventoryArchiveLoaded OnInventoryArchiveLoaded;
55 60
@@ -89,6 +94,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
89 94
90 public InventoryArchiverModule() {} 95 public InventoryArchiverModule() {}
91 96
97// public InventoryArchiverModule(bool disablePresenceChecks)
98// {
99// DisablePresenceChecks = disablePresenceChecks;
100 // }
101
92 #region ISharedRegionModule 102 #region ISharedRegionModule
93 103
94 public void Initialise(IConfigSource source) 104 public void Initialise(IConfigSource source)
@@ -162,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
162 172
163 public string Name { get { return "Inventory Archiver Module"; } } 173 public string Name { get { return "Inventory Archiver Module"; } }
164 174
165 #endregion 175 #endregion
166 176
167 /// <summary> 177 /// <summary>
168 /// Trigger the inventory archive saved event. 178 /// Trigger the inventory archive saved event.
@@ -204,21 +214,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
204 214
205 if (userInfo != null) 215 if (userInfo != null)
206 { 216 {
207 try 217// if (CheckPresence(userInfo.PrincipalID))
208 { 218// {
209 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); 219 try
210 } 220 {
211 catch (EntryPointNotFoundException e) 221 InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream);
212 { 222 iarReq.Execute(options, UserAccountService);
213 m_log.ErrorFormat( 223 }
214 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 224 catch (EntryPointNotFoundException e)
215 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 225 {
216 m_log.Error(e); 226 m_log.ErrorFormat(
217 227 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
218 return false; 228 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
219 } 229 m_log.Error(e);
220 230
221 return true; 231 return false;
232 }
233
234 return true;
235// }
236// else
237// {
238// m_log.ErrorFormat(
239// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
240// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
241// }
222 } 242 }
223 } 243 }
224 244
@@ -238,21 +258,31 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
238 258
239 if (userInfo != null) 259 if (userInfo != null)
240 { 260 {
241 try 261// if (CheckPresence(userInfo.PrincipalID))
242 { 262// {
243 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); 263 try
244 } 264 {
245 catch (EntryPointNotFoundException e) 265 InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath);
246 { 266 iarReq.Execute(options, UserAccountService);
247 m_log.ErrorFormat( 267 }
248 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 268 catch (EntryPointNotFoundException e)
249 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 269 {
250 m_log.Error(e); 270 m_log.ErrorFormat(
251 271 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
252 return false; 272 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
253 } 273 m_log.Error(e);
254 274
255 return true; 275 return false;
276 }
277
278 return true;
279// }
280// else
281// {
282// m_log.ErrorFormat(
283// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
284// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
285// }
256 } 286 }
257 } 287 }
258 288
@@ -274,26 +304,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
274 304
275 if (userInfo != null) 305 if (userInfo != null)
276 { 306 {
277 InventoryArchiveReadRequest request; 307// if (CheckPresence(userInfo.PrincipalID))
278 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 308// {
279 309 InventoryArchiveReadRequest request;
280 try 310 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
281 { 311
282 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); 312 try
283 } 313 {
284 catch (EntryPointNotFoundException e) 314 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge);
285 { 315 }
286 m_log.ErrorFormat( 316 catch (EntryPointNotFoundException e)
287 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 317 {
288 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 318 m_log.ErrorFormat(
289 m_log.Error(e); 319 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
290 320 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
291 return false; 321 m_log.Error(e);
292 } 322
293 323 return false;
294 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 324 }
295 325
296 return true; 326 UpdateClientWithLoadedNodes(userInfo, request.Execute());
327
328 return true;
329// }
330// else
331// {
332// m_log.ErrorFormat(
333// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
334// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
335// }
297 } 336 }
298 else 337 else
299 m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found", 338 m_log.ErrorFormat("[INVENTORY ARCHIVER]: User {0} {1} not found",
@@ -313,26 +352,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
313 352
314 if (userInfo != null) 353 if (userInfo != null)
315 { 354 {
316 InventoryArchiveReadRequest request; 355// if (CheckPresence(userInfo.PrincipalID))
317 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false); 356// {
318 357 InventoryArchiveReadRequest request;
319 try 358 bool merge = (options.ContainsKey("merge") ? (bool)options["merge"] : false);
320 { 359
321 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); 360 try
322 } 361 {
323 catch (EntryPointNotFoundException e) 362 request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge);
324 { 363 }
325 m_log.ErrorFormat( 364 catch (EntryPointNotFoundException e)
326 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream." 365 {
327 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?"); 366 m_log.ErrorFormat(
328 m_log.Error(e); 367 "[INVENTORY ARCHIVER]: Mismatch between Mono and zlib1g library version when trying to create compression stream."
329 368 + "If you've manually installed Mono, have you appropriately updated zlib1g as well?");
330 return false; 369 m_log.Error(e);
331 } 370
332 371 return false;
333 UpdateClientWithLoadedNodes(userInfo, request.Execute()); 372 }
334 373
335 return true; 374 UpdateClientWithLoadedNodes(userInfo, request.Execute());
375
376 return true;
377// }
378// else
379// {
380// m_log.ErrorFormat(
381// "[INVENTORY ARCHIVER]: User {0} {1} {2} not logged in to this region simulator",
382// userInfo.FirstName, userInfo.LastName, userInfo.PrincipalID);
383// }
336 } 384 }
337 } 385 }
338 386
@@ -545,7 +593,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
545 /// Notify the client of loaded nodes if they are logged in 593 /// Notify the client of loaded nodes if they are logged in
546 /// </summary> 594 /// </summary>
547 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param> 595 /// <param name="loadedNodes">Can be empty. In which case, nothing happens</param>
548 private void UpdateClientWithLoadedNodes(UserAccount userInfo, HashSet<InventoryNodeBase> loadedNodes) 596 private void UpdateClientWithLoadedNodes(UserAccount userInfo, Dictionary<UUID, InventoryNodeBase> loadedNodes)
549 { 597 {
550 if (loadedNodes.Count == 0) 598 if (loadedNodes.Count == 0)
551 return; 599 return;
@@ -556,7 +604,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
556 604
557 if (user != null && !user.IsChildAgent) 605 if (user != null && !user.IsChildAgent)
558 { 606 {
559 foreach (InventoryNodeBase node in loadedNodes) 607 foreach (InventoryNodeBase node in loadedNodes.Values)
560 { 608 {
561// m_log.DebugFormat( 609// m_log.DebugFormat(
562// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}", 610// "[INVENTORY ARCHIVER]: Notifying {0} of loaded inventory node {1}",
@@ -569,5 +617,28 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
569 } 617 }
570 } 618 }
571 } 619 }
620
621// /// <summary>
622// /// Check if the given user is present in any of the scenes.
623// /// </summary>
624// /// <param name="userId">The user to check</param>
625// /// <returns>true if the user is in any of the scenes, false otherwise</returns>
626// protected bool CheckPresence(UUID userId)
627// {
628// if (DisablePresenceChecks)
629// return true;
630//
631// foreach (Scene scene in m_scenes.Values)
632// {
633// ScenePresence p;
634// if ((p = scene.GetScenePresence(userId)) != null)
635// {
636// p.ControllingClient.SendAgentAlertMessage("Inventory operation has been started", false);
637// return true;
638// }
639// }
640//
641// return false;
642// }
572 } 643 }
573} 644}