diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 83 |
1 files changed, 72 insertions, 11 deletions
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 58bbd24..fdef9d8 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -32,6 +32,7 @@ using System.IO; | |||
32 | using System.Linq; | 32 | using System.Linq; |
33 | using System.Reflection; | 33 | using System.Reflection; |
34 | using System.Security; | 34 | using System.Security; |
35 | using System.Timers; | ||
35 | using log4net; | 36 | using log4net; |
36 | using Mono.Addins; | 37 | using Mono.Addins; |
37 | using Nini.Config; | 38 | using Nini.Config; |
@@ -47,6 +48,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
47 | { | 48 | { |
48 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
49 | 50 | ||
51 | private Timer m_regionChangeTimer = new Timer(); | ||
50 | public Scene Scene { get; private set; } | 52 | public Scene Scene { get; private set; } |
51 | public IUserManagement UserManager { get; private set; } | 53 | public IUserManagement UserManager { get; private set; } |
52 | 54 | ||
@@ -59,8 +61,16 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
59 | public event ChangeDelegate OnEstateInfoChange; | 61 | public event ChangeDelegate OnEstateInfoChange; |
60 | public event MessageDelegate OnEstateMessage; | 62 | public event MessageDelegate OnEstateMessage; |
61 | 63 | ||
64 | private int m_delayCount = 0; | ||
65 | |||
62 | #region Packet Data Responders | 66 | #region Packet Data Responders |
63 | 67 | ||
68 | private void clientSendDetailedEstateData(IClientAPI remote_client, UUID invoice) | ||
69 | { | ||
70 | sendDetailedEstateData(remote_client, invoice); | ||
71 | sendEstateLists(remote_client, invoice); | ||
72 | } | ||
73 | |||
64 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) | 74 | private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) |
65 | { | 75 | { |
66 | uint sun = 0; | 76 | uint sun = 0; |
@@ -83,7 +93,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
83 | (uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime, | 93 | (uint) Scene.RegionInfo.RegionSettings.CovenantChangedDateTime, |
84 | Scene.RegionInfo.EstateSettings.AbuseEmail, | 94 | Scene.RegionInfo.EstateSettings.AbuseEmail, |
85 | estateOwner); | 95 | estateOwner); |
96 | } | ||
86 | 97 | ||
98 | private void sendEstateLists(IClientAPI remote_client, UUID invoice) | ||
99 | { | ||
87 | remote_client.SendEstateList(invoice, | 100 | remote_client.SendEstateList(invoice, |
88 | (int)Constants.EstateAccessCodex.EstateManagers, | 101 | (int)Constants.EstateAccessCodex.EstateManagers, |
89 | Scene.RegionInfo.EstateSettings.EstateManagers, | 102 | Scene.RegionInfo.EstateSettings.EstateManagers, |
@@ -257,6 +270,16 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
257 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); | 270 | IRestartModule restartModule = Scene.RequestModuleInterface<IRestartModule>(); |
258 | if (restartModule != null) | 271 | if (restartModule != null) |
259 | { | 272 | { |
273 | if (timeInSeconds == -1) | ||
274 | { | ||
275 | m_delayCount++; | ||
276 | if (m_delayCount > 3) | ||
277 | return; | ||
278 | |||
279 | restartModule.DelayRestart(3600, "Restart delayed by region manager"); | ||
280 | return; | ||
281 | } | ||
282 | |||
260 | List<int> times = new List<int>(); | 283 | List<int> times = new List<int>(); |
261 | while (timeInSeconds > 0) | 284 | while (timeInSeconds > 0) |
262 | { | 285 | { |
@@ -269,7 +292,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
269 | timeInSeconds -= 15; | 292 | timeInSeconds -= 15; |
270 | } | 293 | } |
271 | 294 | ||
272 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), true); | 295 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), false); |
273 | } | 296 | } |
274 | } | 297 | } |
275 | 298 | ||
@@ -477,7 +500,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
477 | { | 500 | { |
478 | if (!s.IsChildAgent) | 501 | if (!s.IsChildAgent) |
479 | { | 502 | { |
480 | Scene.TeleportClientHome(user, s.ControllingClient); | 503 | if (!Scene.TeleportClientHome(user, s.ControllingClient)) |
504 | { | ||
505 | s.ControllingClient.Kick("Your access to the region was revoked and TP home failed - you have been logged out."); | ||
506 | s.ControllingClient.Close(); | ||
507 | } | ||
481 | } | 508 | } |
482 | } | 509 | } |
483 | 510 | ||
@@ -486,7 +513,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
486 | { | 513 | { |
487 | remote_client.SendAlertMessage("User is already on the region ban list"); | 514 | remote_client.SendAlertMessage("User is already on the region ban list"); |
488 | } | 515 | } |
489 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 516 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
490 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 517 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
491 | } | 518 | } |
492 | else | 519 | else |
@@ -541,7 +568,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
541 | remote_client.SendAlertMessage("User is not on the region ban list"); | 568 | remote_client.SendAlertMessage("User is not on the region ban list"); |
542 | } | 569 | } |
543 | 570 | ||
544 | //m_scene.RegionInfo.regionBanlist.Add(Manager(user); | 571 | //Scene.RegionInfo.regionBanlist.Add(Manager(user); |
545 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); | 572 | remote_client.SendBannedUserList(invoice, Scene.RegionInfo.EstateSettings.EstateBans, Scene.RegionInfo.EstateSettings.EstateID); |
546 | } | 573 | } |
547 | else | 574 | else |
@@ -700,7 +727,11 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
700 | ScenePresence s = Scene.GetScenePresence(prey); | 727 | ScenePresence s = Scene.GetScenePresence(prey); |
701 | if (s != null) | 728 | if (s != null) |
702 | { | 729 | { |
703 | Scene.TeleportClientHome(prey, s.ControllingClient); | 730 | if (!Scene.TeleportClientHome(prey, s.ControllingClient)) |
731 | { | ||
732 | s.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
733 | s.ControllingClient.Close(); | ||
734 | } | ||
704 | } | 735 | } |
705 | } | 736 | } |
706 | } | 737 | } |
@@ -718,7 +749,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
718 | // Also make sure they are actually in the region | 749 | // Also make sure they are actually in the region |
719 | ScenePresence p; | 750 | ScenePresence p; |
720 | if(Scene.TryGetScenePresence(client.AgentId, out p)) | 751 | if(Scene.TryGetScenePresence(client.AgentId, out p)) |
721 | Scene.TeleportClientHome(p.UUID, p.ControllingClient); | 752 | { |
753 | if (!Scene.TeleportClientHome(p.UUID, p.ControllingClient)) | ||
754 | { | ||
755 | p.ControllingClient.Kick("You were teleported home by the region owner, but the TP failed - you have been logged out."); | ||
756 | p.ControllingClient.Close(); | ||
757 | } | ||
758 | } | ||
722 | } | 759 | } |
723 | }); | 760 | }); |
724 | } | 761 | } |
@@ -1081,6 +1118,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1081 | 1118 | ||
1082 | public void AddRegion(Scene scene) | 1119 | public void AddRegion(Scene scene) |
1083 | { | 1120 | { |
1121 | m_regionChangeTimer.AutoReset = false; | ||
1122 | m_regionChangeTimer.Interval = 2000; | ||
1123 | m_regionChangeTimer.Elapsed += RaiseRegionInfoChange; | ||
1124 | |||
1084 | Scene = scene; | 1125 | Scene = scene; |
1085 | Scene.RegisterModuleInterface<IEstateModule>(this); | 1126 | Scene.RegisterModuleInterface<IEstateModule>(this); |
1086 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; | 1127 | Scene.EventManager.OnNewClient += EventManager_OnNewClient; |
@@ -1131,7 +1172,7 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1131 | 1172 | ||
1132 | private void EventManager_OnNewClient(IClientAPI client) | 1173 | private void EventManager_OnNewClient(IClientAPI client) |
1133 | { | 1174 | { |
1134 | client.OnDetailedEstateDataRequest += sendDetailedEstateData; | 1175 | client.OnDetailedEstateDataRequest += clientSendDetailedEstateData; |
1135 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; | 1176 | client.OnSetEstateFlagsRequest += estateSetRegionInfoHandler; |
1136 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; | 1177 | // client.OnSetEstateTerrainBaseTexture += setEstateTerrainBaseTexture; |
1137 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; | 1178 | client.OnSetEstateTerrainDetailTexture += setEstateTerrainBaseTexture; |
@@ -1183,6 +1224,10 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1183 | flags |= RegionFlags.AllowParcelChanges; | 1224 | flags |= RegionFlags.AllowParcelChanges; |
1184 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) | 1225 | if (Scene.RegionInfo.RegionSettings.BlockShowInSearch) |
1185 | flags |= RegionFlags.BlockParcelSearch; | 1226 | flags |= RegionFlags.BlockParcelSearch; |
1227 | if (Scene.RegionInfo.RegionSettings.GodBlockSearch) | ||
1228 | flags |= (RegionFlags)(1 << 11); | ||
1229 | if (Scene.RegionInfo.RegionSettings.Casino) | ||
1230 | flags |= (RegionFlags)(1 << 10); | ||
1186 | 1231 | ||
1187 | if (Scene.RegionInfo.RegionSettings.FixedSun) | 1232 | if (Scene.RegionInfo.RegionSettings.FixedSun) |
1188 | flags |= RegionFlags.SunFixed; | 1233 | flags |= RegionFlags.SunFixed; |
@@ -1190,11 +1235,15 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1190 | flags |= RegionFlags.Sandbox; | 1235 | flags |= RegionFlags.Sandbox; |
1191 | if (Scene.RegionInfo.EstateSettings.AllowVoice) | 1236 | if (Scene.RegionInfo.EstateSettings.AllowVoice) |
1192 | flags |= RegionFlags.AllowVoice; | 1237 | flags |= RegionFlags.AllowVoice; |
1238 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1239 | flags |= RegionFlags.AllowLandmark; | ||
1240 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1241 | flags |= RegionFlags.AllowSetHome; | ||
1242 | if (Scene.RegionInfo.EstateSettings.BlockDwell) | ||
1243 | flags |= RegionFlags.BlockDwell; | ||
1244 | if (Scene.RegionInfo.EstateSettings.ResetHomeOnTeleport) | ||
1245 | flags |= RegionFlags.ResetHomeOnTeleport; | ||
1193 | 1246 | ||
1194 | // Fudge these to always on, so the menu options activate | ||
1195 | // | ||
1196 | flags |= RegionFlags.AllowLandmark; | ||
1197 | flags |= RegionFlags.AllowSetHome; | ||
1198 | 1247 | ||
1199 | // TODO: SkipUpdateInterestList | 1248 | // TODO: SkipUpdateInterestList |
1200 | 1249 | ||
@@ -1235,6 +1284,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1235 | flags |= RegionFlags.ResetHomeOnTeleport; | 1284 | flags |= RegionFlags.ResetHomeOnTeleport; |
1236 | if (Scene.RegionInfo.EstateSettings.TaxFree) | 1285 | if (Scene.RegionInfo.EstateSettings.TaxFree) |
1237 | flags |= RegionFlags.TaxFree; | 1286 | flags |= RegionFlags.TaxFree; |
1287 | if (Scene.RegionInfo.EstateSettings.AllowLandmark) | ||
1288 | flags |= RegionFlags.AllowLandmark; | ||
1289 | if (Scene.RegionInfo.EstateSettings.AllowParcelChanges) | ||
1290 | flags |= RegionFlags.AllowParcelChanges; | ||
1291 | if (Scene.RegionInfo.EstateSettings.AllowSetHome) | ||
1292 | flags |= RegionFlags.AllowSetHome; | ||
1238 | if (Scene.RegionInfo.EstateSettings.DenyMinors) | 1293 | if (Scene.RegionInfo.EstateSettings.DenyMinors) |
1239 | flags |= (RegionFlags)(1 << 30); | 1294 | flags |= (RegionFlags)(1 << 30); |
1240 | 1295 | ||
@@ -1255,6 +1310,12 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
1255 | 1310 | ||
1256 | public void TriggerRegionInfoChange() | 1311 | public void TriggerRegionInfoChange() |
1257 | { | 1312 | { |
1313 | m_regionChangeTimer.Stop(); | ||
1314 | m_regionChangeTimer.Start(); | ||
1315 | } | ||
1316 | |||
1317 | protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e) | ||
1318 | { | ||
1258 | ChangeDelegate change = OnRegionInfoChange; | 1319 | ChangeDelegate change = OnRegionInfoChange; |
1259 | 1320 | ||
1260 | if (change != null) | 1321 | if (change != null) |