aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/RegionSettings.cs21
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs119
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs5
-rw-r--r--OpenSim/Tests/Common/TestHelpers.cs21
7 files changed, 186 insertions, 40 deletions
diff --git a/OpenSim/Framework/RegionSettings.cs b/OpenSim/Framework/RegionSettings.cs
index db8c53e..a895c40 100644
--- a/OpenSim/Framework/RegionSettings.cs
+++ b/OpenSim/Framework/RegionSettings.cs
@@ -482,21 +482,14 @@ namespace OpenSim.Framework
482 set { m_LoadedCreationID = value; } 482 set { m_LoadedCreationID = value; }
483 } 483 }
484 484
485 // Connected Telehub object 485 /// <summary>
486 private UUID m_TelehubObject = UUID.Zero; 486 /// Connected Telehub object
487 public UUID TelehubObject 487 /// </summary>
488 { 488 public UUID TelehubObject { get; set; }
489 get
490 {
491 return m_TelehubObject;
492 }
493 set
494 {
495 m_TelehubObject = value;
496 }
497 }
498 489
499 // Our Connected Telehub's SpawnPoints 490 /// <summary>
491 /// Our connected Telehub's SpawnPoints
492 /// </summary>
500 public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>(); 493 public List<SpawnPoint> l_SpawnPoints = new List<SpawnPoint>();
501 494
502 // Add a SpawnPoint 495 // Add a SpawnPoint
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
index 173b603..1659493 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementCommands.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
60 60
61 public void Initialise() 61 public void Initialise()
62 { 62 {
63 m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName); 63// m_log.DebugFormat("[ESTATE MODULE]: Setting up estate commands for region {0}", m_module.Scene.RegionInfo.RegionName);
64 64
65 m_module.Scene.AddCommand("Regions", m_module, "set terrain texture", 65 m_module.Scene.AddCommand("Regions", m_module, "set terrain texture",
66 "set terrain texture <number> <uuid> [<x>] [<y>]", 66 "set terrain texture <number> <uuid> [<x>] [<y>]",
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
index 17387da..3bd7b4a 100644
--- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
+++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs
@@ -702,7 +702,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
702 } 702 }
703 } 703 }
704 704
705 public void handleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1) 705 public void HandleOnEstateManageTelehub(IClientAPI client, UUID invoice, UUID senderID, string cmd, uint param1)
706 { 706 {
707 SceneObjectPart part; 707 SceneObjectPart part;
708 708
@@ -742,7 +742,9 @@ namespace OpenSim.Region.CoreModules.World.Estate
742 default: 742 default:
743 break; 743 break;
744 } 744 }
745 SendTelehubInfo(client); 745
746 if (client != null)
747 SendTelehubInfo(client);
746 } 748 }
747 749
748 private void SendSimulatorBlueBoxMessage( 750 private void SendSimulatorBlueBoxMessage(
@@ -1214,7 +1216,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
1214 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest; 1216 client.OnEstateRestartSimRequest += handleEstateRestartSimRequest;
1215 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest; 1217 client.OnEstateChangeCovenantRequest += handleChangeEstateCovenantRequest;
1216 client.OnEstateChangeInfo += handleEstateChangeInfo; 1218 client.OnEstateChangeInfo += handleEstateChangeInfo;
1217 client.OnEstateManageTelehub += handleOnEstateManageTelehub; 1219 client.OnEstateManageTelehub += HandleOnEstateManageTelehub;
1218 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest; 1220 client.OnUpdateEstateAccessDeltaRequest += handleEstateAccessDeltaRequest;
1219 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage; 1221 client.OnSimulatorBlueBoxMessageRequest += SendSimulatorBlueBoxMessage;
1220 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage; 1222 client.OnEstateBlueBoxMessageRequest += SendEstateBlueBoxMessage;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 567ce2a..59c5b09 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3946,32 +3946,52 @@ namespace OpenSim.Region.Framework.Scenes
3946 } 3946 }
3947 } 3947 }
3948 3948
3949// m_log.DebugFormat(
3950// "[SCENE]: Found telehub object {0} for new user connection {1} to {2}",
3951// RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3952
3949 // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags 3953 // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags
3950 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && 3954 if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero &&
3951 RegionInfo.EstateSettings.AllowDirectTeleport == false && 3955 RegionInfo.EstateSettings.AllowDirectTeleport == false &&
3952 !viahome && !godlike) 3956 !viahome && !godlike)
3953 { 3957 {
3954 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); 3958 SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject);
3955 // Can have multiple SpawnPoints 3959
3956 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); 3960 if (telehub != null)
3957 if (spawnpoints.Count > 1)
3958 { 3961 {
3959 // We have multiple SpawnPoints, Route the agent to a random or sequential one 3962 // Can have multiple SpawnPoints
3960 if (SpawnPointRouting == "random") 3963 List<SpawnPoint> spawnpoints = RegionInfo.RegionSettings.SpawnPoints();
3961 acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation( 3964 if (spawnpoints.Count > 1)
3962 telehub.AbsolutePosition, 3965 {
3963 telehub.GroupRotation 3966 // We have multiple SpawnPoints, Route the agent to a random or sequential one
3964 ); 3967 if (SpawnPointRouting == "random")
3968 acd.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count) - 1].GetLocation(
3969 telehub.AbsolutePosition,
3970 telehub.GroupRotation
3971 );
3972 else
3973 acd.startpos = spawnpoints[SpawnPoint()].GetLocation(
3974 telehub.AbsolutePosition,
3975 telehub.GroupRotation
3976 );
3977 }
3978 else if (spawnpoints.Count == 1)
3979 {
3980 // We have a single SpawnPoint and will route the agent to it
3981 acd.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation);
3982 }
3965 else 3983 else
3966 acd.startpos = spawnpoints[SpawnPoint()].GetLocation( 3984 {
3967 telehub.AbsolutePosition, 3985 m_log.DebugFormat(
3968 telehub.GroupRotation 3986 "[SCENE]: No spawnpoints defined for telehub {0} for {1} in {2}. Continuing.",
3969 ); 3987 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3988 }
3970 } 3989 }
3971 else 3990 else
3972 { 3991 {
3973 // We have a single SpawnPoint and will route the agent to it 3992 m_log.DebugFormat(
3974 acd.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); 3993 "[SCENE]: No telehub {0} found to direct {1} in {2}. Continuing.",
3994 RegionInfo.RegionSettings.TelehubObject, acd.Name, Name);
3975 } 3995 }
3976 3996
3977 return true; 3997 return true;
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
new file mode 100644
index 0000000..9a97acc
--- /dev/null
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTelehubTests.cs
@@ -0,0 +1,119 @@
1/*
2 * Redistribution and use in source and binary forms, with or without
3 * modification, are permitted provided that the following conditions are met:
4 * * Redistributions of source code must retain the above copyright
5 * notice, this list of conditions and the following disclaimer.
6 * * Redistributions in binary form must reproduce the above copyright
7 * notice, this list of conditions and the following disclaimer in the
8 * documentation and/or other materials provided with the distribution.
9 * * Neither the name of the OpenSimulator Project nor the
10 * names of its contributors may be used to endorse or promote products
11 * derived from this software without specific prior written permission.
12 *
13 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
20 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */
24
25using System;
26using Nini.Config;
27using NUnit.Framework;
28using OpenMetaverse;
29using OpenSim.Framework;
30using OpenSim.Region.CoreModules.World.Estate;
31using OpenSim.Region.Framework.Scenes;
32using OpenSim.Region.Framework.Interfaces;
33using OpenSim.Services.Interfaces;
34using OpenSim.Tests.Common;
35using OpenSim.Tests.Common.Mock;
36
37namespace OpenSim.Region.Framework.Scenes.Tests
38{
39 /// <summary>
40 /// Scene telehub tests
41 /// </summary>
42 /// <remarks>
43 /// TODO: Tests which run through normal functionality. Currently, the only test is one that checks behaviour
44 /// in the case of an error condition
45 /// </remarks>
46 [TestFixture]
47 public class SceneTelehubTests : OpenSimTestCase
48 {
49 /// <summary>
50 /// Test for desired behaviour when a telehub has no spawn points
51 /// </summary>
52 [Test]
53 public void TestNoTelehubSpawnPoints()
54 {
55 TestHelpers.InMethod();
56// TestHelpers.EnableLogging();
57
58 EstateManagementModule emm = new EstateManagementModule();
59
60 SceneHelpers sh = new SceneHelpers();
61 Scene scene = sh.SetupScene();
62 SceneHelpers.SetupSceneModules(scene, emm);
63
64 UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
65
66 SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
67
68 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
69 scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
70
71 // Must still be possible to successfully log in
72 UUID loggingInUserId = TestHelpers.ParseTail(0x2);
73
74 UserAccount ua
75 = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
76
77 SceneHelpers.AddScenePresence(scene, ua);
78
79 Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
80 }
81
82 /// <summary>
83 /// Test for desired behaviour when the scene object nominated as a telehub object does not exist.
84 /// </summary>
85 [Test]
86 public void TestNoTelehubSceneObject()
87 {
88 TestHelpers.InMethod();
89// TestHelpers.EnableLogging();
90
91 EstateManagementModule emm = new EstateManagementModule();
92
93 SceneHelpers sh = new SceneHelpers();
94 Scene scene = sh.SetupScene();
95 SceneHelpers.SetupSceneModules(scene, emm);
96
97 UUID telehubSceneObjectOwner = TestHelpers.ParseTail(0x1);
98
99 SceneObjectGroup telehubSo = SceneHelpers.AddSceneObject(scene, "telehubObject", telehubSceneObjectOwner);
100 SceneObjectGroup spawnPointSo = SceneHelpers.AddSceneObject(scene, "spawnpointObject", telehubSceneObjectOwner);
101
102 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "connect", telehubSo.LocalId);
103 emm.HandleOnEstateManageTelehub(null, UUID.Zero, UUID.Zero, "spawnpoint add", spawnPointSo.LocalId);
104 scene.RegionInfo.EstateSettings.AllowDirectTeleport = false;
105
106 scene.DeleteSceneObject(telehubSo, false);
107
108 // Must still be possible to successfully log in
109 UUID loggingInUserId = TestHelpers.ParseTail(0x2);
110
111 UserAccount ua
112 = UserAccountHelpers.CreateUserWithInventory(scene, "Test", "User", loggingInUserId, "password");
113
114 SceneHelpers.AddScenePresence(scene, ua);
115
116 Assert.That(scene.GetScenePresence(loggingInUserId), Is.Not.Null);
117 }
118 }
119} \ No newline at end of file
diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs
index 9370102..a4247e3 100644
--- a/OpenSim/Tests/Common/Mock/TestClient.cs
+++ b/OpenSim/Tests/Common/Mock/TestClient.cs
@@ -788,11 +788,6 @@ namespace OpenSim.Tests.Common.Mock
788 { 788 {
789 OnRegionHandShakeReply(this); 789 OnRegionHandShakeReply(this);
790 } 790 }
791
792 if (OnCompleteMovementToRegion != null)
793 {
794 OnCompleteMovementToRegion(this, true);
795 }
796 } 791 }
797 792
798 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID) 793 public void SendAssetUploadCompleteMessage(sbyte AssetType, bool Success, UUID AssetFullID)
diff --git a/OpenSim/Tests/Common/TestHelpers.cs b/OpenSim/Tests/Common/TestHelpers.cs
index a684d72..6bf23f8 100644
--- a/OpenSim/Tests/Common/TestHelpers.cs
+++ b/OpenSim/Tests/Common/TestHelpers.cs
@@ -117,8 +117,6 @@ namespace OpenSim.Tests.Common
117 /// Parse a UUID stem into a full UUID. 117 /// Parse a UUID stem into a full UUID.
118 /// </summary> 118 /// </summary>
119 /// <remarks> 119 /// <remarks>
120 /// Yes, this is completely inconsistent with ParseTail but this is probably a better way to do it,
121 /// UUIDs are conceptually not hexadecmial numbers.
122 /// The fragment will come at the start of the UUID. The rest will be 0s 120 /// The fragment will come at the start of the UUID. The rest will be 0s
123 /// </remarks> 121 /// </remarks>
124 /// <returns></returns> 122 /// <returns></returns>
@@ -143,5 +141,24 @@ namespace OpenSim.Tests.Common
143 { 141 {
144 return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail)); 142 return new UUID(string.Format("00000000-0000-0000-0000-{0:X12}", tail));
145 } 143 }
144
145 /// <summary>
146 /// Parse a UUID tail section into a full UUID.
147 /// </summary>
148 /// <remarks>
149 /// The fragment will come at the end of the UUID. The rest will be 0s
150 /// </remarks>
151 /// <returns></returns>
152 /// <param name='frag'>
153 /// A UUID fragment that will be parsed into a full UUID. Therefore, it can only contain
154 /// cahracters which are valid in a UUID, except for "-" which is currently only allowed if a full UUID is
155 /// given as the 'fragment'.
156 /// </param>
157 public static UUID ParseTail(string stem)
158 {
159 string rawUuid = stem.PadLeft(32, '0');
160
161 return UUID.Parse(rawUuid);
162 }
146 } 163 }
147} 164}