aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs8
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs113
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs98
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs9
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs139
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs40
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs111
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs125
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs2
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs126
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs3
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs46
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs2
17 files changed, 577 insertions, 283 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index d30e954..3d6e7f3 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -182,7 +182,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
182 182
183 if (part.Inventory.UpdateInventoryItem(item)) 183 if (part.Inventory.UpdateInventoryItem(item))
184 { 184 {
185 remoteClient.SendAgentAlertMessage("Notecard saved", false); 185 if ((InventoryType)item.InvType == InventoryType.Notecard)
186 remoteClient.SendAgentAlertMessage("Notecard saved", false);
187 else if ((InventoryType)item.InvType == InventoryType.LSL)
188 remoteClient.SendAgentAlertMessage("Script saved", false);
189 else
190 remoteClient.SendAgentAlertMessage("Item saved", false);
191
186 part.GetProperties(remoteClient); 192 part.GetProperties(remoteClient);
187 } 193 }
188 } 194 }
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
index 7e08ecf..ae31050 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs
@@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
243 243
244 if (mm != null) 244 if (mm != null)
245 { 245 {
246 if (!mm.UploadCovered(remoteClient)) 246 if (!mm.UploadCovered(remoteClient, mm.UploadCharge))
247 { 247 {
248 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); 248 remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false);
249 return; 249 return;
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index a7b4c66..ff3036a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -69,7 +69,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
69 get { return false; } 69 get { return false; }
70 } 70 }
71 71
72 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent) 72 // Called by client
73 //
74 public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent)
73 { 75 {
74 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject"); 76 m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
75 77
@@ -84,7 +86,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
84 return; 86 return;
85 87
86 // Calls attach with a Zero position 88 // Calls attach with a Zero position
87 if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false)) 89 if (AttachObject(remoteClient, part.ParentGroup, AttachmentPt, false))
88 { 90 {
89 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); 91 m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
90 92
@@ -106,72 +108,78 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
106 } 108 }
107 } 109 }
108 110
109 public bool AttachObject( 111 public bool AttachObject(IClientAPI remoteClient, SceneObjectGroup group, uint AttachmentPt, bool silent)
110 IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
111 { 112 {
112 SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); 113 Vector3 attachPos = group.AbsolutePosition;
113 if (group != null) 114
115 if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId))
114 { 116 {
115 if (m_scene.Permissions.CanTakeObject(group.UUID, remoteClient.AgentId)) 117 // If the attachment point isn't the same as the one previously used
118 // set it's offset position = 0 so that it appears on the attachment point
119 // and not in a weird location somewhere unknown.
120 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
116 { 121 {
117 // If the attachment point isn't the same as the one previously used 122 attachPos = Vector3.Zero;
118 // set it's offset position = 0 so that it appears on the attachment point 123 }
119 // and not in a weird location somewhere unknown.
120 if (AttachmentPt != 0 && AttachmentPt != (uint)group.GetAttachmentPoint())
121 {
122 attachPos = Vector3.Zero;
123 }
124
125 // AttachmentPt 0 means the client chose to 'wear' the attachment.
126 if (AttachmentPt == 0)
127 {
128 // Check object for stored attachment point
129 AttachmentPt = (uint)group.GetAttachmentPoint();
130 }
131 124
132 // if we still didn't find a suitable attachment point....... 125 // AttachmentPt 0 means the client chose to 'wear' the attachment.
133 if (AttachmentPt == 0) 126 if (AttachmentPt == 0)
134 { 127 {
135 // Stick it on left hand with Zero Offset from the attachment point. 128 // Check object for stored attachment point
136 AttachmentPt = (uint)AttachmentPoint.LeftHand; 129 AttachmentPt = (uint)group.GetAttachmentPoint();
137 attachPos = Vector3.Zero; 130 }
138 }
139 131
140 group.SetAttachmentPoint((byte)AttachmentPt); 132 // if we still didn't find a suitable attachment point.......
141 group.AbsolutePosition = attachPos; 133 if (AttachmentPt == 0)
134 {
135 // Stick it on left hand with Zero Offset from the attachment point.
136 AttachmentPt = (uint)AttachmentPoint.LeftHand;
137 attachPos = Vector3.Zero;
138 }
142 139
143 // Saves and gets itemID 140 group.SetAttachmentPoint((byte)AttachmentPt);
144 UUID itemId; 141 group.AbsolutePosition = attachPos;
145 142
146 if (group.GetFromItemID() == UUID.Zero) 143 // Remove any previous attachments
147 { 144 ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId);
148 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); 145 UUID itemID = UUID.Zero;
149 } 146 if (sp != null)
150 else 147 {
148 foreach(SceneObjectGroup grp in sp.Attachments)
151 { 149 {
152 itemId = group.GetFromItemID(); 150 if (grp.GetAttachmentPoint() == (byte)AttachmentPt)
151 {
152 itemID = grp.GetFromItemID();
153 break;
154 }
153 } 155 }
156 if (itemID != UUID.Zero)
157 DetachSingleAttachmentToInv(itemID, remoteClient);
158 }
154 159
155 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemId, group); 160 if (group.GetFromItemID() == UUID.Zero)
156 161 {
157 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent); 162 m_scene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemID);
158
159 // In case it is later dropped again, don't let
160 // it get cleaned up
161 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
162 group.HasGroupChanged = false;
163 } 163 }
164 else 164 else
165 { 165 {
166 remoteClient.SendAgentAlertMessage( 166 itemID = group.GetFromItemID();
167 "You don't have sufficient permissions to attach this object", false);
168
169 return false;
170 } 167 }
168
169 SetAttachmentInventoryStatus(remoteClient, AttachmentPt, itemID, group);
170
171 group.AttachToAgent(remoteClient.AgentId, AttachmentPt, attachPos, silent);
172
173 // In case it is later dropped again, don't let
174 // it get cleaned up
175 group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
176 group.HasGroupChanged = false;
171 } 177 }
172 else 178 else
173 { 179 {
174 m_log.DebugFormat("[ATTACHMENTS MODULE]: AttachObject found no such scene object {0}", objectLocalID); 180 remoteClient.SendAgentAlertMessage(
181 "You don't have sufficient permissions to attach this object", false);
182
175 return false; 183 return false;
176 } 184 }
177 185
@@ -237,8 +245,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
237 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) 245 if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
238 tainted = true; 246 tainted = true;
239 247
240 AttachObject( 248 AttachObject(remoteClient, objatt, AttachmentPt, false);
241 remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
242 //objatt.ScheduleGroupForFullUpdate(); 249 //objatt.ScheduleGroupForFullUpdate();
243 250
244 if (tainted) 251 if (tainted)
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index b5c3176..2105f3c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -81,14 +81,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
81 { 81 {
82 ScenePresence sp = m_scene.GetScenePresence(agentID); 82 ScenePresence sp = m_scene.GetScenePresence(agentID);
83 83
84 if (sp != null && !sp.IsChildAgent) 84 if (sp != null)
85 sp.ControllingClient.SendAgentAlertMessage(message, modal); 85 sp.ControllingClient.SendAgentAlertMessage(message, modal);
86 } 86 }
87 87
88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal) 88 public void SendAlertToUser(string firstName, string lastName, string message, bool modal)
89 { 89 {
90 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName); 90 ScenePresence presence = m_scene.GetScenePresence(firstName, lastName);
91 if (presence != null && !presence.IsChildAgent) 91 if (presence != null)
92 presence.ControllingClient.SendAgentAlertMessage(message, modal); 92 presence.ControllingClient.SendAgentAlertMessage(message, modal);
93 } 93 }
94 94
@@ -119,7 +119,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
119 } 119 }
120 120
121 ScenePresence sp = m_scene.GetScenePresence(avatarID); 121 ScenePresence sp = m_scene.GetScenePresence(avatarID);
122 if (sp != null && !sp.IsChildAgent) 122 if (sp != null)
123 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels); 123 sp.ControllingClient.SendDialog(objectName, objectID, ownerFirstName, ownerLastName, message, textureID, ch, buttonlabels);
124 } 124 }
125 125
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
128 { 128 {
129 ScenePresence sp = m_scene.GetScenePresence(avatarID); 129 ScenePresence sp = m_scene.GetScenePresence(avatarID);
130 130
131 if (sp != null && !sp.IsChildAgent) 131 if (sp != null)
132 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url); 132 sp.ControllingClient.SendLoadURL(objectName, objectID, ownerID, groupOwned, message, url);
133 } 133 }
134 134
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
149 149
150 ScenePresence sp = m_scene.GetScenePresence(avatarid); 150 ScenePresence sp = m_scene.GetScenePresence(avatarid);
151 151
152 if (sp != null && !sp.IsChildAgent) 152 if (sp != null)
153 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); 153 sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid);
154 } 154 }
155 155
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
index 9996074..31dfe14 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs
@@ -93,37 +93,37 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
93 /// </returns> 93 /// </returns>
94 public List<InventoryNodeBase> Execute() 94 public List<InventoryNodeBase> Execute()
95 { 95 {
96 string filePath = "ERROR";
97 int successfulAssetRestores = 0;
98 int failedAssetRestores = 0;
99 int successfulItemRestores = 0;
100
101 List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
102
103 List<InventoryFolderBase> folderCandidates
104 = InventoryArchiveUtils.FindFolderByPath(
105 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
106
107 if (folderCandidates.Count == 0)
108 {
109 // Possibly provide an option later on to automatically create this folder if it does not exist
110 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
111
112 return loadedNodes;
113 }
114
115 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
116 archive = new TarArchiveReader(m_loadStream);
117
118 // In order to load identically named folders, we need to keep track of the folders that we have already
119 // resolved
120 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
121
122 byte[] data;
123 TarArchiveReader.TarEntryType entryType;
124
125 try 96 try
126 { 97 {
98 string filePath = "ERROR";
99 int successfulAssetRestores = 0;
100 int failedAssetRestores = 0;
101 int successfulItemRestores = 0;
102
103 List<InventoryNodeBase> loadedNodes = new List<InventoryNodeBase>();
104
105 List<InventoryFolderBase> folderCandidates
106 = InventoryArchiveUtils.FindFolderByPath(
107 m_scene.InventoryService, m_userInfo.PrincipalID, m_invPath);
108
109 if (folderCandidates.Count == 0)
110 {
111 // Possibly provide an option later on to automatically create this folder if it does not exist
112 m_log.ErrorFormat("[INVENTORY ARCHIVER]: Inventory path {0} does not exist", m_invPath);
113
114 return loadedNodes;
115 }
116
117 InventoryFolderBase rootDestinationFolder = folderCandidates[0];
118 archive = new TarArchiveReader(m_loadStream);
119
120 // In order to load identically named folders, we need to keep track of the folders that we have already
121 // resolved
122 Dictionary <string, InventoryFolderBase> resolvedFolders = new Dictionary<string, InventoryFolderBase>();
123
124 byte[] data;
125 TarArchiveReader.TarEntryType entryType;
126
127 while ((data = archive.ReadEntry(out filePath, out entryType)) != null) 127 while ((data = archive.ReadEntry(out filePath, out entryType)) != null)
128 { 128 {
129 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH)) 129 if (filePath.StartsWith(ArchiveConstants.ASSETS_PATH))
@@ -166,18 +166,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
166 } 166 }
167 } 167 }
168 } 168 }
169
170 archive.Close();
171
172 m_log.DebugFormat(
173 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
174 successfulAssetRestores, failedAssetRestores);
175 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
176
177 return loadedNodes;
169 } 178 }
170 finally 179 finally
171 { 180 {
172 archive.Close(); 181 m_loadStream.Close();
173 } 182 }
174
175 m_log.DebugFormat(
176 "[INVENTORY ARCHIVER]: Successfully loaded {0} assets with {1} failures",
177 successfulAssetRestores, failedAssetRestores);
178 m_log.InfoFormat("[INVENTORY ARCHIVER]: Successfully loaded {0} items", successfulItemRestores);
179
180 return loadedNodes;
181 } 183 }
182 184
183 public void Close() 185 public void Close()
@@ -212,9 +214,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
212 214
213 InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders); 215 InventoryFolderBase destFolder = ResolveDestinationFolder(rootDestFolder, ref iarPathExisting, resolvedFolders);
214 216
215 m_log.DebugFormat( 217// m_log.DebugFormat(
216 "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]", 218// "[INVENTORY ARCHIVER]: originalArchivePath [{0}], section already loaded [{1}]",
217 iarPath, iarPathExisting); 219// iarPath, iarPathExisting);
218 220
219 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length); 221 string iarPathToCreate = iarPath.Substring(iarPathExisting.Length);
220 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes); 222 CreateFoldersForPath(destFolder, iarPathExisting, iarPathToCreate, resolvedFolders, loadedNodes);
@@ -247,7 +249,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
247 ref string archivePath, 249 ref string archivePath,
248 Dictionary <string, InventoryFolderBase> resolvedFolders) 250 Dictionary <string, InventoryFolderBase> resolvedFolders)
249 { 251 {
250 string originalArchivePath = archivePath; 252// string originalArchivePath = archivePath;
251 253
252 InventoryFolderBase destFolder = null; 254 InventoryFolderBase destFolder = null;
253 255
@@ -255,12 +257,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
255 { 257 {
256 while (null == destFolder && archivePath.Length > 0) 258 while (null == destFolder && archivePath.Length > 0)
257 { 259 {
258 m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath); 260// m_log.DebugFormat("[INVENTORY ARCHIVER]: Trying to resolve destination folder {0}", archivePath);
259 261
260 if (resolvedFolders.ContainsKey(archivePath)) 262 if (resolvedFolders.ContainsKey(archivePath))
261 { 263 {
262 m_log.DebugFormat( 264// m_log.DebugFormat(
263 "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath); 265// "[INVENTORY ARCHIVER]: Found previously created folder from archive path {0}", archivePath);
264 destFolder = resolvedFolders[archivePath]; 266 destFolder = resolvedFolders[archivePath];
265 } 267 }
266 else 268 else
@@ -275,9 +277,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
275 } 277 }
276 else 278 else
277 { 279 {
278 m_log.DebugFormat( 280// m_log.DebugFormat(
279 "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}", 281// "[INVENTORY ARCHIVER]: Found no previously created folder for archive path {0}",
280 originalArchivePath); 282// originalArchivePath);
281 archivePath = string.Empty; 283 archivePath = string.Empty;
282 destFolder = rootDestFolder; 284 destFolder = rootDestFolder;
283 } 285 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
index ca33968..84afb40 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveUtils.cs
@@ -206,11 +206,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
206 206
207 if (components.Length == 1) 207 if (components.Length == 1)
208 { 208 {
209// m_log.DebugFormat("FOUND SINGLE COMPONENT [{0}]", components[0]); 209// m_log.DebugFormat(
210// "FOUND SINGLE COMPONENT [{0}]. Looking for this in [{1}] {2}",
211// components[0], startFolder.Name, startFolder.ID);
210 212
211 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID); 213 List<InventoryItemBase> items = inventoryService.GetFolderItems(startFolder.Owner, startFolder.ID);
214
215// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Found {0} items in FindItemByPath()", items.Count);
216
212 foreach (InventoryItemBase item in items) 217 foreach (InventoryItemBase item in items)
213 { 218 {
219// m_log.DebugFormat("[INVENTORY ARCHIVE UTILS]: Inspecting item {0} {1}", item.Name, item.ID);
220
214 if (item.Name == components[0]) 221 if (item.Name == components[0])
215 return item; 222 return item;
216 } 223 }
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index 2c2724e..25a78ff 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -119,22 +119,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids) 119 protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
120 { 120 {
121 Exception reportedException = null; 121 Exception reportedException = null;
122 bool succeeded = true; 122 bool succeeded = true;
123 123
124 try 124 try
125 { 125 {
126 // We're almost done. Just need to write out the control file now 126 // We're almost done. Just need to write out the control file now
127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile()); 127 m_archiveWriter.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, Create0p1ControlFile());
128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive."); 128 m_log.InfoFormat("[ARCHIVER]: Added control file to archive.");
129
130 m_archiveWriter.Close(); 129 m_archiveWriter.Close();
131 } 130 }
132 catch (Exception e) 131 catch (Exception e)
133 { 132 {
134 m_saveStream.Close();
135 reportedException = e; 133 reportedException = e;
136 succeeded = false; 134 succeeded = false;
137 } 135 }
136 finally
137 {
138 m_saveStream.Close();
139 }
138 140
139 m_module.TriggerInventoryArchiveSaved( 141 m_module.TriggerInventoryArchiveSaved(
140 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException); 142 m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
@@ -213,70 +215,68 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
213 /// </summary> 215 /// </summary>
214 public void Execute() 216 public void Execute()
215 { 217 {
216 InventoryFolderBase inventoryFolder = null; 218 try
217 InventoryItemBase inventoryItem = null;
218 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
219
220 bool foundStar = false;
221
222 // Eliminate double slashes and any leading / on the path.
223 string[] components
224 = m_invPath.Split(
225 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
226
227 int maxComponentIndex = components.Length - 1;
228
229 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
230 // folder itself. This may get more sophisicated later on
231 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
232 {
233 foundStar = true;
234 maxComponentIndex--;
235 }
236
237 m_invPath = String.Empty;
238 for (int i = 0; i <= maxComponentIndex; i++)
239 {
240 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
241 }
242
243 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
244 // Therefore if we still start with a / after the split, then we need the root folder
245 if (m_invPath.Length == 0)
246 {
247 inventoryFolder = rootFolder;
248 }
249 else
250 {
251 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
252 List<InventoryFolderBase> candidateFolders
253 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
254 if (candidateFolders.Count > 0)
255 inventoryFolder = candidateFolders[0];
256 }
257
258 // The path may point to an item instead
259 if (inventoryFolder == null)
260 {
261 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
262 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
263 }
264
265 if (null == inventoryFolder && null == inventoryItem)
266 { 219 {
267 // We couldn't find the path indicated 220 InventoryFolderBase inventoryFolder = null;
268 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 221 InventoryItemBase inventoryItem = null;
269 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", errorMessage); 222 InventoryFolderBase rootFolder = m_scene.InventoryService.GetRootFolder(m_userInfo.PrincipalID);
270 m_module.TriggerInventoryArchiveSaved( 223
271 m_id, false, m_userInfo, m_invPath, m_saveStream, 224 bool foundStar = false;
272 new Exception(errorMessage)); 225
273 return; 226 // Eliminate double slashes and any leading / on the path.
274 } 227 string[] components
228 = m_invPath.Split(
229 new string[] { InventoryFolderImpl.PATH_DELIMITER }, StringSplitOptions.RemoveEmptyEntries);
230
231 int maxComponentIndex = components.Length - 1;
232
233 // If the path terminates with a STAR then later on we want to archive all nodes in the folder but not the
234 // folder itself. This may get more sophisicated later on
235 if (maxComponentIndex >= 0 && components[maxComponentIndex] == STAR_WILDCARD)
236 {
237 foundStar = true;
238 maxComponentIndex--;
239 }
240
241 m_invPath = String.Empty;
242 for (int i = 0; i <= maxComponentIndex; i++)
243 {
244 m_invPath += components[i] + InventoryFolderImpl.PATH_DELIMITER;
245 }
246
247 // Annoyingly Split actually returns the original string if the input string consists only of delimiters
248 // Therefore if we still start with a / after the split, then we need the root folder
249 if (m_invPath.Length == 0)
250 {
251 inventoryFolder = rootFolder;
252 }
253 else
254 {
255 m_invPath = m_invPath.Remove(m_invPath.LastIndexOf(InventoryFolderImpl.PATH_DELIMITER));
256 List<InventoryFolderBase> candidateFolders
257 = InventoryArchiveUtils.FindFolderByPath(m_scene.InventoryService, rootFolder, m_invPath);
258 if (candidateFolders.Count > 0)
259 inventoryFolder = candidateFolders[0];
260 }
261
262 // The path may point to an item instead
263 if (inventoryFolder == null)
264 {
265 inventoryItem = InventoryArchiveUtils.FindItemByPath(m_scene.InventoryService, rootFolder, m_invPath);
266 //inventoryItem = m_userInfo.RootFolder.FindItemByPath(m_invPath);
267 }
268
269 if (null == inventoryFolder && null == inventoryItem)
270 {
271 // We couldn't find the path indicated
272 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
273 Exception e = new InventoryArchiverException(errorMessage);
274 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e);
275 throw e;
276 }
275 277
276 m_archiveWriter = new TarArchiveWriter(m_saveStream); 278 m_archiveWriter = new TarArchiveWriter(m_saveStream);
277 279
278 try
279 {
280 if (inventoryFolder != null) 280 if (inventoryFolder != null)
281 { 281 {
282 m_log.DebugFormat( 282 m_log.DebugFormat(
@@ -297,16 +297,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
297 297
298 // Don't put all this profile information into the archive right now. 298 // Don't put all this profile information into the archive right now.
299 //SaveUsers(); 299 //SaveUsers();
300
301 new AssetsRequest(
302 new AssetsArchiver(m_archiveWriter), m_assetUuids, m_scene.AssetService, ReceivedAllAssets).Execute();
300 } 303 }
301 catch (Exception) 304 catch (Exception)
302 { 305 {
303 m_archiveWriter.Close(); 306 m_saveStream.Close();
304 throw; 307 throw;
305 } 308 }
306
307 new AssetsRequest(
308 new AssetsArchiver(m_archiveWriter), m_assetUuids,
309 m_scene.AssetService, ReceivedAllAssets).Execute();
310 } 309 }
311 310
312 /// <summary> 311 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
new file mode 100644
index 0000000..e07e2ca
--- /dev/null
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverException.cs
@@ -0,0 +1,40 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29
30namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
31{
32 /// <summary>
33 /// Signals an inventory archiving problem
34 /// </summary>
35 public class InventoryArchiverException : Exception
36 {
37 public InventoryArchiverException(string message) : base(message) {}
38 public InventoryArchiverException(string message, Exception e) : base(message, e) {}
39 }
40} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index cfefbe9..f7a2b09 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -322,34 +322,41 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
322 /// <param name="cmdparams"></param> 322 /// <param name="cmdparams"></param>
323 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams) 323 protected void HandleLoadInvConsoleCommand(string module, string[] cmdparams)
324 { 324 {
325 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 325 try
326 326 {
327 Dictionary<string, object> options = new Dictionary<string, object>(); 327 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
328 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; }); 328
329 329 Dictionary<string, object> options = new Dictionary<string, object>();
330 List<string> mainParams = optionSet.Parse(cmdparams); 330 OptionSet optionSet = new OptionSet().Add("m|merge", delegate (string v) { options["merge"] = v != null; });
331 331
332 if (mainParams.Count < 6) 332 List<string> mainParams = optionSet.Parse(cmdparams);
333 { 333
334 m_log.Error( 334 if (mainParams.Count < 6)
335 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]"); 335 {
336 return; 336 m_log.Error(
337 } 337 "[INVENTORY ARCHIVER]: usage is load iar <first name> <last name> <inventory path> <user password> [<load file path>]");
338 338 return;
339 string firstName = mainParams[2]; 339 }
340 string lastName = mainParams[3]; 340
341 string invPath = mainParams[4]; 341 string firstName = mainParams[2];
342 string pass = mainParams[5]; 342 string lastName = mainParams[3];
343 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME); 343 string invPath = mainParams[4];
344 344 string pass = mainParams[5];
345 m_log.InfoFormat( 345 string loadPath = (mainParams.Count > 6 ? mainParams[6] : DEFAULT_INV_BACKUP_FILENAME);
346 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}", 346
347 loadPath, invPath, firstName, lastName);
348
349 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
350 m_log.InfoFormat( 347 m_log.InfoFormat(
351 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}", 348 "[INVENTORY ARCHIVER]: Loading archive {0} to inventory path {1} for {2} {3}",
352 loadPath, firstName, lastName); 349 loadPath, invPath, firstName, lastName);
350
351 if (DearchiveInventory(firstName, lastName, invPath, pass, loadPath, options))
352 m_log.InfoFormat(
353 "[INVENTORY ARCHIVER]: Loaded archive {0} for {1} {2}",
354 loadPath, firstName, lastName);
355 }
356 catch (InventoryArchiverException e)
357 {
358 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
359 }
353 } 360 }
354 361
355 /// <summary> 362 /// <summary>
@@ -358,30 +365,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
358 /// <param name="cmdparams"></param> 365 /// <param name="cmdparams"></param>
359 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams) 366 protected void HandleSaveInvConsoleCommand(string module, string[] cmdparams)
360 { 367 {
361 if (cmdparams.Length < 6) 368 Guid id = Guid.NewGuid();
369
370 try
362 { 371 {
363 m_log.Error( 372 if (cmdparams.Length < 6)
364 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]"); 373 {
365 return; 374 m_log.Error(
375 "[INVENTORY ARCHIVER]: usage is save iar <first name> <last name> <inventory path> <user password> [<save file path>]");
376 return;
377 }
378
379 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME.");
380
381 string firstName = cmdparams[2];
382 string lastName = cmdparams[3];
383 string invPath = cmdparams[4];
384 string pass = cmdparams[5];
385 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
386
387 m_log.InfoFormat(
388 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
389 savePath, invPath, firstName, lastName);
390
391 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
366 } 392 }
367 393 catch (InventoryArchiverException e)
368 m_log.Info("[INVENTORY ARCHIVER]: PLEASE NOTE THAT THIS FACILITY IS EXPERIMENTAL. BUG REPORTS WELCOME."); 394 {
369 395 m_log.ErrorFormat("[INVENTORY ARCHIVER]: {0}", e.Message);
370 string firstName = cmdparams[2]; 396 }
371 string lastName = cmdparams[3]; 397
372 string invPath = cmdparams[4];
373 string pass = cmdparams[5];
374 string savePath = (cmdparams.Length > 6 ? cmdparams[6] : DEFAULT_INV_BACKUP_FILENAME);
375
376 m_log.InfoFormat(
377 "[INVENTORY ARCHIVER]: Saving archive {0} using inventory path {1} for {2} {3}",
378 savePath, invPath, firstName, lastName);
379
380 Guid id = Guid.NewGuid();
381 ArchiveInventory(id, firstName, lastName, invPath, pass, savePath, new Dictionary<string, object>());
382
383 lock (m_pendingConsoleSaves) 398 lock (m_pendingConsoleSaves)
384 m_pendingConsoleSaves.Add(id); 399 m_pendingConsoleSaves.Add(id);
385 } 400 }
386 401
387 private void SaveInvConsoleCommandCompleted( 402 private void SaveInvConsoleCommandCompleted(
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
index 5130fa5..4531bfd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs
@@ -63,13 +63,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
63 } 63 }
64 64
65 /// <summary> 65 /// <summary>
66 /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). 66 /// Test saving an inventory path to a V0.1 OpenSim Inventory Archive
67 /// (subject to change since there is no fixed format yet).
67 /// </summary> 68 /// </summary>
68 // Commenting for now! The mock inventory service needs more beef, at least for
69 // GetFolderForType
70 // REFACTORING PROBLEM. This needs to be rewritten.
71 [Test] 69 [Test]
72 public void TestSaveIarV0_1() 70 public void TestSavePathToIarV0_1()
73 { 71 {
74 TestHelper.InMethod(); 72 TestHelper.InMethod();
75// log4net.Config.XmlConfigurator.Configure(); 73// log4net.Config.XmlConfigurator.Configure();
@@ -182,6 +180,123 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests
182 } 180 }
183 181
184 /// <summary> 182 /// <summary>
183 /// Test saving a single inventory item to a V0.1 OpenSim Inventory Archive
184 /// (subject to change since there is no fixed format yet).
185 /// </summary>
186 [Test]
187 public void TestSaveItemToIarV0_1()
188 {
189 TestHelper.InMethod();
190// log4net.Config.XmlConfigurator.Configure();
191
192 InventoryArchiverModule archiverModule = new InventoryArchiverModule(true);
193
194 Scene scene = SceneSetupHelpers.SetupScene("Inventory");
195 SceneSetupHelpers.SetupSceneModules(scene, archiverModule);
196
197 // Create user
198 string userFirstName = "Jock";
199 string userLastName = "Stirrup";
200 string userPassword = "troll";
201 UUID userId = UUID.Parse("00000000-0000-0000-0000-000000000020");
202 UserProfileTestUtils.CreateUserWithInventory(scene, userFirstName, userLastName, userId, userPassword);
203
204 // Create asset
205 SceneObjectGroup object1;
206 SceneObjectPart part1;
207 {
208 string partName = "My Little Dog Object";
209 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000040");
210 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
211 Vector3 groupPosition = new Vector3(10, 20, 30);
212 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
213 Vector3 offsetPosition = new Vector3(5, 10, 15);
214
215 part1
216 = new SceneObjectPart(
217 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
218 part1.Name = partName;
219
220 object1 = new SceneObjectGroup(part1);
221 scene.AddNewSceneObject(object1, false);
222 }
223
224 UUID asset1Id = UUID.Parse("00000000-0000-0000-0000-000000000060");
225 AssetBase asset1 = AssetHelpers.CreateAsset(asset1Id, object1);
226 scene.AssetService.Store(asset1);
227
228 // Create item
229 UUID item1Id = UUID.Parse("00000000-0000-0000-0000-000000000080");
230 string item1Name = "My Little Dog";
231 InventoryItemBase item1 = new InventoryItemBase();
232 item1.Name = item1Name;
233 item1.AssetID = asset1.FullID;
234 item1.ID = item1Id;
235 InventoryFolderBase objsFolder
236 = InventoryArchiveUtils.FindFolderByPath(scene.InventoryService, userId, "Objects")[0];
237 item1.Folder = objsFolder.ID;
238 scene.AddInventoryItem(userId, item1);
239
240 MemoryStream archiveWriteStream = new MemoryStream();
241 archiverModule.OnInventoryArchiveSaved += SaveCompleted;
242
243 mre.Reset();
244 archiverModule.ArchiveInventory(
245 Guid.NewGuid(), userFirstName, userLastName, "Objects/" + item1Name, userPassword, archiveWriteStream);
246 mre.WaitOne(60000, false);
247
248 byte[] archive = archiveWriteStream.ToArray();
249 MemoryStream archiveReadStream = new MemoryStream(archive);
250 TarArchiveReader tar = new TarArchiveReader(archiveReadStream);
251
252 //bool gotControlFile = false;
253 bool gotObject1File = false;
254 //bool gotObject2File = false;
255 string expectedObject1FileName = InventoryArchiveWriteRequest.CreateArchiveItemName(item1);
256 string expectedObject1FilePath = string.Format(
257 "{0}{1}",
258 ArchiveConstants.INVENTORY_PATH,
259 expectedObject1FileName);
260
261 string filePath;
262 TarArchiveReader.TarEntryType tarEntryType;
263
264// Console.WriteLine("Reading archive");
265
266 while (tar.ReadEntry(out filePath, out tarEntryType) != null)
267 {
268 Console.WriteLine("Got {0}", filePath);
269
270// if (ArchiveConstants.CONTROL_FILE_PATH == filePath)
271// {
272// gotControlFile = true;
273// }
274
275 if (filePath.StartsWith(ArchiveConstants.INVENTORY_PATH) && filePath.EndsWith(".xml"))
276 {
277// string fileName = filePath.Remove(0, "Objects/".Length);
278//
279// if (fileName.StartsWith(part1.Name))
280// {
281 Assert.That(expectedObject1FilePath, Is.EqualTo(filePath));
282 gotObject1File = true;
283// }
284// else if (fileName.StartsWith(part2.Name))
285// {
286// Assert.That(fileName, Is.EqualTo(expectedObject2FileName));
287// gotObject2File = true;
288// }
289 }
290 }
291
292// Assert.That(gotControlFile, Is.True, "No control file in archive");
293 Assert.That(gotObject1File, Is.True, "No item1 file in archive");
294// Assert.That(gotObject2File, Is.True, "No object2 file in archive");
295
296 // TODO: Test presence of more files and contents of files.
297 }
298
299 /// <summary>
185 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where 300 /// Test loading a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet) where
186 /// an account exists with the creator name. 301 /// an account exists with the creator name.
187 /// </summary> 302 /// </summary>
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
index c1e92f5..b13b9d8 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs
@@ -157,6 +157,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>(); 157 Dictionary<UUID, AssetType> ids = new Dictionary<UUID, AssetType>();
158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL); 158 HGUuidGatherer uuidGatherer = new HGUuidGatherer(this, m_scene.AssetService, userAssetURL);
159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids); 159 uuidGatherer.GatherAssetUuids(asset.FullID, (AssetType)asset.Type, ids);
160 if (ids.ContainsKey(assetID))
161 ids.Remove(assetID);
160 foreach (UUID uuid in ids.Keys) 162 foreach (UUID uuid in ids.Keys)
161 FetchAsset(userAssetURL, uuid); 163 FetchAsset(userAssetURL, uuid);
162 164
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
index b0555da..8ccc941 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs
@@ -131,7 +131,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
131 return ret; 131 return ret;
132 } 132 }
133 133
134 // DO NOT OVERRIDE THIS METHOD 134 // DO NOT OVERRIDE THE BASE METHOD
135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID, 135 public virtual UUID DeleteToInventory(DeRezAction action, UUID folderID,
136 SceneObjectGroup objectGroup, IClientAPI remoteClient) 136 SceneObjectGroup objectGroup, IClientAPI remoteClient)
137 { 137 {
@@ -139,7 +139,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
139 139
140 if (!assetID.Equals(UUID.Zero)) 140 if (!assetID.Equals(UUID.Zero))
141 { 141 {
142 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0); 142 if (remoteClient != null)
143 UploadInventoryItem(remoteClient.AgentId, assetID, "", 0);
143 } 144 }
144 else 145 else
145 m_log.Debug("[HGScene]: Scene.Inventory did not create asset"); 146 m_log.Debug("[HGScene]: Scene.Inventory did not create asset");
@@ -192,9 +193,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
192 m_assMapper.Post(item.AssetID, receiver, userAssetServer); 193 m_assMapper.Post(item.AssetID, receiver, userAssetServer);
193 } 194 }
194 195
195 #endregion 196 public override bool IsForeignUser(UUID userID, out string assetServerURL)
196
197 public bool IsForeignUser(UUID userID, out string assetServerURL)
198 { 197 {
199 assetServerURL = string.Empty; 198 assetServerURL = string.Empty;
200 UserAccount account = null; 199 UserAccount account = null;
@@ -217,5 +216,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
217 216
218 return false; 217 return false;
219 } 218 }
219
220 #endregion
221
222 protected override InventoryItemBase GetItem(UUID agentID, UUID itemID)
223 {
224 InventoryItemBase item = base.GetItem(agentID, itemID);
225
226 string userAssetServer = string.Empty;
227 if (IsForeignUser(agentID, out userAssetServer))
228 m_assMapper.Get(item.AssetID, agentID, userAssetServer);
229
230 return item;
231 }
220 } 232 }
221} 233}
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 12b6aa0..1a7da61 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -322,6 +322,18 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
322 } 322 }
323 } 323 }
324 324
325 // Override and put into where it came from, if it came
326 // from anywhere in inventory
327 //
328 if (action == DeRezAction.Take || action == DeRezAction.TakeCopy)
329 {
330 if (objectGroup.RootPart.FromFolderID != UUID.Zero)
331 {
332 InventoryFolderBase f = new InventoryFolderBase(objectGroup.RootPart.FromFolderID, userID);
333 folder = m_Scene.InventoryService.GetFolder(f);
334 }
335 }
336
325 if (folder == null) // None of the above 337 if (folder == null) // None of the above
326 { 338 {
327 folder = new InventoryFolderBase(folderID); 339 folder = new InventoryFolderBase(folderID);
@@ -369,12 +381,27 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
369 if ((nextPerms & (uint)PermissionMask.Modify) == 0) 381 if ((nextPerms & (uint)PermissionMask.Modify) == 0)
370 perms &= ~(uint)PermissionMask.Modify; 382 perms &= ~(uint)PermissionMask.Modify;
371 383
384 // Make sure all bits but the ones we want are clear
385 // on take.
386 // This will be applied to the current perms, so
387 // it will do what we want.
388 objectGroup.RootPart.NextOwnerMask &=
389 ((uint)PermissionMask.Copy |
390 (uint)PermissionMask.Transfer |
391 (uint)PermissionMask.Modify);
392 objectGroup.RootPart.NextOwnerMask |=
393 (uint)PermissionMask.Move;
394
372 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask; 395 item.BasePermissions = perms & objectGroup.RootPart.NextOwnerMask;
373 item.CurrentPermissions = item.BasePermissions; 396 item.CurrentPermissions = item.BasePermissions;
374 item.NextPermissions = objectGroup.RootPart.NextOwnerMask; 397 item.NextPermissions = objectGroup.RootPart.NextOwnerMask;
375 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask; 398 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask & objectGroup.RootPart.NextOwnerMask;
376 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask; 399 item.GroupPermissions = objectGroup.RootPart.GroupMask & objectGroup.RootPart.NextOwnerMask;
377 item.CurrentPermissions |= 8; // Slam! 400
401 // Magic number badness. Maybe this deserves an enum.
402 // bit 4 (16) is the "Slam" bit, it means treat as passed
403 // and apply next owner perms on rez
404 item.CurrentPermissions |= 16; // Slam!
378 } 405 }
379 else 406 else
380 { 407 {
@@ -384,7 +411,12 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
384 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask; 411 item.EveryOnePermissions = objectGroup.RootPart.EveryoneMask;
385 item.GroupPermissions = objectGroup.RootPart.GroupMask; 412 item.GroupPermissions = objectGroup.RootPart.GroupMask;
386 413
387 item.CurrentPermissions |= 8; // Slam! 414 item.CurrentPermissions &=
415 ((uint)PermissionMask.Copy |
416 (uint)PermissionMask.Transfer |
417 (uint)PermissionMask.Modify |
418 (uint)PermissionMask.Move |
419 7); // Preserve folded permissions
388 } 420 }
389 421
390 // TODO: add the new fields (Flags, Sale info, etc) 422 // TODO: add the new fields (Flags, Sale info, etc)
@@ -485,6 +517,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
485 SceneObjectGroup group 517 SceneObjectGroup group
486 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); 518 = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData);
487 519
520 group.RootPart.FromFolderID = item.Folder;
521
522 // If it's rezzed in world, select it. Much easier to
523 // find small items.
524 //
525 if (!attachment)
526 group.RootPart.CreateSelected = true;
527
488 if (!m_Scene.Permissions.CanRezObject( 528 if (!m_Scene.Permissions.CanRezObject(
489 group.Children.Count, remoteClient.AgentId, pos) 529 group.Children.Count, remoteClient.AgentId, pos)
490 && !attachment) 530 && !attachment)
@@ -557,7 +597,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
557 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); 597 List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values);
558 598
559 group.SetGroup(remoteClient.ActiveGroupId, remoteClient); 599 group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
560 if (rootPart.OwnerID != item.Owner) 600 if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
561 { 601 {
562 //Need to kill the for sale here 602 //Need to kill the for sale here
563 rootPart.ObjectSaleType = 0; 603 rootPart.ObjectSaleType = 0;
@@ -565,14 +605,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
565 605
566 if (m_Scene.Permissions.PropagatePermissions()) 606 if (m_Scene.Permissions.PropagatePermissions())
567 { 607 {
568 if ((item.CurrentPermissions & 8) != 0) 608 foreach (SceneObjectPart part in partList)
569 { 609 {
570 foreach (SceneObjectPart part in partList) 610 part.EveryoneMask = item.EveryOnePermissions;
571 { 611 part.NextOwnerMask = item.NextPermissions;
572 part.EveryoneMask = item.EveryOnePermissions; 612 part.GroupMask = 0; // DO NOT propagate here
573 part.NextOwnerMask = item.NextPermissions;
574 part.GroupMask = 0; // DO NOT propagate here
575 }
576 } 613 }
577 614
578 group.ApplyNextOwnerPermissions(); 615 group.ApplyNextOwnerPermissions();
@@ -581,19 +618,15 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
581 618
582 foreach (SceneObjectPart part in partList) 619 foreach (SceneObjectPart part in partList)
583 { 620 {
584 if (part.OwnerID != item.Owner) 621 if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
585 { 622 {
586 part.LastOwnerID = part.OwnerID; 623 part.LastOwnerID = part.OwnerID;
587 part.OwnerID = item.Owner; 624 part.OwnerID = item.Owner;
588 part.Inventory.ChangeInventoryOwner(item.Owner); 625 part.Inventory.ChangeInventoryOwner(item.Owner);
589 }
590 else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam!
591 {
592 part.EveryoneMask = item.EveryOnePermissions;
593 part.NextOwnerMask = item.NextPermissions;
594
595 part.GroupMask = 0; // DO NOT propagate here 626 part.GroupMask = 0; // DO NOT propagate here
596 } 627 }
628 part.EveryoneMask = item.EveryOnePermissions;
629 part.NextOwnerMask = item.NextPermissions;
597 } 630 }
598 631
599 rootPart.TrimPermissions(); 632 rootPart.TrimPermissions();
@@ -639,6 +672,57 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
639 { 672 {
640 } 673 }
641 674
675 public virtual bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID)
676 {
677 InventoryItemBase assetRequestItem = GetItem(remoteClient.AgentId, itemID);
678 if (assetRequestItem == null)
679 {
680 ILibraryService lib = m_Scene.RequestModuleInterface<ILibraryService>();
681 if (lib != null)
682 assetRequestItem = lib.LibraryRootFolder.FindItem(itemID);
683 if (assetRequestItem == null)
684 return false;
685 }
686
687 // At this point, we need to apply perms
688 // only to notecards and scripts. All
689 // other asset types are always available
690 //
691 if (assetRequestItem.AssetType == (int)AssetType.LSLText)
692 {
693 if (!m_Scene.Permissions.CanViewScript(itemID, UUID.Zero, remoteClient.AgentId))
694 {
695 remoteClient.SendAgentAlertMessage("Insufficient permissions to view script", false);
696 return false;
697 }
698 }
699 else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
700 {
701 if (!m_Scene.Permissions.CanViewNotecard(itemID, UUID.Zero, remoteClient.AgentId))
702 {
703 remoteClient.SendAgentAlertMessage("Insufficient permissions to view notecard", false);
704 return false;
705 }
706 }
707
708 if (assetRequestItem.AssetID != requestID)
709 {
710 m_log.WarnFormat(
711 "[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
712 Name, requestID, itemID, assetRequestItem.AssetID);
713 return false;
714 }
715
716 return true;
717 }
718
719
720 public virtual bool IsForeignUser(UUID userID, out string assetServerURL)
721 {
722 assetServerURL = string.Empty;
723 return false;
724 }
725
642 #endregion 726 #endregion
643 727
644 #region Misc 728 #region Misc
@@ -661,6 +745,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
661 return asset; 745 return asset;
662 } 746 }
663 747
748 protected virtual InventoryItemBase GetItem(UUID agentID, UUID itemID)
749 {
750 IInventoryService invService = m_Scene.RequestModuleInterface<IInventoryService>();
751 InventoryItemBase assetRequestItem = new InventoryItemBase(itemID, agentID);
752 assetRequestItem = invService.GetItem(assetRequestItem);
753 return assetRequestItem;
754 }
755
664 #endregion 756 #endregion
665 } 757 }
666} 758}
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
index ebd6bbd..034e692 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs
@@ -41,7 +41,7 @@ using OpenMetaverse;
41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset 41namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
42{ 42{
43 public class HGAssetBroker : 43 public class HGAssetBroker :
44 ISharedRegionModule, IAssetService, IHyperAssetService 44 ISharedRegionModule, IAssetService
45 { 45 {
46 private static readonly ILog m_log = 46 private static readonly ILog m_log =
47 LogManager.GetLogger( 47 LogManager.GetLogger(
@@ -150,7 +150,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset
150 m_aScene = scene; 150 m_aScene = scene;
151 151
152 scene.RegisterModuleInterface<IAssetService>(this); 152 scene.RegisterModuleInterface<IAssetService>(this);
153 scene.RegisterModuleInterface<IHyperAssetService>(this);
154 } 153 }
155 154
156 public void RemoveRegion(Scene scene) 155 public void RemoveRegion(Scene scene)
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index e09db15..97161fc 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -202,9 +202,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
202 } 202 }
203 } 203 }
204 } 204 }
205
206 // else put a null; it means that the methods should forward to local grid's inventory
207 m_InventoryURLs.Add(userID, null);
208 } 205 }
209 206
210 private void DropInventoryServiceURL(UUID userID) 207 private void DropInventoryServiceURL(UUID userID)
@@ -223,10 +220,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
223 if (m_InventoryURLs.ContainsKey(userID)) 220 if (m_InventoryURLs.ContainsKey(userID))
224 return m_InventoryURLs[userID]; 221 return m_InventoryURLs[userID];
225 222
226 else 223 CacheInventoryServiceURL(userID);
227 CacheInventoryServiceURL(userID);
228 224
229 return m_InventoryURLs[userID]; 225 if (m_InventoryURLs.ContainsKey(userID))
226 return m_InventoryURLs[userID];
227
228 return null; //it means that the methods should forward to local grid's inventory
229
230 } 230 }
231 #endregion 231 #endregion
232 232
@@ -253,7 +253,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
253 253
254 public InventoryFolderBase GetRootFolder(UUID userID) 254 public InventoryFolderBase GetRootFolder(UUID userID)
255 { 255 {
256 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID); 256 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetRootFolder for {0}", userID);
257 257
258 string invURL = GetInventoryServiceURL(userID); 258 string invURL = GetInventoryServiceURL(userID);
259 259
@@ -267,7 +267,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
267 267
268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) 268 public InventoryFolderBase GetFolderForType(UUID userID, AssetType type)
269 { 269 {
270 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type); 270 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetFolderForType {0} type {1}", userID, type);
271 271
272 string invURL = GetInventoryServiceURL(userID); 272 string invURL = GetInventoryServiceURL(userID);
273 273
@@ -281,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
281 281
282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID) 282 public InventoryCollection GetFolderContent(UUID userID, UUID folderID)
283 { 283 {
284 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID); 284 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderContent " + folderID);
285 285
286 string invURL = GetInventoryServiceURL(userID); 286 string invURL = GetInventoryServiceURL(userID);
287 287
@@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
296 296
297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) 297 public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID)
298 { 298 {
299 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID); 299 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolderItems " + folderID);
300 300
301 string invURL = GetInventoryServiceURL(userID); 301 string invURL = GetInventoryServiceURL(userID);
302 302
@@ -314,7 +314,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
314 if (folder == null) 314 if (folder == null)
315 return false; 315 return false;
316 316
317 m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID); 317 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddFolder " + folder.ID);
318 318
319 string invURL = GetInventoryServiceURL(folder.Owner); 319 string invURL = GetInventoryServiceURL(folder.Owner);
320 320
@@ -331,7 +331,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
331 if (folder == null) 331 if (folder == null)
332 return false; 332 return false;
333 333
334 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID); 334 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateFolder " + folder.ID);
335 335
336 string invURL = GetInventoryServiceURL(folder.Owner); 336 string invURL = GetInventoryServiceURL(folder.Owner);
337 337
@@ -350,7 +350,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
350 if (folderIDs.Count == 0) 350 if (folderIDs.Count == 0)
351 return false; 351 return false;
352 352
353 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID); 353 //m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteFolders for " + ownerID);
354 354
355 string invURL = GetInventoryServiceURL(ownerID); 355 string invURL = GetInventoryServiceURL(ownerID);
356 356
@@ -367,7 +367,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
367 if (folder == null) 367 if (folder == null)
368 return false; 368 return false;
369 369
370 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner); 370 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveFolder for " + folder.Owner);
371 371
372 string invURL = GetInventoryServiceURL(folder.Owner); 372 string invURL = GetInventoryServiceURL(folder.Owner);
373 373
@@ -384,7 +384,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
384 if (folder == null) 384 if (folder == null)
385 return false; 385 return false;
386 386
387 m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner); 387 //m_log.Debug("[HG INVENTORY CONNECTOR]: PurgeFolder for " + folder.Owner);
388 388
389 string invURL = GetInventoryServiceURL(folder.Owner); 389 string invURL = GetInventoryServiceURL(folder.Owner);
390 390
@@ -401,7 +401,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
401 if (item == null) 401 if (item == null)
402 return false; 402 return false;
403 403
404 m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID); 404 //m_log.Debug("[HG INVENTORY CONNECTOR]: AddItem " + item.ID);
405 405
406 string invURL = GetInventoryServiceURL(item.Owner); 406 string invURL = GetInventoryServiceURL(item.Owner);
407 407
@@ -418,7 +418,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
418 if (item == null) 418 if (item == null)
419 return false; 419 return false;
420 420
421 m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID); 421 //m_log.Debug("[HG INVENTORY CONNECTOR]: UpdateItem " + item.ID);
422 422
423 string invURL = GetInventoryServiceURL(item.Owner); 423 string invURL = GetInventoryServiceURL(item.Owner);
424 424
@@ -437,7 +437,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
437 if (items.Count == 0) 437 if (items.Count == 0)
438 return true; 438 return true;
439 439
440 m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID); 440 //m_log.Debug("[HG INVENTORY CONNECTOR]: MoveItems for " + ownerID);
441 441
442 string invURL = GetInventoryServiceURL(ownerID); 442 string invURL = GetInventoryServiceURL(ownerID);
443 443
@@ -451,15 +451,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
451 451
452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 452 public bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
453 { 453 {
454 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); 454 //m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
455 455
456 if (itemIDs == null) 456 if (itemIDs == null)
457 return false; 457 return false;
458 if (itemIDs.Count == 0) 458 if (itemIDs.Count == 0)
459 return true; 459 return true;
460 460
461 m_log.Debug("[HG INVENTORY CONNECTOR]: DeleteItems for " + ownerID);
462
463 string invURL = GetInventoryServiceURL(ownerID); 461 string invURL = GetInventoryServiceURL(ownerID);
464 462
465 if (invURL == null) // not there, forward to local inventory connector to resolve 463 if (invURL == null) // not there, forward to local inventory connector to resolve
@@ -474,7 +472,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
474 { 472 {
475 if (item == null) 473 if (item == null)
476 return null; 474 return null;
477 m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID); 475 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetItem " + item.ID);
478 476
479 string invURL = GetInventoryServiceURL(item.Owner); 477 string invURL = GetInventoryServiceURL(item.Owner);
480 478
@@ -491,7 +489,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
491 if (folder == null) 489 if (folder == null)
492 return null; 490 return null;
493 491
494 m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID); 492 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetFolder " + folder.ID);
495 493
496 string invURL = GetInventoryServiceURL(folder.Owner); 494 string invURL = GetInventoryServiceURL(folder.Owner);
497 495
@@ -515,7 +513,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
515 513
516 public int GetAssetPermissions(UUID userID, UUID assetID) 514 public int GetAssetPermissions(UUID userID, UUID assetID)
517 { 515 {
518 m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID); 516 //m_log.Debug("[HG INVENTORY CONNECTOR]: GetAssetPermissions " + assetID);
519 517
520 string invURL = GetInventoryServiceURL(userID); 518 string invURL = GetInventoryServiceURL(userID);
521 519
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
index 3945142..2a87da2 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs
@@ -146,7 +146,7 @@ namespace OpenSim.Region.CoreModules.World.Land
146 else 146 else
147 { 147 {
148 // Normal Calculations 148 // Normal Calculations
149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.objectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus); 149 return (int)Math.Round(((float)LandData.Area / 65536.0f) * (float)m_scene.RegionInfo.ObjectCapacity * (float)m_scene.RegionInfo.RegionSettings.ObjectBonus);
150 } 150 }
151 } 151 }
152 public int GetSimulatorMaxPrimCount(ILandObject thisObject) 152 public int GetSimulatorMaxPrimCount(ILandObject thisObject)
@@ -158,7 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Land
158 else 158 else
159 { 159 {
160 //Normal Calculations 160 //Normal Calculations
161 return m_scene.objectCapacity; 161 return m_scene.RegionInfo.ObjectCapacity;
162 } 162 }
163 } 163 }
164 #endregion 164 #endregion
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
index 0e849e5..9d9967a 100644
--- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -805,7 +805,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
805 imgstream = new MemoryStream(); 805 imgstream = new MemoryStream();
806 806
807 // non-async because we know we have the asset immediately. 807 // non-async because we know we have the asset immediately.
808 AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.lastMapUUID.ToString()); 808 AssetBase mapasset = m_scene.AssetService.Get(m_scene.RegionInfo.RegionSettings.TerrainImageID.ToString());
809 809
810 // Decode image to System.Drawing.Image 810 // Decode image to System.Drawing.Image
811 if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image)) 811 if (OpenJPEG.DecodeToImage(mapasset.Data, out managedImage, out image))