aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorMelanie2010-02-08 15:53:20 +0000
committerMelanie2010-02-08 15:53:38 +0000
commitbaaf660511214e52ea4ed20b8e80ec8e1ff06a3a (patch)
tree1e90c7a22ea3354d6bfd5d2b3f8f64f199dbd477 /OpenSim/Region/CoreModules
parentAdded missing configs to Standalone.ini (diff)
parentAdding the Careminster "Configger" tool to OpenSim. The tool will, when launched (diff)
downloadopensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.zip
opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.gz
opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.bz2
opensim-SC_OLD-baaf660511214e52ea4ed20b8e80ec8e1ff06a3a.tar.xz
Merge branch 'master' into presence-refactor
This was a large, heavily conflicted merge and things MAY have got broken. Please check!
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs2
-rw-r--r--OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs35
-rw-r--r--OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs5
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs9
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs1
-rw-r--r--OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs36
-rw-r--r--OpenSim/Region/CoreModules/World/Access/AccessModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs6
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs327
-rwxr-xr-xOpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wavbin0 -> 211648 bytes
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs11
12 files changed, 281 insertions, 164 deletions
diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
index adcf6bd..9216e0b 100644
--- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
+++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs
@@ -762,7 +762,7 @@ namespace Flotsam.RegionModules.AssetCache
762 case "expire": 762 case "expire":
763 763
764 764
765 if (cmdparams.Length >= 3) 765 if (cmdparams.Length < 3)
766 { 766 {
767 m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd); 767 m_log.InfoFormat("[FLOTSAM ASSET CACHE] Invalid parameters for Expire, please specify a valid date & time", cmd);
768 break; 768 break;
diff --git a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
index e48b078..fdfcd10 100644
--- a/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/InstantMessage/OfflineMessageModule.cs
@@ -172,24 +172,27 @@ namespace OpenSim.Region.CoreModules.Avatar.InstantMessage
172 172
173 private void RetrieveInstantMessages(IClientAPI client) 173 private void RetrieveInstantMessages(IClientAPI client)
174 { 174 {
175 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId); 175 if (m_RestURL != "")
176 {
177 m_log.DebugFormat("[OFFLINE MESSAGING] Retrieving stored messages for {0}", client.AgentId);
176 178
177 List<GridInstantMessage>msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>( 179 List<GridInstantMessage> msglist = SynchronousRestObjectPoster.BeginPostObject<UUID, List<GridInstantMessage>>(
178 "POST", m_RestURL+"/RetrieveMessages/", client.AgentId); 180 "POST", m_RestURL + "/RetrieveMessages/", client.AgentId);
179 181
180 foreach (GridInstantMessage im in msglist) 182 foreach (GridInstantMessage im in msglist)
181 { 183 {
182 // client.SendInstantMessage(im); 184 // client.SendInstantMessage(im);
183 185
184 // Send through scene event manager so all modules get a chance 186 // Send through scene event manager so all modules get a chance
185 // to look at this message before it gets delivered. 187 // to look at this message before it gets delivered.
186 // 188 //
187 // Needed for proper state management for stored group 189 // Needed for proper state management for stored group
188 // invitations 190 // invitations
189 // 191 //
190 Scene s = FindScene(client.AgentId); 192 Scene s = FindScene(client.AgentId);
191 if (s != null) 193 if (s != null)
192 s.EventManager.TriggerIncomingInstantMessage(im); 194 s.EventManager.TriggerIncomingInstantMessage(im);
195 }
193 } 196 }
194 } 197 }
195 198
diff --git a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
index e53290c..e37da9f 100644
--- a/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Library/LibraryModule.cs
@@ -191,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Framework.Library
191 { 191 {
192 m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message); 192 m_log.DebugFormat("[LIBRARY MODULE]: Exception when processing archive {0}: {1}", iarFileName, e.Message);
193 } 193 }
194
195 } 194 }
196 195
197 } 196 }
@@ -203,6 +202,14 @@ namespace OpenSim.Region.CoreModules.Framework.Library
203 m_log.DebugFormat(" - folder {0}", lib.Name); 202 m_log.DebugFormat(" - folder {0}", lib.Name);
204 DumpFolder(lib); 203 DumpFolder(lib);
205 } 204 }
205//
206// private void DumpLibrary()
207// {
208// InventoryFolderImpl lib = m_Scene.CommsManager.UserProfileCacheService.LibraryRoot;
209//
210// m_log.DebugFormat(" - folder {0}", lib.Name);
211// DumpFolder(lib);
212// }
206 213
207 private void DumpFolder(InventoryFolderImpl folder) 214 private void DumpFolder(InventoryFolderImpl folder)
208 { 215 {
diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
index 96d65d7..f15f8f6 100644
--- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs
@@ -87,7 +87,10 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring
87 87
88 foreach (IMonitor monitor in m_monitors) 88 foreach (IMonitor monitor in m_monitors)
89 { 89 {
90 if (monitor.ToString() == monID) 90 string elemName = monitor.ToString();
91 if (elemName.StartsWith(monitor.GetType().Namespace))
92 elemName = elemName.Substring(monitor.GetType().Namespace.Length + 1);
93 if (elemName == monID || monitor.ToString() == monID)
91 { 94 {
92 Hashtable ereply3 = new Hashtable(); 95 Hashtable ereply3 = new Hashtable();
93 96
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index f51d0c2..e3c7bbf 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -362,7 +362,14 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
362 362
363 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0)) 363 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
364 { 364 {
365 scene.AssetService.Delete(oldID.ToString()); 365 if (oldAsset == null) oldAsset = scene.AssetService.Get(oldID.ToString());
366 if (oldAsset != null)
367 {
368 if (oldAsset.Temporary == true)
369 {
370 scene.AssetService.Delete(oldID.ToString());
371 }
372 }
366 } 373 }
367 } 374 }
368 375
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index d57a8e5..3291be4 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -342,6 +342,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
342 m_log.Error( 342 m_log.Error(
343 "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!"); 343 "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Empty byte data returned!");
344 } 344 }
345
345 m_textureManager.ReturnData(id, imageJ2000); 346 m_textureManager.ReturnData(id, imageJ2000);
346 } 347 }
347 348
diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
index 60df2e7..d647e71 100644
--- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs
@@ -262,44 +262,34 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
262 { 262 {
263 case ChatTypeEnum.Whisper: 263 case ChatTypeEnum.Whisper:
264 if (dis < m_whisperdistance) 264 if (dis < m_whisperdistance)
265 { 265 QueueMessage(new ListenerInfo(li, name, id, msg));
266 lock (m_pending.SyncRoot)
267 {
268 m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
269 }
270 }
271 break; 266 break;
272 267
273 case ChatTypeEnum.Say: 268 case ChatTypeEnum.Say:
274 if (dis < m_saydistance) 269 if (dis < m_saydistance)
275 { 270 QueueMessage(new ListenerInfo(li, name, id, msg));
276 lock (m_pending.SyncRoot)
277 {
278 m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
279 }
280 }
281 break; 271 break;
282 272
283 case ChatTypeEnum.Shout: 273 case ChatTypeEnum.Shout:
284 if (dis < m_shoutdistance) 274 if (dis < m_shoutdistance)
285 { 275 QueueMessage(new ListenerInfo(li, name, id, msg));
286 lock (m_pending.SyncRoot)
287 {
288 m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
289 }
290 }
291 break; 276 break;
292 277
293 case ChatTypeEnum.Region: 278 case ChatTypeEnum.Region:
294 lock (m_pending.SyncRoot) 279 QueueMessage(new ListenerInfo(li, name, id, msg));
295 {
296 m_pending.Enqueue(new ListenerInfo(li,name,id,msg));
297 }
298 break; 280 break;
299 } 281 }
300 } 282 }
301 } 283 }
302 284
285 protected void QueueMessage(ListenerInfo li)
286 {
287 lock (m_pending.SyncRoot)
288 {
289 m_pending.Enqueue(li);
290 }
291 }
292
303 /// <summary> 293 /// <summary>
304 /// Are there any listen events ready to be dispatched? 294 /// Are there any listen events ready to be dispatched?
305 /// </summary> 295 /// </summary>
@@ -319,7 +309,7 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
319 309
320 lock (m_pending.SyncRoot) 310 lock (m_pending.SyncRoot)
321 { 311 {
322 li = (ListenerInfo) m_pending.Dequeue(); 312 li = (ListenerInfo)m_pending.Dequeue();
323 } 313 }
324 314
325 return li; 315 return li;
diff --git a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
index 8b5a413..127469e 100644
--- a/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
+++ b/OpenSim/Region/CoreModules/World/Access/AccessModule.cs
@@ -41,9 +41,7 @@ namespace OpenSim.Region.CoreModules.World
41{ 41{
42 public class AccessModule : ISharedRegionModule 42 public class AccessModule : ISharedRegionModule
43 { 43 {
44 private static readonly ILog m_log = 44// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
45 LogManager.GetLogger(
46 MethodBase.GetCurrentMethod().DeclaringType);
47 45
48 private List<Scene> m_SceneList = new List<Scene>(); 46 private List<Scene> m_SceneList = new List<Scene>();
49 47
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
index bb9c6fe..59a1b8f 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs
@@ -420,9 +420,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
420 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4; 420 currentRegionSettings.TerrainTexture4 = loadedRegionSettings.TerrainTexture4;
421 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun; 421 currentRegionSettings.UseEstateSun = loadedRegionSettings.UseEstateSun;
422 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight; 422 currentRegionSettings.WaterHeight = loadedRegionSettings.WaterHeight;
423 423
424 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 424 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
425 estateModule.sendRegionHandshakeToAll(); 425
426 if (estateModule != null)
427 estateModule.sendRegionHandshakeToAll();
426 428
427 return true; 429 return true;
428 } 430 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
index 8c1e1c2..d986274 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs
@@ -36,11 +36,13 @@ using OpenMetaverse;
36using OpenSim.Framework; 36using OpenSim.Framework;
37 37
38using OpenSim.Framework.Serialization; 38using OpenSim.Framework.Serialization;
39using OpenSim.Framework.Serialization.External;
39using OpenSim.Region.CoreModules.World.Serialiser; 40using OpenSim.Region.CoreModules.World.Serialiser;
40using OpenSim.Region.CoreModules.World.Terrain; 41using OpenSim.Region.CoreModules.World.Terrain;
41using OpenSim.Region.Framework.Scenes; 42using OpenSim.Region.Framework.Scenes;
42using OpenSim.Region.Framework.Scenes.Serialization; 43using OpenSim.Region.Framework.Scenes.Serialization;
43using OpenSim.Tests.Common; 44using OpenSim.Tests.Common;
45using OpenSim.Tests.Common.Mock;
44using OpenSim.Tests.Common.Setup; 46using OpenSim.Tests.Common.Setup;
45 47
46namespace OpenSim.Region.CoreModules.World.Archiver.Tests 48namespace OpenSim.Region.CoreModules.World.Archiver.Tests
@@ -50,6 +52,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
50 { 52 {
51 private Guid m_lastRequestId; 53 private Guid m_lastRequestId;
52 private string m_lastErrorMessage; 54 private string m_lastErrorMessage;
55
56 protected TestScene m_scene;
57 protected ArchiverModule m_archiverModule;
58
59 [SetUp]
60 public void SetUp()
61 {
62 m_archiverModule = new ArchiverModule();
63 SerialiserModule serialiserModule = new SerialiserModule();
64 TerrainModule terrainModule = new TerrainModule();
65
66 m_scene = SceneSetupHelpers.SetupScene("scene1");
67 SceneSetupHelpers.SetupSceneModules(m_scene, m_archiverModule, serialiserModule, terrainModule);
68 }
53 69
54 private void LoadCompleted(Guid requestId, string errorMessage) 70 private void LoadCompleted(Guid requestId, string errorMessage)
55 { 71 {
@@ -74,6 +90,30 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
74 } 90 }
75 } 91 }
76 92
93 protected SceneObjectPart CreateSceneObjectPart1()
94 {
95 string partName = "My Little Pony";
96 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015");
97 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
98 Vector3 groupPosition = new Vector3(10, 20, 30);
99 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
100 Vector3 offsetPosition = new Vector3(5, 10, 15);
101
102 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
103 }
104
105 protected SceneObjectPart CreateSceneObjectPart2()
106 {
107 string partName = "Action Man";
108 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016");
109 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
110 Vector3 groupPosition = new Vector3(90, 80, 70);
111 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
112 Vector3 offsetPosition = new Vector3(20, 25, 30);
113
114 return new SceneObjectPart(ownerId, shape, groupPosition, rotationOffset, offsetPosition) { Name = partName };
115 }
116
77 /// <summary> 117 /// <summary>
78 /// Test saving a V0.2 OpenSim Region Archive. 118 /// Test saving a V0.2 OpenSim Region Archive.
79 /// </summary> 119 /// </summary>
@@ -83,59 +123,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
83 TestHelper.InMethod(); 123 TestHelper.InMethod();
84 //log4net.Config.XmlConfigurator.Configure(); 124 //log4net.Config.XmlConfigurator.Configure();
85 125
86 ArchiverModule archiverModule = new ArchiverModule(); 126 SceneObjectPart part1 = CreateSceneObjectPart1();
87 SerialiserModule serialiserModule = new SerialiserModule(); 127 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
88 TerrainModule terrainModule = new TerrainModule();
89
90 Scene scene = SceneSetupHelpers.SetupScene("asset");
91 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
92 128
93 SceneObjectPart part1; 129 SceneObjectPart part2 = CreateSceneObjectPart2();
94 130 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
95 // Create and add prim 1
96 {
97 string partName = "My Little Pony";
98 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000015");
99 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateSphere();
100 Vector3 groupPosition = new Vector3(10, 20, 30);
101 Quaternion rotationOffset = new Quaternion(20, 30, 40, 50);
102 Vector3 offsetPosition = new Vector3(5, 10, 15);
103
104 part1
105 = new SceneObjectPart(
106 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
107 part1.Name = partName;
108
109 scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
110 }
111
112 SceneObjectPart part2;
113
114 // Create and add prim 2
115 {
116 string partName = "Action Man";
117 UUID ownerId = UUID.Parse("00000000-0000-0000-0000-000000000016");
118 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder();
119 Vector3 groupPosition = new Vector3(90, 80, 70);
120 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
121 Vector3 offsetPosition = new Vector3(20, 25, 30);
122
123 part2
124 = new SceneObjectPart(
125 ownerId, shape, groupPosition, rotationOffset, offsetPosition);
126 part2.Name = partName;
127
128 scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
129 }
130 131
131 MemoryStream archiveWriteStream = new MemoryStream(); 132 MemoryStream archiveWriteStream = new MemoryStream();
132 scene.EventManager.OnOarFileSaved += SaveCompleted; 133 m_scene.EventManager.OnOarFileSaved += SaveCompleted;
133 134
134 Guid requestId = new Guid("00000000-0000-0000-0000-808080808080"); 135 Guid requestId = new Guid("00000000-0000-0000-0000-808080808080");
135 136
136 lock (this) 137 lock (this)
137 { 138 {
138 archiverModule.ArchiveRegion(archiveWriteStream, requestId); 139 m_archiverModule.ArchiveRegion(archiveWriteStream, requestId);
139 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer; 140 //AssetServerBase assetServer = (AssetServerBase)scene.CommsManager.AssetCache.AssetServer;
140 //while (assetServer.HasWaitingRequests()) 141 //while (assetServer.HasWaitingRequests())
141 // assetServer.ProcessNextRequest(); 142 // assetServer.ProcessNextRequest();
@@ -214,32 +215,58 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
214 // Also check that direct entries which will also have a file entry containing that directory doesn't 215 // Also check that direct entries which will also have a file entry containing that directory doesn't
215 // upset load 216 // upset load
216 tar.WriteDir(ArchiveConstants.TERRAINS_PATH); 217 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
217 218
218 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile()); 219 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
219 220
220 string part1Name = "object1"; 221 SceneObjectPart part1 = CreateSceneObjectPart1();
221 PrimitiveBaseShape shape = PrimitiveBaseShape.CreateCylinder(); 222 SceneObjectGroup object1 = new SceneObjectGroup(part1);
222 Vector3 groupPosition = new Vector3(90, 80, 70);
223 Quaternion rotationOffset = new Quaternion(60, 70, 80, 90);
224 Vector3 offsetPosition = new Vector3(20, 25, 30);
225
226 SerialiserModule serialiserModule = new SerialiserModule();
227 ArchiverModule archiverModule = new ArchiverModule();
228 223
229 Scene scene = SceneSetupHelpers.SetupScene(); 224 // Let's put some inventory items into our object
230 SceneSetupHelpers.SetupSceneModules(scene, serialiserModule, archiverModule); 225 string soundItemName = "sound-item1";
226 UUID soundItemUuid = UUID.Parse("00000000-0000-0000-0000-000000000002");
227 Type type = GetType();
228 Assembly assembly = type.Assembly;
229 string soundDataResourceName = null;
230 string[] names = assembly.GetManifestResourceNames();
231 foreach (string name in names)
232 {
233 if (name.EndsWith(".Resources.test-sound.wav"))
234 soundDataResourceName = name;
235 }
236 Assert.That(soundDataResourceName, Is.Not.Null);
231 237
232 SceneObjectPart part1 238 byte[] soundData;
233 = new SceneObjectPart( 239 Console.WriteLine("Loading " + soundDataResourceName);
234 UUID.Zero, shape, groupPosition, rotationOffset, offsetPosition); 240 using (Stream resource = assembly.GetManifestResourceStream(soundDataResourceName))
235 part1.Name = part1Name; 241 {
236 SceneObjectGroup object1 = new SceneObjectGroup(part1); 242 using (BinaryReader br = new BinaryReader(resource))
237 scene.AddNewSceneObject(object1, false); 243 {
244 // FIXME: Use the inspector insteadthere are so many forums and lists already, though admittedly none of them are suitable for cross virtual-enivornemnt discussion
245 soundData = br.ReadBytes(99999999);
246 UUID soundUuid = UUID.Parse("00000000-0000-0000-0000-000000000001");
247 string soundAssetFileName
248 = ArchiveConstants.ASSETS_PATH + soundUuid
249 + ArchiveConstants.ASSET_TYPE_TO_EXTENSION[(sbyte)AssetType.SoundWAV];
250 tar.WriteFile(soundAssetFileName, soundData);
251
252 /*
253 AssetBase soundAsset = AssetHelpers.CreateAsset(soundUuid, soundData);
254 scene.AssetService.Store(soundAsset);
255 asset1FileName = ArchiveConstants.ASSETS_PATH + soundUuid + ".wav";
256 */
257
258 TaskInventoryItem item1
259 = new TaskInventoryItem { AssetID = soundUuid, ItemID = soundItemUuid, Name = soundItemName };
260 part1.Inventory.AddInventoryItem(item1, true);
261 }
262 }
263
264 m_scene.AddNewSceneObject(object1, false);
238 265
239 string object1FileName = string.Format( 266 string object1FileName = string.Format(
240 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml", 267 "{0}_{1:000}-{2:000}-{3:000}__{4}.xml",
241 part1Name, 268 part1.Name,
242 Math.Round(groupPosition.X), Math.Round(groupPosition.Y), Math.Round(groupPosition.Z), 269 Math.Round(part1.GroupPosition.X), Math.Round(part1.GroupPosition.Y), Math.Round(part1.GroupPosition.Z),
243 part1.UUID); 270 part1.UUID);
244 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1)); 271 tar.WriteFile(ArchiveConstants.OBJECTS_PATH + object1FileName, SceneObjectSerializer.ToXml2Format(object1));
245 272
@@ -249,27 +276,125 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
249 276
250 lock (this) 277 lock (this)
251 { 278 {
252 scene.EventManager.OnOarFileLoaded += LoadCompleted; 279 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
253 archiverModule.DearchiveRegion(archiveReadStream); 280 m_archiverModule.DearchiveRegion(archiveReadStream);
254 } 281 }
255 282
256 Assert.That(m_lastErrorMessage, Is.Null); 283 Assert.That(m_lastErrorMessage, Is.Null);
257 284
258 SceneObjectPart object1PartLoaded = scene.GetSceneObjectPart(part1Name); 285 SceneObjectPart object1PartLoaded = m_scene.GetSceneObjectPart(part1.Name);
259 286
260 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded"); 287 Assert.That(object1PartLoaded, Is.Not.Null, "object1 was not loaded");
261 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1Name), "object1 names not identical"); 288 Assert.That(object1PartLoaded.Name, Is.EqualTo(part1.Name), "object1 names not identical");
262 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(groupPosition), "object1 group position not equal"); 289 Assert.That(object1PartLoaded.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal");
263 Assert.That( 290 Assert.That(
264 object1PartLoaded.RotationOffset, Is.EqualTo(rotationOffset), "object1 rotation offset not equal"); 291 object1PartLoaded.RotationOffset, Is.EqualTo(part1.RotationOffset), "object1 rotation offset not equal");
265 Assert.That( 292 Assert.That(
266 object1PartLoaded.OffsetPosition, Is.EqualTo(offsetPosition), "object1 offset position not equal"); 293 object1PartLoaded.OffsetPosition, Is.EqualTo(part1.OffsetPosition), "object1 offset position not equal");
294
295 TaskInventoryItem loadedSoundItem = object1PartLoaded.Inventory.GetInventoryItems(soundItemName)[0];
296 Assert.That(loadedSoundItem, Is.Not.Null, "loaded sound item was null");
297 AssetBase loadedSoundAsset = m_scene.AssetService.Get(loadedSoundItem.AssetID.ToString());
298 Assert.That(loadedSoundAsset, Is.Not.Null, "loaded sound asset was null");
299 Assert.That(loadedSoundAsset.Data, Is.EqualTo(soundData), "saved and loaded sound data do not match");
267 300
268 // Temporary 301 // Temporary
269 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod()); 302 Console.WriteLine("Successfully completed {0}", MethodBase.GetCurrentMethod());
270 } 303 }
271 304
272 /// <summary> 305 /// <summary>
306 /// Test loading the region settings of a V0.2 OpenSim Region Archive.
307 /// </summary>
308 [Test]
309 public void TestLoadOarV0_2RegionSettings()
310 {
311 TestHelper.InMethod();
312 //log4net.Config.XmlConfigurator.Configure();
313
314 MemoryStream archiveWriteStream = new MemoryStream();
315 TarArchiveWriter tar = new TarArchiveWriter(archiveWriteStream);
316
317 tar.WriteDir(ArchiveConstants.TERRAINS_PATH);
318 tar.WriteFile(ArchiveConstants.CONTROL_FILE_PATH, ArchiveWriteRequestExecution.Create0p2ControlFile());
319
320 RegionSettings rs = new RegionSettings();
321 rs.AgentLimit = 17;
322 rs.AllowDamage = true;
323 rs.AllowLandJoinDivide = true;
324 rs.AllowLandResell = true;
325 rs.BlockFly = true;
326 rs.BlockShowInSearch = true;
327 rs.BlockTerraform = true;
328 rs.DisableCollisions = true;
329 rs.DisablePhysics = true;
330 rs.DisableScripts = true;
331 rs.Elevation1NW = 15.9;
332 rs.Elevation1NE = 45.3;
333 rs.Elevation1SE = 49;
334 rs.Elevation1SW = 1.9;
335 rs.Elevation2NW = 4.5;
336 rs.Elevation2NE = 19.2;
337 rs.Elevation2SE = 9.2;
338 rs.Elevation2SW = 2.1;
339 rs.FixedSun = true;
340 rs.ObjectBonus = 1.4;
341 rs.RestrictPushing = true;
342 rs.TerrainLowerLimit = 0.4;
343 rs.TerrainRaiseLimit = 17.9;
344 rs.TerrainTexture1 = UUID.Parse("00000000-0000-0000-0000-000000000020");
345 rs.TerrainTexture2 = UUID.Parse("00000000-0000-0000-0000-000000000040");
346 rs.TerrainTexture3 = UUID.Parse("00000000-0000-0000-0000-000000000060");
347 rs.TerrainTexture4 = UUID.Parse("00000000-0000-0000-0000-000000000080");
348 rs.UseEstateSun = true;
349 rs.WaterHeight = 23;
350
351 tar.WriteFile(ArchiveConstants.SETTINGS_PATH + "region1.xml", RegionSettingsSerializer.Serialize(rs));
352
353 tar.Close();
354
355 MemoryStream archiveReadStream = new MemoryStream(archiveWriteStream.ToArray());
356
357 lock (this)
358 {
359 m_scene.EventManager.OnOarFileLoaded += LoadCompleted;
360 m_archiverModule.DearchiveRegion(archiveReadStream);
361 }
362
363 Assert.That(m_lastErrorMessage, Is.Null);
364 RegionSettings loadedRs = m_scene.RegionInfo.RegionSettings;
365
366 Assert.That(loadedRs.AgentLimit, Is.EqualTo(17));
367 Assert.That(loadedRs.AllowDamage, Is.True);
368 Assert.That(loadedRs.AllowLandJoinDivide, Is.True);
369 Assert.That(loadedRs.AllowLandResell, Is.True);
370 Assert.That(loadedRs.BlockFly, Is.True);
371 Assert.That(loadedRs.BlockShowInSearch, Is.True);
372 Assert.That(loadedRs.BlockTerraform, Is.True);
373 Assert.That(loadedRs.DisableCollisions, Is.True);
374 Assert.That(loadedRs.DisablePhysics, Is.True);
375 Assert.That(loadedRs.DisableScripts, Is.True);
376 Assert.That(loadedRs.Elevation1NW, Is.EqualTo(15.9));
377 Assert.That(loadedRs.Elevation1NE, Is.EqualTo(45.3));
378 Assert.That(loadedRs.Elevation1SE, Is.EqualTo(49));
379 Assert.That(loadedRs.Elevation1SW, Is.EqualTo(1.9));
380 Assert.That(loadedRs.Elevation2NW, Is.EqualTo(4.5));
381 Assert.That(loadedRs.Elevation2NE, Is.EqualTo(19.2));
382 Assert.That(loadedRs.Elevation2SE, Is.EqualTo(9.2));
383 Assert.That(loadedRs.Elevation2SW, Is.EqualTo(2.1));
384 Assert.That(loadedRs.FixedSun, Is.True);
385 Assert.That(loadedRs.ObjectBonus, Is.EqualTo(1.4));
386 Assert.That(loadedRs.RestrictPushing, Is.True);
387 Assert.That(loadedRs.TerrainLowerLimit, Is.EqualTo(0.4));
388 Assert.That(loadedRs.TerrainRaiseLimit, Is.EqualTo(17.9));
389 Assert.That(loadedRs.TerrainTexture1, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000020")));
390 Assert.That(loadedRs.TerrainTexture2, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000040")));
391 Assert.That(loadedRs.TerrainTexture3, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000060")));
392 Assert.That(loadedRs.TerrainTexture4, Is.EqualTo(UUID.Parse("00000000-0000-0000-0000-000000000080")));
393 Assert.That(loadedRs.UseEstateSun, Is.True);
394 Assert.That(loadedRs.WaterHeight, Is.EqualTo(23));
395 }
396
397 /// <summary>
273 /// Test merging a V0.2 OpenSim Region Archive into an existing scene 398 /// Test merging a V0.2 OpenSim Region Archive into an existing scene
274 /// </summary> 399 /// </summary>
275 //[Test] 400 //[Test]
@@ -280,11 +405,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
280 405
281 MemoryStream archiveWriteStream = new MemoryStream(); 406 MemoryStream archiveWriteStream = new MemoryStream();
282 407
283 string part2Name = "objectMerge"; 408// string part2Name = "objectMerge";
284 PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder(); 409// PrimitiveBaseShape part2Shape = PrimitiveBaseShape.CreateCylinder();
285 Vector3 part2GroupPosition = new Vector3(90, 80, 70); 410// Vector3 part2GroupPosition = new Vector3(90, 80, 70);
286 Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90); 411// Quaternion part2RotationOffset = new Quaternion(60, 70, 80, 90);
287 Vector3 part2OffsetPosition = new Vector3(20, 25, 30); 412// Vector3 part2OffsetPosition = new Vector3(20, 25, 30);
413
414 SceneObjectPart part2 = CreateSceneObjectPart2();
288 415
289 // Create an oar file that we can use for the merge 416 // Create an oar file that we can use for the merge
290 { 417 {
@@ -293,63 +420,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver.Tests
293 TerrainModule terrainModule = new TerrainModule(); 420 TerrainModule terrainModule = new TerrainModule();
294 421
295 Scene scene = SceneSetupHelpers.SetupScene(); 422 Scene scene = SceneSetupHelpers.SetupScene();
296 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule); 423 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
297 424
298 SceneObjectPart part2 425 m_scene.AddNewSceneObject(new SceneObjectGroup(part2), false);
299 = new SceneObjectPart(
300 UUID.Zero, part2Shape, part2GroupPosition, part2RotationOffset, part2OffsetPosition);
301 part2.Name = part2Name;
302 SceneObjectGroup object2 = new SceneObjectGroup(part2);
303
304 scene.AddNewSceneObject(object2, false);
305 426
306 // Write out this scene 427 // Write out this scene
307 scene.EventManager.OnOarFileSaved += SaveCompleted; 428 scene.EventManager.OnOarFileSaved += SaveCompleted;
308 429
309 lock (this) 430 lock (this)
310 { 431 {
311 archiverModule.ArchiveRegion(archiveWriteStream); 432 m_archiverModule.ArchiveRegion(archiveWriteStream);
312 Monitor.Wait(this, 60000); 433 Monitor.Wait(this, 60000);
313 } 434 }
314 } 435 }
315 436
316 { 437 {
317 ArchiverModule archiverModule = new ArchiverModule(); 438 SceneObjectPart part1 = CreateSceneObjectPart1();
318 SerialiserModule serialiserModule = new SerialiserModule(); 439 m_scene.AddNewSceneObject(new SceneObjectGroup(part1), false);
319 TerrainModule terrainModule = new TerrainModule();
320
321 Scene scene = SceneSetupHelpers.SetupScene();
322 SceneSetupHelpers.SetupSceneModules(scene, archiverModule, serialiserModule, terrainModule);
323
324 string part1Name = "objectExisting";
325 PrimitiveBaseShape part1Shape = PrimitiveBaseShape.CreateCylinder();
326 Vector3 part1GroupPosition = new Vector3(80, 70, 60);
327 Quaternion part1RotationOffset = new Quaternion(50, 60, 70, 80);
328 Vector3 part1OffsetPosition = new Vector3(15, 20, 25);
329
330 SceneObjectPart part1
331 = new SceneObjectPart(
332 UUID.Zero, part1Shape, part1GroupPosition, part1RotationOffset, part1OffsetPosition);
333 part1.Name = part1Name;
334 SceneObjectGroup object1 = new SceneObjectGroup(part1);
335
336 scene.AddNewSceneObject(object1, false);
337 440
338 // Merge in the archive we created earlier 441 // Merge in the archive we created earlier
339 byte[] archive = archiveWriteStream.ToArray(); 442 byte[] archive = archiveWriteStream.ToArray();
340 MemoryStream archiveReadStream = new MemoryStream(archive); 443 MemoryStream archiveReadStream = new MemoryStream(archive);
341 444
342 archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty); 445 m_archiverModule.DearchiveRegion(archiveReadStream, true, Guid.Empty);
343 446
344 SceneObjectPart object1Existing = scene.GetSceneObjectPart(part1Name); 447 SceneObjectPart object1Existing = m_scene.GetSceneObjectPart(part1.Name);
345 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge"); 448 Assert.That(object1Existing, Is.Not.Null, "object1 was not present after merge");
346 Assert.That(object1Existing.Name, Is.EqualTo(part1Name), "object1 names not identical after merge"); 449 Assert.That(object1Existing.Name, Is.EqualTo(part1.Name), "object1 names not identical after merge");
347 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1GroupPosition), "object1 group position not equal after merge"); 450 Assert.That(object1Existing.GroupPosition, Is.EqualTo(part1.GroupPosition), "object1 group position not equal after merge");
348 451
349 SceneObjectPart object2PartMerged = scene.GetSceneObjectPart(part2Name); 452 SceneObjectPart object2PartMerged = m_scene.GetSceneObjectPart(part2.Name);
350 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge"); 453 Assert.That(object2PartMerged, Is.Not.Null, "object2 was not present after merge");
351 Assert.That(object2PartMerged.Name, Is.EqualTo(part2Name), "object2 names not identical after merge"); 454 Assert.That(object2PartMerged.Name, Is.EqualTo(part2.Name), "object2 names not identical after merge");
352 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2GroupPosition), "object2 group position not equal after merge"); 455 Assert.That(object2PartMerged.GroupPosition, Is.EqualTo(part2.GroupPosition), "object2 group position not equal after merge");
353 } 456 }
354 } 457 }
355 } 458 }
diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav
new file mode 100755
index 0000000..b45ee54
--- /dev/null
+++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/Resources/test-sound.wav
Binary files differ
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 72dd373..4652d70 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -142,6 +142,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
142 private bool m_debugPermissions = false; 142 private bool m_debugPermissions = false;
143 private bool m_allowGridGods = false; 143 private bool m_allowGridGods = false;
144 private bool m_RegionOwnerIsGod = false; 144 private bool m_RegionOwnerIsGod = false;
145 private bool m_RegionManagerIsGod = false;
145 private bool m_ParcelOwnerIsGod = false; 146 private bool m_ParcelOwnerIsGod = false;
146 147
147 /// <value> 148 /// <value>
@@ -184,6 +185,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
184 m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false); 185 m_bypassPermissions = !myConfig.GetBoolean("serverside_object_permissions", false);
185 m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true); 186 m_propagatePermissions = myConfig.GetBoolean("propagate_permissions", true);
186 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true); 187 m_RegionOwnerIsGod = myConfig.GetBoolean("region_owner_is_god", true);
188 m_RegionManagerIsGod = myConfig.GetBoolean("region_manager_is_god", false);
187 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true); 189 m_ParcelOwnerIsGod = myConfig.GetBoolean("parcel_owner_is_god", true);
188 190
189 m_allowedScriptCreators 191 m_allowedScriptCreators
@@ -479,10 +481,13 @@ namespace OpenSim.Region.CoreModules.World.Permissions
479 481
480 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero) 482 if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
481 { 483 {
482 if (m_scene.RegionInfo.EstateSettings.EstateOwner == user) 484 if (m_scene.RegionInfo.EstateSettings.EstateOwner == user && m_RegionOwnerIsGod)
483 return true; 485 return true;
484 } 486 }
485 487
488 if (IsEstateManager(user) && m_RegionManagerIsGod)
489 return true;
490
486 if (m_allowGridGods) 491 if (m_allowGridGods)
487 { 492 {
488 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user); 493 UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, user);
@@ -495,6 +500,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions
495 500
496 return false; 501 return false;
497 } 502 }
503
498 protected bool IsFriendWithPerms(UUID user,UUID objectOwner) 504 protected bool IsFriendWithPerms(UUID user,UUID objectOwner)
499 { 505 {
500 506
@@ -896,9 +902,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions
896 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); 902 DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
897 if (m_bypassPermissions) return m_bypassPermissionsValue; 903 if (m_bypassPermissions) return m_bypassPermissionsValue;
898 904
899 if (IsEstateManager(user) && m_RegionOwnerIsGod)
900 return true;
901
902 return IsAdministrator(user); 905 return IsAdministrator(user);
903 } 906 }
904 907