diff options
author | Justin Clark-Casey (justincc) | 2010-06-04 22:17:23 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-06-04 22:17:23 +0100 |
commit | 72bd68a21f916db918aeb3dd60a1f391e41ed7c2 (patch) | |
tree | d6159745733603efbd457e1e616aefb72b85cba2 /OpenSim/Region/CoreModules/Avatar | |
parent | bring TestLoadIarV0_1AbsentUsers() back online (diff) | |
download | opensim-SC-72bd68a21f916db918aeb3dd60a1f391e41ed7c2.zip opensim-SC-72bd68a21f916db918aeb3dd60a1f391e41ed7c2.tar.gz opensim-SC-72bd68a21f916db918aeb3dd60a1f391e41ed7c2.tar.bz2 opensim-SC-72bd68a21f916db918aeb3dd60a1f391e41ed7c2.tar.xz |
add ability for load iar/save iar to take in arbitrary options
not used for anything yet
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ab5f485..cfefbe9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -30,11 +30,11 @@ using System.Collections.Generic; | |||
30 | using System.IO; | 30 | using System.IO; |
31 | using System.Reflection; | 31 | using System.Reflection; |
32 | using log4net; | 32 | using log4net; |
33 | using NDesk.Options; | ||
33 | using Nini.Config; | 34 | using Nini.Config; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
36 | using OpenSim.Framework.Communications; | 37 | using OpenSim.Framework.Communications; |
37 | |||
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 39 | using OpenSim.Region.Framework.Scenes; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
@@ -91,9 +91,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
91 | 91 | ||
92 | scene.AddCommand( | 92 | scene.AddCommand( |
93 | this, "load iar", | 93 | this, "load iar", |
94 | "load iar <first> <last> <inventory path> <password> [<IAR path>]", | 94 | "load iar <first> <last> <inventory path> <password> [<IAR path>]", |
95 | //"load iar [--merge] <first> <last> <inventory path> <password> [<IAR path>]", | ||
95 | "Load user inventory archive (IAR).", | 96 | "Load user inventory archive (IAR).", |
96 | "<first> is user's first name." + Environment.NewLine | 97 | //"--merge is an option which merges the loaded IAR with existing inventory folders where possible, rather than always creating new ones" |
98 | //+ "<first> is user's first name." + Environment.NewLine | ||
99 | "<first> is user's first name." + Environment.NewLine | ||
97 | + "<last> is user's last name." + Environment.NewLine | 100 | + "<last> is user's last name." + Environment.NewLine |
98 | + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine | 101 | + "<inventory path> is the path inside the user's inventory where the IAR should be loaded." + Environment.NewLine |
99 | + "<password> is the user's password." + Environment.NewLine | 102 | + "<password> is the user's password." + Environment.NewLine |
@@ -133,8 +136,16 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
133 | if (handlerInventoryArchiveSaved != null) | 136 | if (handlerInventoryArchiveSaved != null) |
134 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 137 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); |
135 | } | 138 | } |
136 | 139 | ||
137 | public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | 140 | public bool ArchiveInventory( |
141 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | ||
142 | { | ||
143 | return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); | ||
144 | } | ||
145 | |||
146 | public bool ArchiveInventory( | ||
147 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | ||
148 | Dictionary<string, object> options) | ||
138 | { | 149 | { |
139 | if (m_scenes.Count > 0) | 150 | if (m_scenes.Count > 0) |
140 | { | 151 | { |
@@ -172,7 +183,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
172 | return false; | 183 | return false; |
173 | } | 184 | } |
174 | 185 | ||
175 | public bool ArchiveInventory(Guid id, string firstName, string lastName, string invPath, string pass, string savePath) | 186 | public bool ArchiveInventory( |
187 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | ||
188 | Dictionary<string, object> options) | ||
176 | { | 189 | { |
177 | if (m_scenes.Count > 0) | 190 | if (m_scenes.Count > 0) |
178 | { | 191 | { |
@@ -209,8 +222,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
209 | 222 | ||
210 | return false; | 223 | return false; |
211 | } | 224 | } |
212 | 225 | ||
213 | public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) | 226 | public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) |
227 | { | ||
228 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | ||
229 | } | ||
230 | |||
231 | public bool DearchiveInventory( | ||
232 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | ||
233 | Dictionary<string, object> options) | ||
214 | { | 234 | { |
215 | if (m_scenes.Count > 0) | 235 | if (m_scenes.Count > 0) |
216 | { | 236 | { |
@@ -252,7 +272,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
252 | return false; | 272 | return false; |
253 | } | 273 | } |
254 | 274 | ||
255 | public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, string loadPath) | 275 | public bool DearchiveInventory( |
276 | string firstName, string lastName, string invPath, string pass, string loadPath, | ||
277 | Dictionary<string, object> options) | ||
256 | { | 278 | { |
257 | if (m_scenes.Count > 0) | 279 | if (m_scenes.Count > 0) |
258 | { | 280 | { |
@@ -300,29 +322,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
300 | /// <param name="cmdparams"></param> | 322 | /// <param name="cmdparams"></param> |
301 | protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) | 323 | protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) |
302 | { | 324 | { |
303 | if (cmdparams.Length < 6) | 325 | m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); |
326 | |||
327 | Dictionary<string, object> options = new Dictionary<string, object>(); | ||
328 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | ||
329 | |||
330 | List<string> mainParams = optionSet.Parse(cmdparams); | ||
331 | |||
332 | if (mainParams.Count < 6) | ||
304 | { | 333 | { |
305 | m_log.Error( | 334 | m_log.Error( |
306 | "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); | 335 | "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); |
307 | return; | 336 | return; |
308 | } | 337 | } |
309 | 338 | ||
310 | m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); | 339 | string firstName = mainParams[2]; |
311 | 340 | string lastName = mainParams[3]; | |
312 | string firstName = cmdparams[2]; | 341 | string invPath = mainParams[4]; |
313 | string lastName = cmdparams[3]; | 342 | string pass = mainParams[5]; |
314 | string invPath = cmdparams[4]; | 343 | string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); |
315 | string pass = cmdparams[5]; | ||
316 | string loadPath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME); | ||
317 | 344 | ||
318 | m_log.InfoFormat( | 345 | m_log.InfoFormat( |
319 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 346 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
320 | loadPath, invPath, firstName, lastName); | 347 | loadPath, invPath, firstName, lastName); |
321 | 348 | ||
322 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath)) | 349 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) |
323 | m_log.InfoFormat( | 350 | m_log.InfoFormat( |
324 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 351 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", |
325 | loadPath, firstName, lastName); | 352 | loadPath, firstName, lastName); |
326 | } | 353 | } |
327 | 354 | ||
328 | /// <summary> | 355 | /// <summary> |
@@ -351,7 +378,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
351 | savePath, invPath, firstName, lastName); | 378 | savePath, invPath, firstName, lastName); |
352 | 379 | ||
353 | Guid id = Guid.NewGuid(); | 380 | Guid id = Guid.NewGuid(); |
354 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath); | 381 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>()); |
355 | 382 | ||
356 | lock (m_pendingConsoleSaves) | 383 | lock (m_pendingConsoleSaves) |
357 | m_pendingConsoleSaves.Add(id); | 384 | m_pendingConsoleSaves.Add(id); |