diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar/Inventory')
9 files changed, 277 insertions, 137 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index 5a8544e..4a06fd1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -61,6 +61,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
61 | 61 | ||
62 | private UserAccount m_userInfo; | 62 | private UserAccount m_userInfo; |
63 | private string m_invPath; | 63 | private string m_invPath; |
64 | |||
65 | /// <value> | ||
66 | /// ID of this request | ||
67 | /// </value> | ||
68 | protected UUID m_id; | ||
64 | 69 | ||
65 | /// <summary> | 70 | /// <summary> |
66 | /// Do we want to merge this load with existing inventory? | 71 | /// Do we want to merge this load with existing inventory? |
@@ -71,6 +76,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
71 | protected IAssetService m_AssetService; | 76 | protected IAssetService m_AssetService; |
72 | protected IUserAccountService m_UserAccountService; | 77 | protected IUserAccountService m_UserAccountService; |
73 | 78 | ||
79 | private InventoryArchiverModule m_module; | ||
80 | |||
74 | /// <value> | 81 | /// <value> |
75 | /// The stream from which the inventory archive will be loaded. | 82 | /// The stream from which the inventory archive will be loaded. |
76 | /// </value> | 83 | /// </value> |
@@ -114,11 +121,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
114 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids | 121 | /// Record the creator id that should be associated with an asset. This is used to adjust asset creator ids |
115 | /// after OSP resolution (since OSP creators are only stored in the item | 122 | /// after OSP resolution (since OSP creators are only stored in the item |
116 | /// </summary> | 123 | /// </summary> |
117 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); | 124 | protected Dictionary<UUID, UUID> m_creatorIdForAssetId = new Dictionary<UUID, UUID>(); |
118 | 125 | ||
119 | public InventoryArchiveReadRequest( | 126 | public InventoryArchiveReadRequest( |
120 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) | 127 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) |
128 | : this(UUID.Zero, null, | ||
129 | inv, | ||
130 | assets, | ||
131 | uacc, | ||
132 | userInfo, | ||
133 | invPath, | ||
134 | loadPath, | ||
135 | merge) | ||
136 | { | ||
137 | } | ||
138 | |||
139 | public InventoryArchiveReadRequest( | ||
140 | UUID id, InventoryArchiverModule module, IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, string loadPath, bool merge) | ||
121 | : this( | 141 | : this( |
142 | id, | ||
143 | module, | ||
122 | inv, | 144 | inv, |
123 | assets, | 145 | assets, |
124 | uacc, | 146 | uacc, |
@@ -130,8 +152,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
130 | } | 152 | } |
131 | 153 | ||
132 | public InventoryArchiveReadRequest( | 154 | public InventoryArchiveReadRequest( |
133 | IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) | 155 | UUID id, InventoryArchiverModule module, IInventoryService inv, IAssetService assets, IUserAccountService uacc, UserAccount userInfo, string invPath, Stream loadStream, bool merge) |
134 | { | 156 | { |
157 | m_id = id; | ||
135 | m_InventoryService = inv; | 158 | m_InventoryService = inv; |
136 | m_AssetService = assets; | 159 | m_AssetService = assets; |
137 | m_UserAccountService = uacc; | 160 | m_UserAccountService = uacc; |
@@ -139,6 +162,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | m_userInfo = userInfo; | 162 | m_userInfo = userInfo; |
140 | m_invPath = invPath; | 163 | m_invPath = invPath; |
141 | m_loadStream = loadStream; | 164 | m_loadStream = loadStream; |
165 | m_module = module; | ||
142 | 166 | ||
143 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things | 167 | // FIXME: Do not perform this check since older versions of OpenSim do save the control file after other things |
144 | // (I thought they weren't). We will need to bump the version number and perform this check on all | 168 | // (I thought they weren't). We will need to bump the version number and perform this check on all |
@@ -161,6 +185,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
161 | { | 185 | { |
162 | try | 186 | try |
163 | { | 187 | { |
188 | Exception reportedException = null; | ||
189 | |||
164 | string filePath = "ERROR"; | 190 | string filePath = "ERROR"; |
165 | 191 | ||
166 | List<InventoryFolderBase> folderCandidates | 192 | List<InventoryFolderBase> folderCandidates |
@@ -197,14 +223,25 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
197 | } | 223 | } |
198 | 224 | ||
199 | archive.Close(); | 225 | archive.Close(); |
200 | 226 | ||
201 | m_log.DebugFormat( | 227 | m_log.DebugFormat( |
202 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", | 228 | "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures", |
203 | m_successfulAssetRestores, m_failedAssetRestores); | 229 | m_successfulAssetRestores, m_failedAssetRestores); |
204 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", m_successfulItemRestores); | 230 | |
231 | //Alicia: When this is called by LibraryModule or Tests, m_module will be null as event is not required | ||
232 | if(m_module != null) | ||
233 | m_module.TriggerInventoryArchiveLoaded(m_id, true, m_userInfo, m_invPath, m_loadStream, reportedException, m_successfulItemRestores); | ||
205 | 234 | ||
206 | return m_loadedNodes; | 235 | return m_loadedNodes; |
207 | } | 236 | } |
237 | catch(Exception Ex) | ||
238 | { | ||
239 | // Trigger saved event with failed result and exception data | ||
240 | if (m_module != null) | ||
241 | m_module.TriggerInventoryArchiveLoaded(m_id, false, m_userInfo, m_invPath, m_loadStream, Ex, 0); | ||
242 | |||
243 | return m_loadedNodes; | ||
244 | } | ||
208 | finally | 245 | finally |
209 | { | 246 | { |
210 | m_loadStream.Close(); | 247 | m_loadStream.Close(); |
@@ -375,14 +412,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
375 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); | 412 | newFolderName = InventoryArchiveUtils.UnescapeArchivePath(newFolderName); |
376 | UUID newFolderId = UUID.Random(); | 413 | UUID newFolderId = UUID.Random(); |
377 | 414 | ||
378 | // Asset type has to be Unknown here rather than Folder, otherwise the created folder can't be | ||
379 | // deleted once the client has relogged. | ||
380 | // The root folder appears to be labelled AssetType.Folder (shows up as "Category" in the client) | ||
381 | // even though there is a AssetType.RootCategory | ||
382 | destFolder | 415 | destFolder |
383 | = new InventoryFolderBase( | 416 | = new InventoryFolderBase( |
384 | newFolderId, newFolderName, m_userInfo.PrincipalID, | 417 | newFolderId, newFolderName, m_userInfo.PrincipalID, |
385 | (short)AssetType.Unknown, destFolder.ID, 1); | 418 | (short)FolderType.None, destFolder.ID, 1); |
386 | m_InventoryService.AddFolder(destFolder); | 419 | m_InventoryService.AddFolder(destFolder); |
387 | 420 | ||
388 | // Record that we have now created this folder | 421 | // Record that we have now created this folder |
@@ -483,52 +516,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
483 | { | 516 | { |
484 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 517 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
485 | { | 518 | { |
486 | string xmlData = Utils.BytesToString(data); | 519 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, |
487 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 520 | sog => { |
521 | bool modified = false; | ||
522 | |||
523 | foreach (SceneObjectPart sop in sog.Parts) | ||
524 | { | ||
525 | if (string.IsNullOrEmpty(sop.CreatorData)) | ||
526 | { | ||
527 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
528 | modified = true; | ||
529 | } | ||
530 | } | ||
531 | |||
532 | return modified; | ||
533 | }); | ||
488 | 534 | ||
489 | CoalescedSceneObjects coa = null; | 535 | if (data == null) |
490 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 536 | return false; |
491 | { | ||
492 | // m_log.DebugFormat( | ||
493 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
494 | |||
495 | if (coa.Objects.Count == 0) | ||
496 | { | ||
497 | m_log.WarnFormat( | ||
498 | "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of coalesced object from asset {0} as it has zero loaded components", | ||
499 | assetId); | ||
500 | return false; | ||
501 | } | ||
502 | |||
503 | sceneObjects.AddRange(coa.Objects); | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
508 | |||
509 | if (deserializedObject != null) | ||
510 | { | ||
511 | sceneObjects.Add(deserializedObject); | ||
512 | } | ||
513 | else | ||
514 | { | ||
515 | m_log.WarnFormat( | ||
516 | "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of object from asset {0} as deserialization failed", | ||
517 | assetId); | ||
518 | |||
519 | return false; | ||
520 | } | ||
521 | } | ||
522 | |||
523 | foreach (SceneObjectGroup sog in sceneObjects) | ||
524 | foreach (SceneObjectPart sop in sog.Parts) | ||
525 | if (string.IsNullOrEmpty(sop.CreatorData)) | ||
526 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
527 | |||
528 | if (coa != null) | ||
529 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
530 | else | ||
531 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
532 | } | 537 | } |
533 | } | 538 | } |
534 | 539 | ||
@@ -550,7 +555,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
550 | return false; | 555 | return false; |
551 | } | 556 | } |
552 | } | 557 | } |
553 | 558 | ||
554 | /// <summary> | 559 | /// <summary> |
555 | /// Load control file | 560 | /// Load control file |
556 | /// </summary> | 561 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs index 4292719..f002ad7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs | |||
@@ -34,6 +34,7 @@ using System.Xml; | |||
34 | using log4net; | 34 | using log4net; |
35 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Monitoring; | ||
37 | using OpenSim.Framework.Serialization; | 38 | using OpenSim.Framework.Serialization; |
38 | using OpenSim.Framework.Serialization.External; | 39 | using OpenSim.Framework.Serialization.External; |
39 | using OpenSim.Region.CoreModules.World.Archiver; | 40 | using OpenSim.Region.CoreModules.World.Archiver; |
@@ -42,6 +43,8 @@ using OpenSim.Services.Interfaces; | |||
42 | using Ionic.Zlib; | 43 | using Ionic.Zlib; |
43 | using GZipStream = Ionic.Zlib.GZipStream; | 44 | using GZipStream = Ionic.Zlib.GZipStream; |
44 | using CompressionMode = Ionic.Zlib.CompressionMode; | 45 | using CompressionMode = Ionic.Zlib.CompressionMode; |
46 | using CompressionLevel = Ionic.Zlib.CompressionLevel; | ||
47 | using PermissionMask = OpenSim.Framework.PermissionMask; | ||
45 | 48 | ||
46 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | 49 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver |
47 | { | 50 | { |
@@ -54,6 +57,22 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
54 | /// </summary> | 57 | /// </summary> |
55 | public bool SaveAssets { get; set; } | 58 | public bool SaveAssets { get; set; } |
56 | 59 | ||
60 | /// <summary> | ||
61 | /// Determines which items will be included in the archive, according to their permissions. | ||
62 | /// Default is null, meaning no permission checks. | ||
63 | /// </summary> | ||
64 | public string FilterContent { get; set; } | ||
65 | |||
66 | /// <summary> | ||
67 | /// Counter for inventory items saved to archive for passing to compltion event | ||
68 | /// </summary> | ||
69 | public int CountItems { get; set; } | ||
70 | |||
71 | /// <summary> | ||
72 | /// Counter for inventory items skipped due to permission filter option for passing to compltion event | ||
73 | /// </summary> | ||
74 | public int CountFiltered { get; set; } | ||
75 | |||
57 | /// <value> | 76 | /// <value> |
58 | /// Used to select all inventory nodes in a folder but not the folder itself | 77 | /// Used to select all inventory nodes in a folder but not the folder itself |
59 | /// </value> | 78 | /// </value> |
@@ -73,12 +92,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
73 | /// <value> | 92 | /// <value> |
74 | /// ID of this request | 93 | /// ID of this request |
75 | /// </value> | 94 | /// </value> |
76 | protected Guid m_id; | 95 | protected UUID m_id; |
77 | |||
78 | /// <value> | ||
79 | /// Used to collect the uuids of the assets that we need to save into the archive | ||
80 | /// </value> | ||
81 | protected Dictionary<UUID, sbyte> m_assetUuids = new Dictionary<UUID, sbyte>(); | ||
82 | 96 | ||
83 | /// <value> | 97 | /// <value> |
84 | /// Used to collect the uuids of the users that we need to save into the archive | 98 | /// Used to collect the uuids of the users that we need to save into the archive |
@@ -94,7 +108,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
94 | /// Constructor | 108 | /// Constructor |
95 | /// </summary> | 109 | /// </summary> |
96 | public InventoryArchiveWriteRequest( | 110 | public InventoryArchiveWriteRequest( |
97 | Guid id, InventoryArchiverModule module, Scene scene, | 111 | UUID id, InventoryArchiverModule module, Scene scene, |
98 | UserAccount userInfo, string invPath, string savePath) | 112 | UserAccount userInfo, string invPath, string savePath) |
99 | : this( | 113 | : this( |
100 | id, | 114 | id, |
@@ -110,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
110 | /// Constructor | 124 | /// Constructor |
111 | /// </summary> | 125 | /// </summary> |
112 | public InventoryArchiveWriteRequest( | 126 | public InventoryArchiveWriteRequest( |
113 | Guid id, InventoryArchiverModule module, Scene scene, | 127 | UUID id, InventoryArchiverModule module, Scene scene, |
114 | UserAccount userInfo, string invPath, Stream saveStream) | 128 | UserAccount userInfo, string invPath, Stream saveStream) |
115 | { | 129 | { |
116 | m_id = id; | 130 | m_id = id; |
@@ -122,6 +136,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
122 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); | 136 | m_assetGatherer = new UuidGatherer(m_scene.AssetService); |
123 | 137 | ||
124 | SaveAssets = true; | 138 | SaveAssets = true; |
139 | FilterContent = null; | ||
125 | } | 140 | } |
126 | 141 | ||
127 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut) | 142 | protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut) |
@@ -150,7 +165,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
150 | } | 165 | } |
151 | 166 | ||
152 | m_module.TriggerInventoryArchiveSaved( | 167 | m_module.TriggerInventoryArchiveSaved( |
153 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); | 168 | m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException, CountItems, CountFiltered); |
154 | } | 169 | } |
155 | 170 | ||
156 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) | 171 | protected void SaveInvItem(InventoryItemBase inventoryItem, string path, Dictionary<string, object> options, IUserAccountService userAccountService) |
@@ -166,10 +181,26 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
166 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", | 181 | "[INVENTORY ARCHIVER]: Skipping inventory item {0} {1} at {2}", |
167 | inventoryItem.Name, inventoryItem.ID, path); | 182 | inventoryItem.Name, inventoryItem.ID, path); |
168 | } | 183 | } |
184 | |||
185 | CountFiltered++; | ||
186 | |||
169 | return; | 187 | return; |
170 | } | 188 | } |
171 | } | 189 | } |
172 | 190 | ||
191 | // Check For Permissions Filter Flags | ||
192 | if (!CanUserArchiveObject(m_userInfo.PrincipalID, inventoryItem)) | ||
193 | { | ||
194 | m_log.InfoFormat( | ||
195 | "[INVENTORY ARCHIVER]: Insufficient permissions, skipping inventory item {0} {1} at {2}", | ||
196 | inventoryItem.Name, inventoryItem.ID, path); | ||
197 | |||
198 | // Count Items Excluded | ||
199 | CountFiltered++; | ||
200 | |||
201 | return; | ||
202 | } | ||
203 | |||
173 | if (options.ContainsKey("verbose")) | 204 | if (options.ContainsKey("verbose")) |
174 | m_log.InfoFormat( | 205 | m_log.InfoFormat( |
175 | "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})", | 206 | "[INVENTORY ARCHIVER]: Saving item {0} {1} (asset UUID {2})", |
@@ -185,9 +216,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
185 | 216 | ||
186 | AssetType itemAssetType = (AssetType)inventoryItem.AssetType; | 217 | AssetType itemAssetType = (AssetType)inventoryItem.AssetType; |
187 | 218 | ||
219 | // Count inventory items (different to asset count) | ||
220 | CountItems++; | ||
221 | |||
188 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset | 222 | // Don't chase down link asset items as they actually point to their target item IDs rather than an asset |
189 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) | 223 | if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) |
190 | m_assetGatherer.GatherAssetUuids(inventoryItem.AssetID, (sbyte)inventoryItem.AssetType, m_assetUuids); | 224 | m_assetGatherer.AddForInspection(inventoryItem.AssetID); |
191 | } | 225 | } |
192 | 226 | ||
193 | /// <summary> | 227 | /// <summary> |
@@ -243,6 +277,35 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
243 | } | 277 | } |
244 | 278 | ||
245 | /// <summary> | 279 | /// <summary> |
280 | /// Checks whether the user has permission to export an inventory item to an IAR. | ||
281 | /// </summary> | ||
282 | /// <param name="UserID">The user</param> | ||
283 | /// <param name="InvItem">The inventory item</param> | ||
284 | /// <returns>Whether the user is allowed to export the object to an IAR</returns> | ||
285 | private bool CanUserArchiveObject(UUID UserID, InventoryItemBase InvItem) | ||
286 | { | ||
287 | if (FilterContent == null) | ||
288 | return true;// Default To Allow Export | ||
289 | |||
290 | bool permitted = true; | ||
291 | |||
292 | bool canCopy = (InvItem.CurrentPermissions & (uint)PermissionMask.Copy) != 0; | ||
293 | bool canTransfer = (InvItem.CurrentPermissions & (uint)PermissionMask.Transfer) != 0; | ||
294 | bool canMod = (InvItem.CurrentPermissions & (uint)PermissionMask.Modify) != 0; | ||
295 | |||
296 | if (FilterContent.Contains("C") && !canCopy) | ||
297 | permitted = false; | ||
298 | |||
299 | if (FilterContent.Contains("T") && !canTransfer) | ||
300 | permitted = false; | ||
301 | |||
302 | if (FilterContent.Contains("M") && !canMod) | ||
303 | permitted = false; | ||
304 | |||
305 | return permitted; | ||
306 | } | ||
307 | |||
308 | /// <summary> | ||
246 | /// Execute the inventory write request | 309 | /// Execute the inventory write request |
247 | /// </summary> | 310 | /// </summary> |
248 | public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) | 311 | public void Execute(Dictionary<string, object> options, IUserAccountService userAccountService) |
@@ -250,6 +313,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
250 | if (options.ContainsKey("noassets") && (bool)options["noassets"]) | 313 | if (options.ContainsKey("noassets") && (bool)options["noassets"]) |
251 | SaveAssets = false; | 314 | SaveAssets = false; |
252 | 315 | ||
316 | // Set Permission filter if flag is set | ||
317 | if (options.ContainsKey("checkPermissions")) | ||
318 | { | ||
319 | Object temp; | ||
320 | if (options.TryGetValue("checkPermissions", out temp)) | ||
321 | FilterContent = temp.ToString().ToUpper(); | ||
322 | } | ||
323 | |||
253 | try | 324 | try |
254 | { | 325 | { |
255 | InventoryFolderBase inventoryFolder = null; | 326 | InventoryFolderBase inventoryFolder = null; |
@@ -309,7 +380,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
309 | // We couldn't find the path indicated | 380 | // We couldn't find the path indicated |
310 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); | 381 | string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); |
311 | Exception e = new InventoryArchiverException(errorMessage); | 382 | Exception e = new InventoryArchiverException(errorMessage); |
312 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e); | 383 | m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0); |
313 | throw e; | 384 | throw e; |
314 | } | 385 | } |
315 | 386 | ||
@@ -347,16 +418,19 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
347 | 418 | ||
348 | if (SaveAssets) | 419 | if (SaveAssets) |
349 | { | 420 | { |
350 | m_log.DebugFormat("[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetUuids.Count); | 421 | m_assetGatherer.GatherAll(); |
422 | |||
423 | m_log.DebugFormat( | ||
424 | "[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count); | ||
351 | 425 | ||
352 | AssetsRequest ar | 426 | AssetsRequest ar |
353 | = new AssetsRequest( | 427 | = new AssetsRequest( |
354 | new AssetsArchiver(m_archiveWriter), | 428 | new AssetsArchiver(m_archiveWriter), |
355 | m_assetUuids, m_scene.AssetService, | 429 | m_assetGatherer.GatheredUuids, m_scene.AssetService, |
356 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, | 430 | m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, |
357 | options, ReceivedAllAssets); | 431 | options, ReceivedAllAssets); |
358 | 432 | ||
359 | Util.FireAndForget(o => ar.Execute()); | 433 | WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name)); |
360 | } | 434 | } |
361 | else | 435 | else |
362 | { | 436 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs index ea660bd..5295ba3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
57 | // public bool DisablePresenceChecks { get; set; } | 57 | // public bool DisablePresenceChecks { get; set; } |
58 | 58 | ||
59 | public event InventoryArchiveSaved OnInventoryArchiveSaved; | 59 | public event InventoryArchiveSaved OnInventoryArchiveSaved; |
60 | public event InventoryArchiveLoaded OnInventoryArchiveLoaded; | ||
60 | 61 | ||
61 | /// <summary> | 62 | /// <summary> |
62 | /// The file to load and save inventory if no filename has been specified | 63 | /// The file to load and save inventory if no filename has been specified |
@@ -64,9 +65,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
64 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar"; | 65 | protected const string DEFAULT_INV_BACKUP_FILENAME = "user-inventory.iar"; |
65 | 66 | ||
66 | /// <value> | 67 | /// <value> |
67 | /// Pending save completions initiated from the console | 68 | /// Pending save and load completions initiated from the console |
68 | /// </value> | 69 | /// </value> |
69 | protected List<Guid> m_pendingConsoleSaves = new List<Guid>(); | 70 | protected List<UUID> m_pendingConsoleTasks = new List<UUID>(); |
70 | 71 | ||
71 | /// <value> | 72 | /// <value> |
72 | /// All scenes that this module knows about | 73 | /// All scenes that this module knows about |
@@ -111,6 +112,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
111 | { | 112 | { |
112 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); | 113 | scene.RegisterModuleInterface<IInventoryArchiverModule>(this); |
113 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; | 114 | OnInventoryArchiveSaved += SaveInvConsoleCommandCompleted; |
115 | OnInventoryArchiveLoaded += LoadInvConsoleCommandCompleted; | ||
114 | 116 | ||
115 | scene.AddCommand( | 117 | scene.AddCommand( |
116 | "Archiving", this, "load iar", | 118 | "Archiving", this, "load iar", |
@@ -139,7 +141,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
139 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine | 141 | + "-e|--exclude=<name/uuid> don't save the inventory item in archive" + Environment.NewLine |
140 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine | 142 | + "-f|--excludefolder=<folder/uuid> don't save contents of the folder in archive" + Environment.NewLine |
141 | + "-v|--verbose extra debug messages.\n" | 143 | + "-v|--verbose extra debug messages.\n" |
142 | + "--noassets stops assets being saved to the IAR.", | 144 | + "--noassets stops assets being saved to the IAR." |
145 | + "--perm=<permissions> stops items with insufficient permissions from being saved to the IAR.\n" | ||
146 | + " <permissions> can contain one or more of these characters: \"C\" = Copy, \"T\" = Transfer, \"M\" = Modify.\n", | ||
143 | HandleSaveInvConsoleCommand); | 147 | HandleSaveInvConsoleCommand); |
144 | 148 | ||
145 | m_aScene = scene; | 149 | m_aScene = scene; |
@@ -175,22 +179,34 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
175 | /// Trigger the inventory archive saved event. | 179 | /// Trigger the inventory archive saved event. |
176 | /// </summary> | 180 | /// </summary> |
177 | protected internal void TriggerInventoryArchiveSaved( | 181 | protected internal void TriggerInventoryArchiveSaved( |
178 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 182 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
179 | Exception reportedException) | 183 | Exception reportedException, int SaveCount, int FilterCount) |
180 | { | 184 | { |
181 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; | 185 | InventoryArchiveSaved handlerInventoryArchiveSaved = OnInventoryArchiveSaved; |
182 | if (handlerInventoryArchiveSaved != null) | 186 | if (handlerInventoryArchiveSaved != null) |
183 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException); | 187 | handlerInventoryArchiveSaved(id, succeeded, userInfo, invPath, saveStream, reportedException, SaveCount , FilterCount); |
188 | } | ||
189 | |||
190 | /// <summary> | ||
191 | /// Trigger the inventory archive loaded event. | ||
192 | /// </summary> | ||
193 | protected internal void TriggerInventoryArchiveLoaded( | ||
194 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, | ||
195 | Exception reportedException, int LoadCount) | ||
196 | { | ||
197 | InventoryArchiveLoaded handlerInventoryArchiveLoaded = OnInventoryArchiveLoaded; | ||
198 | if (handlerInventoryArchiveLoaded != null) | ||
199 | handlerInventoryArchiveLoaded(id, succeeded, userInfo, invPath, loadStream, reportedException, LoadCount); | ||
184 | } | 200 | } |
185 | 201 | ||
186 | public bool ArchiveInventory( | 202 | public bool ArchiveInventory( |
187 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream) | 203 | UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream) |
188 | { | 204 | { |
189 | return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); | 205 | return ArchiveInventory(id, firstName, lastName, invPath, pass, saveStream, new Dictionary<string, object>()); |
190 | } | 206 | } |
191 | 207 | ||
192 | public bool ArchiveInventory( | 208 | public bool ArchiveInventory( |
193 | Guid id, string firstName, string lastName, string invPath, string pass, Stream saveStream, | 209 | UUID id, string firstName, string lastName, string invPath, string pass, Stream saveStream, |
194 | Dictionary<string, object> options) | 210 | Dictionary<string, object> options) |
195 | { | 211 | { |
196 | if (m_scenes.Count > 0) | 212 | if (m_scenes.Count > 0) |
@@ -230,7 +246,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
230 | } | 246 | } |
231 | 247 | ||
232 | public bool ArchiveInventory( | 248 | public bool ArchiveInventory( |
233 | Guid id, string firstName, string lastName, string invPath, string pass, string savePath, | 249 | UUID id, string firstName, string lastName, string invPath, string pass, string savePath, |
234 | Dictionary<string, object> options) | 250 | Dictionary<string, object> options) |
235 | { | 251 | { |
236 | // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) | 252 | // if (!ConsoleUtil.CheckFileDoesNotExist(MainConsole.Instance, savePath)) |
@@ -272,13 +288,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
272 | return false; | 288 | return false; |
273 | } | 289 | } |
274 | 290 | ||
275 | public bool DearchiveInventory(string firstName, string lastName, string invPath, string pass, Stream loadStream) | 291 | public bool DearchiveInventory(UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream) |
276 | { | 292 | { |
277 | return DearchiveInventory(firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); | 293 | return DearchiveInventory(id, firstName, lastName, invPath, pass, loadStream, new Dictionary<string, object>()); |
278 | } | 294 | } |
279 | 295 | ||
280 | public bool DearchiveInventory( | 296 | public bool DearchiveInventory( |
281 | string firstName, string lastName, string invPath, string pass, Stream loadStream, | 297 | UUID id, string firstName, string lastName, string invPath, string pass, Stream loadStream, |
282 | Dictionary<string, object> options) | 298 | Dictionary<string, object> options) |
283 | { | 299 | { |
284 | if (m_scenes.Count > 0) | 300 | if (m_scenes.Count > 0) |
@@ -294,7 +310,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
294 | 310 | ||
295 | try | 311 | try |
296 | { | 312 | { |
297 | request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); | 313 | request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadStream, merge); |
298 | } | 314 | } |
299 | catch (EntryPointNotFoundException e) | 315 | catch (EntryPointNotFoundException e) |
300 | { | 316 | { |
@@ -326,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
326 | } | 342 | } |
327 | 343 | ||
328 | public bool DearchiveInventory( | 344 | public bool DearchiveInventory( |
329 | string firstName, string lastName, string invPath, string pass, string loadPath, | 345 | UUID id, string firstName, string lastName, string invPath, string pass, string loadPath, |
330 | Dictionary<string, object> options) | 346 | Dictionary<string, object> options) |
331 | { | 347 | { |
332 | if (m_scenes.Count > 0) | 348 | if (m_scenes.Count > 0) |
@@ -342,7 +358,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
342 | 358 | ||
343 | try | 359 | try |
344 | { | 360 | { |
345 | request = new InventoryArchiveReadRequest(m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); | 361 | request = new InventoryArchiveReadRequest(id, this, m_aScene.InventoryService, m_aScene.AssetService, m_aScene.UserAccountService, userInfo, invPath, loadPath, merge); |
346 | } | 362 | } |
347 | catch (EntryPointNotFoundException e) | 363 | catch (EntryPointNotFoundException e) |
348 | { | 364 | { |
@@ -378,6 +394,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
378 | { | 394 | { |
379 | try | 395 | try |
380 | { | 396 | { |
397 | UUID id = UUID.Random(); | ||
398 | |||
381 | Dictionary<string, object> options = new Dictionary<string, object>(); | 399 | Dictionary<string, object> options = new Dictionary<string, object>(); |
382 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); | 400 | OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); |
383 | 401 | ||
@@ -400,10 +418,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
400 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", | 418 | "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", |
401 | loadPath, invPath, firstName, lastName); | 419 | loadPath, invPath, firstName, lastName); |
402 | 420 | ||
403 | if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options)) | 421 | lock (m_pendingConsoleTasks) |
404 | m_log.InfoFormat( | 422 | m_pendingConsoleTasks.Add(id); |
405 | "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", | 423 | |
406 | loadPath, firstName, lastName); | 424 | DearchiveInventory(id, firstName, lastName, invPath, pass, loadPath, options); |
407 | } | 425 | } |
408 | catch (InventoryArchiverException e) | 426 | catch (InventoryArchiverException e) |
409 | { | 427 | { |
@@ -417,7 +435,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
417 | /// <param name="cmdparams"></param> | 435 | /// <param name="cmdparams"></param> |
418 | protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) | 436 | protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) |
419 | { | 437 | { |
420 | Guid id = Guid.NewGuid(); | 438 | UUID id = UUID.Random(); |
421 | 439 | ||
422 | Dictionary<string, object> options = new Dictionary<string, object>(); | 440 | Dictionary<string, object> options = new Dictionary<string, object>(); |
423 | 441 | ||
@@ -439,6 +457,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
439 | options["excludefolders"] = new List<String>(); | 457 | options["excludefolders"] = new List<String>(); |
440 | ((List<String>)options["excludefolders"]).Add(v); | 458 | ((List<String>)options["excludefolders"]).Add(v); |
441 | }); | 459 | }); |
460 | ops.Add("perm=", delegate(string v) { options["checkPermissions"] = v; }); | ||
442 | 461 | ||
443 | List<string> mainParams = ops.Parse(cmdparams); | 462 | List<string> mainParams = ops.Parse(cmdparams); |
444 | 463 | ||
@@ -464,8 +483,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
464 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", | 483 | "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}", |
465 | savePath, invPath, firstName, lastName); | 484 | savePath, invPath, firstName, lastName); |
466 | 485 | ||
467 | lock (m_pendingConsoleSaves) | 486 | lock (m_pendingConsoleTasks) |
468 | m_pendingConsoleSaves.Add(id); | 487 | m_pendingConsoleTasks.Add(id); |
469 | 488 | ||
470 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); | 489 | ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, options); |
471 | } | 490 | } |
@@ -476,20 +495,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
476 | } | 495 | } |
477 | 496 | ||
478 | private void SaveInvConsoleCommandCompleted( | 497 | private void SaveInvConsoleCommandCompleted( |
479 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 498 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
480 | Exception reportedException) | 499 | Exception reportedException, int SaveCount, int FilterCount) |
481 | { | 500 | { |
482 | lock (m_pendingConsoleSaves) | 501 | lock (m_pendingConsoleTasks) |
483 | { | 502 | { |
484 | if (m_pendingConsoleSaves.Contains(id)) | 503 | if (m_pendingConsoleTasks.Contains(id)) |
485 | m_pendingConsoleSaves.Remove(id); | 504 | m_pendingConsoleTasks.Remove(id); |
486 | else | 505 | else |
487 | return; | 506 | return; |
488 | } | 507 | } |
489 | 508 | ||
490 | if (succeeded) | 509 | if (succeeded) |
491 | { | 510 | { |
492 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive for {0} {1}", userInfo.FirstName, userInfo.LastName); | 511 | // Report success and include item count and filter count (Skipped items due to --perm or --exclude switches) |
512 | if(FilterCount == 0) | ||
513 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}", SaveCount, userInfo.FirstName, userInfo.LastName); | ||
514 | else | ||
515 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Saved archive with {0} items for {1} {2}. Skipped {3} items due to exclude and/or perm switches", SaveCount, userInfo.FirstName, userInfo.LastName, FilterCount); | ||
493 | } | 516 | } |
494 | else | 517 | else |
495 | { | 518 | { |
@@ -499,6 +522,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
499 | } | 522 | } |
500 | } | 523 | } |
501 | 524 | ||
525 | private void LoadInvConsoleCommandCompleted( | ||
526 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream loadStream, | ||
527 | Exception reportedException, int LoadCount) | ||
528 | { | ||
529 | lock (m_pendingConsoleTasks) | ||
530 | { | ||
531 | if (m_pendingConsoleTasks.Contains(id)) | ||
532 | m_pendingConsoleTasks.Remove(id); | ||
533 | else | ||
534 | return; | ||
535 | } | ||
536 | |||
537 | if (succeeded) | ||
538 | { | ||
539 | m_log.InfoFormat("[INVENTORY ARCHIVER]: Loaded {0} items from archive {1} for {2} {3}", LoadCount, invPath, userInfo.FirstName, userInfo.LastName); | ||
540 | } | ||
541 | else | ||
542 | { | ||
543 | m_log.ErrorFormat( | ||
544 | "[INVENTORY ARCHIVER]: Archive load for {0} {1} failed - {2}", | ||
545 | userInfo.FirstName, userInfo.LastName, reportedException.Message); | ||
546 | } | ||
547 | } | ||
548 | |||
502 | /// <summary> | 549 | /// <summary> |
503 | /// Get user information for the given name. | 550 | /// Get user information for the given name. |
504 | /// </summary> | 551 | /// </summary> |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs index 08f199a..84f9f3f 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadPathTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
49 | { | 48 | { |
@@ -69,8 +68,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
69 | 68 | ||
70 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); | 69 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "meowfood"); |
71 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); | 70 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaLL1, "hampshire"); |
72 | 71 | ||
73 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); | 72 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "meowfood", m_iarStream); |
74 | InventoryItemBase foundItem1 | 73 | InventoryItemBase foundItem1 |
75 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 74 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
76 | 75 | ||
@@ -79,7 +78,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
79 | // Now try loading to a root child folder | 78 | // Now try loading to a root child folder |
80 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); | 79 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xA", false); |
81 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); | 80 | MemoryStream archiveReadStream = new MemoryStream(m_iarStream.ToArray()); |
82 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); | 81 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xA", "meowfood", archiveReadStream); |
83 | 82 | ||
84 | InventoryItemBase foundItem2 | 83 | InventoryItemBase foundItem2 |
85 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name); | 84 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xA/" + m_item1Name); |
@@ -88,7 +87,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
88 | // Now try loading to a more deeply nested folder | 87 | // Now try loading to a more deeply nested folder |
89 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false); | 88 | UserInventoryHelpers.CreateInventoryFolder(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC", false); |
90 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); | 89 | archiveReadStream = new MemoryStream(archiveReadStream.ToArray()); |
91 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); | 90 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "xB/xC", "meowfood", archiveReadStream); |
92 | 91 | ||
93 | InventoryItemBase foundItem3 | 92 | InventoryItemBase foundItem3 |
94 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); | 93 | = InventoryArchiveUtils.FindItemByPath(scene.InventoryService, m_uaMT.PrincipalID, "xB/xC/" + m_item1Name); |
@@ -110,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
110 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); | 109 | SceneHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); |
111 | 110 | ||
112 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); | 111 | UserAccountHelpers.CreateUserWithInventory(scene, m_uaMT, "password"); |
113 | archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); | 112 | archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/Objects", "password", m_iarStream); |
114 | 113 | ||
115 | InventoryItemBase foundItem1 | 114 | InventoryItemBase foundItem1 |
116 | = InventoryArchiveUtils.FindItemByPath( | 115 | = InventoryArchiveUtils.FindItemByPath( |
@@ -180,13 +179,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
180 | 179 | ||
181 | mre.Reset(); | 180 | mre.Reset(); |
182 | archiverModule.ArchiveInventory( | 181 | archiverModule.ArchiveInventory( |
183 | Guid.NewGuid(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); | 182 | UUID.Random(), userFirstName, userLastName, "Objects", userPassword, archiveWriteStream); |
184 | mre.WaitOne(60000, false); | 183 | mre.WaitOne(60000, false); |
185 | 184 | ||
186 | // LOAD ITEM | 185 | // LOAD ITEM |
187 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); | 186 | MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray()); |
188 | 187 | ||
189 | archiverModule.DearchiveInventory(userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); | 188 | archiverModule.DearchiveInventory(UUID.Random(), userFirstName, userLastName, "Scripts", userPassword, archiveReadStream); |
190 | 189 | ||
191 | InventoryItemBase foundItem1 | 190 | InventoryItemBase foundItem1 |
192 | = InventoryArchiveUtils.FindItemByPath( | 191 | = InventoryArchiveUtils.FindItemByPath( |
@@ -229,7 +228,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
229 | 228 | ||
230 | { | 229 | { |
231 | // Test replication of path1 | 230 | // Test replication of path1 |
232 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 231 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
233 | .ReplicateArchivePathToUserInventory( | 232 | .ReplicateArchivePathToUserInventory( |
234 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 233 | iarPath1, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
235 | foldersCreated, nodesLoaded); | 234 | foldersCreated, nodesLoaded); |
@@ -246,7 +245,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
246 | 245 | ||
247 | { | 246 | { |
248 | // Test replication of path2 | 247 | // Test replication of path2 |
249 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 248 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
250 | .ReplicateArchivePathToUserInventory( | 249 | .ReplicateArchivePathToUserInventory( |
251 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 250 | iarPath2, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
252 | foldersCreated, nodesLoaded); | 251 | foldersCreated, nodesLoaded); |
@@ -292,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
292 | 291 | ||
293 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 292 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
294 | 293 | ||
295 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) | 294 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, null, (Stream)null, false) |
296 | .ReplicateArchivePathToUserInventory( | 295 | .ReplicateArchivePathToUserInventory( |
297 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 296 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
298 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 297 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
@@ -343,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
343 | 342 | ||
344 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); | 343 | string itemArchivePath = string.Join("", new string[] { folder1ArchiveName, folder2ArchiveName }); |
345 | 344 | ||
346 | new InventoryArchiveReadRequest(scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) | 345 | new InventoryArchiveReadRequest(UUID.Random(), null, scene.InventoryService, scene.AssetService, scene.UserAccountService, ua1, folder1ExistingName, (Stream)null, true) |
347 | .ReplicateArchivePathToUserInventory( | 346 | .ReplicateArchivePathToUserInventory( |
348 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), | 347 | itemArchivePath, scene.InventoryService.GetRootFolder(ua1.PrincipalID), |
349 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); | 348 | new Dictionary<string, InventoryFolderBase>(), new HashSet<InventoryNodeBase>()); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs index 1b521fc..d5f3a22 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveLoadTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
49 | { | 48 | { |
@@ -72,7 +71,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
72 | // TestHelpers.EnableLogging(); | 71 | // TestHelpers.EnableLogging(); |
73 | 72 | ||
74 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); | 73 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "password"); |
75 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); | 74 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "password", m_iarStream); |
76 | 75 | ||
77 | InventoryItemBase coaItem | 76 | InventoryItemBase coaItem |
78 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); | 77 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_coaItemName); |
@@ -106,8 +105,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
106 | // log4net.Config.XmlConfigurator.Configure(); | 105 | // log4net.Config.XmlConfigurator.Configure(); |
107 | 106 | ||
108 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); | 107 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaLL1, "meowfood"); |
109 | 108 | ||
110 | m_archiverModule.DearchiveInventory(m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); | 109 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/", "meowfood", m_iarStream); |
111 | InventoryItemBase foundItem1 | 110 | InventoryItemBase foundItem1 |
112 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); | 111 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaLL1.PrincipalID, m_item1Name); |
113 | 112 | ||
@@ -171,7 +170,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
171 | // log4net.Config.XmlConfigurator.Configure(); | 170 | // log4net.Config.XmlConfigurator.Configure(); |
172 | 171 | ||
173 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); | 172 | UserAccountHelpers.CreateUserWithInventory(m_scene, m_uaMT, "password"); |
174 | m_archiverModule.DearchiveInventory(m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); | 173 | m_archiverModule.DearchiveInventory(UUID.Random(), m_uaMT.FirstName, m_uaMT.LastName, "/", "password", m_iarStream); |
175 | 174 | ||
176 | InventoryItemBase foundItem1 | 175 | InventoryItemBase foundItem1 |
177 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); | 176 | = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, m_uaMT.PrincipalID, m_item1Name); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs index b85739e..b614c18 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveSaveTests.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
49 | { | 48 | { |
@@ -85,8 +84,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
85 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); | 84 | byte[] data = tar.ReadEntry(out filePath, out tarEntryType); |
86 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); | 85 | Assert.That(filePath, Is.EqualTo(ArchiveConstants.CONTROL_FILE_PATH)); |
87 | 86 | ||
88 | InventoryArchiveReadRequest iarr | 87 | InventoryArchiveReadRequest iarr |
89 | = new InventoryArchiveReadRequest(null, null, null, null, null, (Stream)null, false); | 88 | = new InventoryArchiveReadRequest(UUID.Random(), null, null, null, null, null, null, (Stream)null, false); |
90 | iarr.LoadControlFile(filePath, data); | 89 | iarr.LoadControlFile(filePath, data); |
91 | 90 | ||
92 | Assert.That(iarr.ControlFileLoaded, Is.True); | 91 | Assert.That(iarr.ControlFileLoaded, Is.True); |
@@ -110,7 +109,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
110 | 109 | ||
111 | mre.Reset(); | 110 | mre.Reset(); |
112 | m_archiverModule.ArchiveInventory( | 111 | m_archiverModule.ArchiveInventory( |
113 | Guid.NewGuid(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); | 112 | UUID.Random(), userFirstName, userLastName, "/", userPassword, archiveWriteStream); |
114 | mre.WaitOne(60000, false); | 113 | mre.WaitOne(60000, false); |
115 | 114 | ||
116 | // Test created iar | 115 | // Test created iar |
@@ -179,7 +178,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
179 | 178 | ||
180 | mre.Reset(); | 179 | mre.Reset(); |
181 | m_archiverModule.ArchiveInventory( | 180 | m_archiverModule.ArchiveInventory( |
182 | Guid.NewGuid(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); | 181 | UUID.Random(), userFirstName, userLastName, "f1", userPassword, archiveWriteStream); |
183 | mre.WaitOne(60000, false); | 182 | mre.WaitOne(60000, false); |
184 | 183 | ||
185 | // Test created iar | 184 | // Test created iar |
@@ -267,7 +266,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
267 | 266 | ||
268 | mre.Reset(); | 267 | mre.Reset(); |
269 | m_archiverModule.ArchiveInventory( | 268 | m_archiverModule.ArchiveInventory( |
270 | Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); | 269 | UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream); |
271 | mre.WaitOne(60000, false); | 270 | mre.WaitOne(60000, false); |
272 | 271 | ||
273 | byte[] archive = archiveWriteStream.ToArray(); | 272 | byte[] archive = archiveWriteStream.ToArray(); |
@@ -364,7 +363,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
364 | 363 | ||
365 | // When we're not saving assets, archiving is being done synchronously. | 364 | // When we're not saving assets, archiving is being done synchronously. |
366 | m_archiverModule.ArchiveInventory( | 365 | m_archiverModule.ArchiveInventory( |
367 | Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options); | 366 | UUID.Random(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream, options); |
368 | 367 | ||
369 | byte[] archive = archiveWriteStream.ToArray(); | 368 | byte[] archive = archiveWriteStream.ToArray(); |
370 | MemoryStream archiveReadStream = new MemoryStream(archive); | 369 | MemoryStream archiveReadStream = new MemoryStream(archive); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs index db78da9..4b015d7 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiveTestCase.cs | |||
@@ -43,7 +43,6 @@ using OpenSim.Region.Framework.Scenes; | |||
43 | using OpenSim.Region.Framework.Scenes.Serialization; | 43 | using OpenSim.Region.Framework.Scenes.Serialization; |
44 | using OpenSim.Services.Interfaces; | 44 | using OpenSim.Services.Interfaces; |
45 | using OpenSim.Tests.Common; | 45 | using OpenSim.Tests.Common; |
46 | using OpenSim.Tests.Common.Mock; | ||
47 | 46 | ||
48 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | 47 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests |
49 | { | 48 | { |
@@ -163,14 +162,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
163 | scene.AddInventoryItem(coaItem); | 162 | scene.AddInventoryItem(coaItem); |
164 | 163 | ||
165 | archiverModule.ArchiveInventory( | 164 | archiverModule.ArchiveInventory( |
166 | Guid.NewGuid(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); | 165 | UUID.Random(), m_uaLL1.FirstName, m_uaLL1.LastName, "/*", "hampshire", archiveWriteStream); |
167 | 166 | ||
168 | m_iarStreamBytes = archiveWriteStream.ToArray(); | 167 | m_iarStreamBytes = archiveWriteStream.ToArray(); |
169 | } | 168 | } |
170 | 169 | ||
171 | protected void SaveCompleted( | 170 | protected void SaveCompleted( |
172 | Guid id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, | 171 | UUID id, bool succeeded, UserAccount userInfo, string invPath, Stream saveStream, |
173 | Exception reportedException) | 172 | Exception reportedException, int SaveCount, int FilterCount) |
174 | { | 173 | { |
175 | mre.Set(); | 174 | mre.Set(); |
176 | } | 175 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 3815c71..18e18a9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -180,8 +180,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", | 180 | "[INVENTORY TRANSFER]: Inserting original folder {0} into agent {1}'s inventory", |
181 | folderID, new UUID(im.toAgentID)); | 181 | folderID, new UUID(im.toAgentID)); |
182 | 182 | ||
183 | <<<<<<< HEAD | ||
184 | InventoryFolderBase folderCopy | ||
185 | = scene.GiveInventoryFolder(client, receipientID, client.AgentId, folderID, UUID.Zero); | ||
186 | ======= | ||
183 | InventoryFolderBase folderCopy | 187 | InventoryFolderBase folderCopy |
184 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); | 188 | = scene.GiveInventoryFolder(recipientID, client.AgentId, folderID, UUID.Zero); |
189 | >>>>>>> avn/ubitvar | ||
185 | 190 | ||
186 | if (folderCopy == null) | 191 | if (folderCopy == null) |
187 | { | 192 | { |
@@ -217,13 +222,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
217 | "into agent {1}'s inventory", | 222 | "into agent {1}'s inventory", |
218 | itemID, new UUID(im.toAgentID)); | 223 | itemID, new UUID(im.toAgentID)); |
219 | 224 | ||
220 | InventoryItemBase itemCopy = scene.GiveInventoryItem( | 225 | string message; |
221 | new UUID(im.toAgentID), | 226 | InventoryItemBase itemCopy = scene.GiveInventoryItem(new UUID(im.toAgentID), client.AgentId, itemID, out message); |
222 | client.AgentId, itemID); | ||
223 | 227 | ||
224 | if (itemCopy == null) | 228 | if (itemCopy == null) |
225 | { | 229 | { |
226 | client.SendAgentAlertMessage("Can't find item to give. Nothing given.", false); | 230 | client.SendAgentAlertMessage(message, false); |
227 | return; | 231 | return; |
228 | } | 232 | } |
229 | 233 | ||
@@ -389,7 +393,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
389 | IInventoryService invService = scene.InventoryService; | 393 | IInventoryService invService = scene.InventoryService; |
390 | 394 | ||
391 | InventoryFolderBase trashFolder = | 395 | InventoryFolderBase trashFolder = |
392 | invService.GetFolderForType(client.AgentId, AssetType.TrashFolder); | 396 | invService.GetFolderForType(client.AgentId, FolderType.Trash); |
393 | 397 | ||
394 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip | 398 | UUID inventoryID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip |
395 | 399 | ||
@@ -471,6 +475,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
471 | /// <param name="im"></param> | 475 | /// <param name="im"></param> |
472 | private void OnGridInstantMessage(GridInstantMessage im) | 476 | private void OnGridInstantMessage(GridInstantMessage im) |
473 | { | 477 | { |
478 | <<<<<<< HEAD | ||
479 | // Check if it's a type of message that we should handle | ||
480 | if (!((im.dialog == (byte) InstantMessageDialog.InventoryOffered) | ||
481 | || (im.dialog == (byte) InstantMessageDialog.TaskInventoryOffered) | ||
482 | || (im.dialog == (byte) InstantMessageDialog.InventoryAccepted) | ||
483 | || (im.dialog == (byte) InstantMessageDialog.InventoryDeclined) | ||
484 | || (im.dialog == (byte) InstantMessageDialog.TaskInventoryDeclined))) | ||
485 | return; | ||
486 | |||
487 | m_log.DebugFormat( | ||
488 | "[INVENTORY TRANSFER]: {0} IM type received from grid. From={1} ({2}), To={3}", | ||
489 | (InstantMessageDialog)im.dialog, im.fromAgentID, im.fromAgentName, im.toAgentID); | ||
490 | |||
491 | ======= | ||
492 | >>>>>>> avn/ubitvar | ||
474 | // Check if this is ours to handle | 493 | // Check if this is ours to handle |
475 | // | 494 | // |
476 | Scene scene = FindClientScene(new UUID(im.toAgentID)); | 495 | Scene scene = FindClientScene(new UUID(im.toAgentID)); |
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs index 162a0c3..7ddc396 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/Tests/InventoryTransferModuleTests.cs | |||
@@ -39,7 +39,6 @@ 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; |
41 | using OpenSim.Tests.Common; | 41 | using OpenSim.Tests.Common; |
42 | using OpenSim.Tests.Common.Mock; | ||
43 | 42 | ||
44 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | 43 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests |
45 | { | 44 | { |
@@ -237,8 +236,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
237 | InventoryItemBase receivedItem | 236 | InventoryItemBase receivedItem |
238 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); | 237 | = UserInventoryHelpers.GetInventoryItem(m_scene.InventoryService, receiverSp.UUID, "Trash/givenObj"); |
239 | 238 | ||
240 | InventoryFolderBase trashFolder | 239 | InventoryFolderBase trashFolder |
241 | = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); | 240 | = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash); |
242 | 241 | ||
243 | Assert.That(receivedItem, Is.Not.Null); | 242 | Assert.That(receivedItem, Is.Not.Null); |
244 | Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID)); | 243 | Assert.That(receivedItem.ID, Is.Not.EqualTo(originalItem.ID)); |
@@ -430,8 +429,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer.Tests | |||
430 | InventoryFolderBase receivedFolder | 429 | InventoryFolderBase receivedFolder |
431 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); | 430 | = UserInventoryHelpers.GetInventoryFolder(m_scene.InventoryService, receiverSp.UUID, "Trash/f1"); |
432 | 431 | ||
433 | InventoryFolderBase trashFolder | 432 | InventoryFolderBase trashFolder |
434 | = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, AssetType.TrashFolder); | 433 | = m_scene.InventoryService.GetFolderForType(receiverSp.UUID, FolderType.Trash); |
435 | 434 | ||
436 | Assert.That(receivedFolder, Is.Not.Null); | 435 | Assert.That(receivedFolder, Is.Not.Null); |
437 | Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID)); | 436 | Assert.That(receivedFolder.ID, Is.Not.EqualTo(originalFolder.ID)); |