aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs54
1 files changed, 42 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index 2eaca49..421ea30 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -75,6 +75,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
75 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); 75 private Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>();
76 private Scene m_aScene; 76 private Scene m_aScene;
77 77
78 private IUserAccountService m_UserAccountService;
79 protected IUserAccountService UserAccountService
80 {
81 get
82 {
83 if (m_UserAccountService == null)
84 // What a strange thing to do...
85 foreach (Scene s in m_scenes.Values)
86 {
87 m_UserAccountService = s.RequestModuleInterface<IUserAccountService>();
88 break;
89 }
90
91 return m_UserAccountService;
92 }
93 }
94
95
78 public InventoryArchiverModule() {} 96 public InventoryArchiverModule() {}
79 97
80 public InventoryArchiverModule(bool disablePresenceChecks) 98 public InventoryArchiverModule(bool disablePresenceChecks)
@@ -106,11 +124,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
106 124
107 scene.AddCommand( 125 scene.AddCommand(
108 this, "save iar", 126 this, "save iar",
109 "save iar <first> <last> <inventory path> <password> [<IAR path>]", 127 "save iar <first> <last> <inventory path> <password> [--p|-profile=<url>] [<IAR path>]",
110 "Save user inventory archive (IAR).", 128 "Save user inventory archive (IAR).",
111 "<first> is the user's first name." + Environment.NewLine 129 "<first> is the user's first name." + Environment.NewLine
112 + "<last> is the user's last name." + Environment.NewLine 130 + "<last> is the user's last name." + Environment.NewLine
113 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine 131 + "<inventory path> is the path inside the user's inventory for the folder/item to be saved." + Environment.NewLine
132 + "-p|--profile=<url> adds the url of the profile service to the saved user information." + Environment.NewLine
114 + "<IAR path> is the filesystem path at which to save the IAR." 133 + "<IAR path> is the filesystem path at which to save the IAR."
115 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME), 134 + string.Format(" If this is not given then the filename {0} in the current directory is used", DEFAULT_INV_BACKUP_FILENAME),
116 HandleSaveInvConsoleCommand); 135 HandleSaveInvConsoleCommand);
@@ -157,7 +176,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
157 { 176 {
158 try 177 try
159 { 178 {
160 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(); 179 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService);
161 } 180 }
162 catch (EntryPointNotFoundException e) 181 catch (EntryPointNotFoundException e)
163 { 182 {
@@ -197,7 +216,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
197 { 216 {
198 try 217 try
199 { 218 {
200 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(); 219 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService);
201 } 220 }
202 catch (EntryPointNotFoundException e) 221 catch (EntryPointNotFoundException e)
203 { 222 {
@@ -368,10 +387,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
368 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 387 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
369 { 388 {
370 Guid id = Guid.NewGuid(); 389 Guid id = Guid.NewGuid();
371 390
391 Dictionary<string, object> options = new Dictionary<string, object>();
392
393 OptionSet ops = new OptionSet();
394 //ops.Add("v|version=", delegate(string v) { options["version"] = v; });
395 ops.Add("p|profile=", delegate(string v) { options["profile"] = v; });
396
397 List<string> mainParams = ops.Parse(cmdparams);
398
372 try 399 try
373 { 400 {
374 if (cmdparams.Length < 6) 401 if (mainParams.Count < 6)
375 { 402 {
376 m_log.Error( 403 m_log.Error(
377 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 404 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
@@ -379,18 +406,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
379 } 406 }
380 407
381 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 408 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
382 409 if (options.ContainsKey("profile"))
383 string firstName = cmdparams[2]; 410 m_log.WarnFormat("[INVENTORY ARCHIVER]: Please be aware that inventory archives with creator information are not compatible with OpenSim 0.7.0.2 and earlier. Do not use the -profile option if you want to produce a compatible IAR");
384 string lastName = cmdparams[3]; 411
385 string invPath = cmdparams[4]; 412 string firstName = mainParams[2];
386 string pass = cmdparams[5]; 413 string lastName = mainParams[3];
387 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); 414 string invPath = mainParams[4];
415 string pass = mainParams[5];
416 string savePath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
388 417
389 m_log.InfoFormat( 418 m_log.InfoFormat(
390 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", 419 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
391 savePath, invPath, firstName, lastName); 420 savePath, invPath, firstName, lastName);
392 421
393 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); 422 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options);
394 } 423 }
395 catch (InventoryArchiverException e) 424 catch (InventoryArchiverException e)
396 { 425 {
@@ -518,5 +547,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
518 547
519 return false; 548 return false;
520 } 549 }
550
521 } 551 }
522} 552}