diff options
Diffstat (limited to 'OpenSim/Region')
6 files changed, 136 insertions, 67 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index d126f5f..8c0a7e9 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4684,7 +4684,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4684 | } | 4684 | } |
4685 | } | 4685 | } |
4686 | 4686 | ||
4687 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 4687 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
4688 | { | 4688 | { |
4689 | ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 4689 | ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
4690 | replyPacket.Data.AgentID = AgentId; | 4690 | replyPacket.Data.AgentID = AgentId; |
@@ -4693,12 +4693,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4693 | replyPacket.Data.SequenceID = 0; | 4693 | replyPacket.Data.SequenceID = 0; |
4694 | 4694 | ||
4695 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); | 4695 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); |
4696 | foreach (UUID avatar in avatars) | 4696 | foreach (LandAccessEntry entry in accessList) |
4697 | { | 4697 | { |
4698 | ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); | 4698 | ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); |
4699 | block.Flags = accessFlag; | 4699 | block.Flags = accessFlag; |
4700 | block.ID = avatar; | 4700 | block.ID = entry.AgentID; |
4701 | block.Time = 0; | 4701 | block.Time = entry.Expires; |
4702 | list.Add(block); | 4702 | list.Add(block); |
4703 | } | 4703 | } |
4704 | 4704 | ||
@@ -8641,13 +8641,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8641 | } | 8641 | } |
8642 | #endregion | 8642 | #endregion |
8643 | 8643 | ||
8644 | List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); | 8644 | List<LandAccessEntry> entries = new List<LandAccessEntry>(); |
8645 | foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) | 8645 | foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) |
8646 | { | 8646 | { |
8647 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 8647 | LandAccessEntry entry = new LandAccessEntry(); |
8648 | entry.AgentID = block.ID; | 8648 | entry.AgentID = block.ID; |
8649 | entry.Flags = (AccessList)block.Flags; | 8649 | entry.Flags = (AccessList)block.Flags; |
8650 | entry.Time = Util.ToDateTime(block.Time); | 8650 | entry.Expires = block.Time; |
8651 | entries.Add(entry); | 8651 | entries.Add(entry); |
8652 | } | 8652 | } |
8653 | 8653 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 5db56b0..0f83d82 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -508,7 +508,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
508 | 508 | ||
509 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, | 509 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, |
510 | uint flags, int landLocalID, UUID transactionID, int sequenceID, | 510 | uint flags, int landLocalID, UUID transactionID, int sequenceID, |
511 | int sections, List<ParcelManager.ParcelAccessEntry> entries, | 511 | int sections, List<LandAccessEntry> entries, |
512 | IClientAPI remote_client) | 512 | IClientAPI remote_client) |
513 | { | 513 | { |
514 | // Flags is the list to update, it can mean either the ban or | 514 | // Flags is the list to update, it can mean either the ban or |
@@ -1777,10 +1777,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1777 | 1777 | ||
1778 | if ((flags & 1) != 0) // Ban TODO: Remove magic number | 1778 | if ((flags & 1) != 0) // Ban TODO: Remove magic number |
1779 | { | 1779 | { |
1780 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 1780 | LandAccessEntry entry = new LandAccessEntry(); |
1781 | entry.AgentID = targetAvatar.UUID; | 1781 | entry.AgentID = targetAvatar.UUID; |
1782 | entry.Flags = AccessList.Ban; | 1782 | entry.Flags = AccessList.Ban; |
1783 | entry.Time = new DateTime(); | 1783 | entry.Expires = 0; // Perm |
1784 | 1784 | ||
1785 | land.LandData.ParcelAccessList.Add(entry); | 1785 | land.LandData.ParcelAccessList.Add(entry); |
1786 | } | 1786 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 07b28c7..debf6d2 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -467,21 +467,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
467 | 467 | ||
468 | public bool IsBannedFromLand(UUID avatar) | 468 | public bool IsBannedFromLand(UUID avatar) |
469 | { | 469 | { |
470 | ExpireAccessList(); | ||
471 | |||
470 | if (m_scene.Permissions.IsAdministrator(avatar)) | 472 | if (m_scene.Permissions.IsAdministrator(avatar)) |
471 | return false; | 473 | return false; |
472 | 474 | ||
473 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | 475 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) |
474 | return false; | 476 | return false; |
475 | 477 | ||
478 | if (avatar == LandData.OwnerID) | ||
479 | return false; | ||
480 | |||
476 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 481 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
477 | { | 482 | { |
478 | if (LandData.ParcelAccessList.FindIndex( | 483 | if (LandData.ParcelAccessList.FindIndex( |
479 | delegate(ParcelManager.ParcelAccessEntry e) | 484 | delegate(LandAccessEntry e) |
480 | { | 485 | { |
481 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 486 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
482 | return true; | 487 | return true; |
483 | return false; | 488 | return false; |
484 | }) != -1 && LandData.OwnerID != avatar) | 489 | }) != -1) |
485 | { | 490 | { |
486 | return true; | 491 | return true; |
487 | } | 492 | } |
@@ -491,21 +496,26 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
491 | 496 | ||
492 | public bool IsRestrictedFromLand(UUID avatar) | 497 | public bool IsRestrictedFromLand(UUID avatar) |
493 | { | 498 | { |
499 | ExpireAccessList(); | ||
500 | |||
494 | if (m_scene.Permissions.IsAdministrator(avatar)) | 501 | if (m_scene.Permissions.IsAdministrator(avatar)) |
495 | return false; | 502 | return false; |
496 | 503 | ||
497 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | 504 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) |
498 | return false; | 505 | return false; |
499 | 506 | ||
507 | if (avatar == LandData.OwnerID) | ||
508 | return false; | ||
509 | |||
500 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 510 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
501 | { | 511 | { |
502 | if (LandData.ParcelAccessList.FindIndex( | 512 | if (LandData.ParcelAccessList.FindIndex( |
503 | delegate(ParcelManager.ParcelAccessEntry e) | 513 | delegate(LandAccessEntry e) |
504 | { | 514 | { |
505 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 515 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
506 | return true; | 516 | return true; |
507 | return false; | 517 | return false; |
508 | }) == -1 && LandData.OwnerID != avatar) | 518 | }) == -1) |
509 | { | 519 | { |
510 | if (!HasGroupAccess(avatar)) | 520 | if (!HasGroupAccess(avatar)) |
511 | { | 521 | { |
@@ -570,19 +580,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
570 | 580 | ||
571 | #region AccessList Functions | 581 | #region AccessList Functions |
572 | 582 | ||
573 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) | 583 | public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag) |
574 | { | 584 | { |
575 | List<UUID> list = new List<UUID>(); | 585 | ExpireAccessList(); |
576 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) | 586 | |
587 | List<LandAccessEntry> list = new List<LandAccessEntry>(); | ||
588 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
577 | { | 589 | { |
578 | if (entry.Flags == flag) | 590 | if (entry.Flags == flag) |
579 | { | 591 | list.Add(entry); |
580 | list.Add(entry.AgentID); | ||
581 | } | ||
582 | } | 592 | } |
583 | if (list.Count == 0) | 593 | if (list.Count == 0) |
584 | { | 594 | { |
585 | list.Add(UUID.Zero); | 595 | LandAccessEntry e = new LandAccessEntry(); |
596 | e.AgentID = UUID.Zero; | ||
597 | e.Flags = 0; | ||
598 | e.Expires = 0; | ||
599 | |||
600 | list.Add(e); | ||
586 | } | 601 | } |
587 | 602 | ||
588 | return list; | 603 | return list; |
@@ -594,20 +609,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
594 | 609 | ||
595 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) | 610 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) |
596 | { | 611 | { |
597 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); | 612 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access); |
598 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); | 613 | remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID); |
599 | } | 614 | } |
600 | 615 | ||
601 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) | 616 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) |
602 | { | 617 | { |
603 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); | 618 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban); |
604 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | 619 | remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID); |
605 | } | 620 | } |
606 | } | 621 | } |
607 | 622 | ||
608 | public void UpdateAccessList(uint flags, UUID transactionID, | 623 | public void UpdateAccessList(uint flags, UUID transactionID, |
609 | int sequenceID, int sections, | 624 | int sequenceID, int sections, |
610 | List<ParcelManager.ParcelAccessEntry> entries, | 625 | List<LandAccessEntry> entries, |
611 | IClientAPI remote_client) | 626 | IClientAPI remote_client) |
612 | { | 627 | { |
613 | LandData newData = LandData.Copy(); | 628 | LandData newData = LandData.Copy(); |
@@ -617,16 +632,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
617 | { | 632 | { |
618 | m_listTransactions[flags] = transactionID; | 633 | m_listTransactions[flags] = transactionID; |
619 | 634 | ||
620 | List<ParcelManager.ParcelAccessEntry> toRemove = | 635 | List<LandAccessEntry> toRemove = |
621 | new List<ParcelManager.ParcelAccessEntry>(); | 636 | new List<LandAccessEntry>(); |
622 | 637 | ||
623 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | 638 | foreach (LandAccessEntry entry in newData.ParcelAccessList) |
624 | { | 639 | { |
625 | if (entry.Flags == (AccessList)flags) | 640 | if (entry.Flags == (AccessList)flags) |
626 | toRemove.Add(entry); | 641 | toRemove.Add(entry); |
627 | } | 642 | } |
628 | 643 | ||
629 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 644 | foreach (LandAccessEntry entry in toRemove) |
630 | { | 645 | { |
631 | newData.ParcelAccessList.Remove(entry); | 646 | newData.ParcelAccessList.Remove(entry); |
632 | } | 647 | } |
@@ -641,13 +656,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
641 | } | 656 | } |
642 | } | 657 | } |
643 | 658 | ||
644 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 659 | foreach (LandAccessEntry entry in entries) |
645 | { | 660 | { |
646 | ParcelManager.ParcelAccessEntry temp = | 661 | LandAccessEntry temp = |
647 | new ParcelManager.ParcelAccessEntry(); | 662 | new LandAccessEntry(); |
648 | 663 | ||
649 | temp.AgentID = entry.AgentID; | 664 | temp.AgentID = entry.AgentID; |
650 | temp.Time = entry.Time; | 665 | temp.Expires = entry.Expires; |
651 | temp.Flags = (AccessList)flags; | 666 | temp.Flags = (AccessList)flags; |
652 | 667 | ||
653 | newData.ParcelAccessList.Add(temp); | 668 | newData.ParcelAccessList.Add(temp); |
@@ -1164,5 +1179,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1164 | } | 1179 | } |
1165 | 1180 | ||
1166 | #endregion | 1181 | #endregion |
1182 | |||
1183 | private void ExpireAccessList() | ||
1184 | { | ||
1185 | List<LandAccessEntry> delete = new List<LandAccessEntry>(); | ||
1186 | |||
1187 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
1188 | { | ||
1189 | if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch()) | ||
1190 | delete.Add(entry); | ||
1191 | } | ||
1192 | foreach (LandAccessEntry entry in delete) | ||
1193 | LandData.ParcelAccessList.Remove(entry); | ||
1194 | |||
1195 | m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); | ||
1196 | } | ||
1167 | } | 1197 | } |
1168 | } | 1198 | } |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index d4d0ad7..8fe3199 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1260,7 +1260,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1260 | 1260 | ||
1261 | } | 1261 | } |
1262 | 1262 | ||
1263 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 1263 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
1264 | { | 1264 | { |
1265 | 1265 | ||
1266 | } | 1266 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 17fd6b1..7f5372c 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -944,7 +944,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
944 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 944 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
945 | { | 945 | { |
946 | } | 946 | } |
947 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 947 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
948 | { | 948 | { |
949 | } | 949 | } |
950 | public void SendForceClientSelectObjects(List<uint> objectIDs) | 950 | public void SendForceClientSelectObjects(List<uint> objectIDs) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 3e9529f..b0b1b16 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -6101,16 +6101,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6101 | public void llEjectFromLand(string pest) | 6101 | public void llEjectFromLand(string pest) |
6102 | { | 6102 | { |
6103 | m_host.AddScriptLPS(1); | 6103 | m_host.AddScriptLPS(1); |
6104 | UUID agentId = new UUID(); | 6104 | UUID agentID = new UUID(); |
6105 | if (UUID.TryParse(pest, out agentId)) | 6105 | if (UUID.TryParse(pest, out agentID)) |
6106 | { | 6106 | { |
6107 | ScenePresence presence = World.GetScenePresence(agentId); | 6107 | ScenePresence presence = World.GetScenePresence(agentID); |
6108 | if (presence != null) | 6108 | if (presence != null) |
6109 | { | 6109 | { |
6110 | // agent must be over the owners land | 6110 | // agent must be over the owners land |
6111 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 6111 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
6112 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 6112 | if (land == null) |
6113 | World.TeleportClientHome(agentId, presence.ControllingClient); | 6113 | return; |
6114 | |||
6115 | if (m_host.OwnerID == land.LandData.OwnerID) | ||
6116 | { | ||
6117 | Vector3 pos = World.GetNearestAllowedPosition(presence, land); | ||
6118 | presence.TeleportWithMomentum(pos); | ||
6119 | presence.ControllingClient.SendAlertMessage("You have been ejected from this land"); | ||
6120 | } | ||
6114 | } | 6121 | } |
6115 | } | 6122 | } |
6116 | ScriptSleep(5000); | 6123 | ScriptSleep(5000); |
@@ -6804,24 +6811,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6804 | m_host.AddScriptLPS(1); | 6811 | m_host.AddScriptLPS(1); |
6805 | UUID key; | 6812 | UUID key; |
6806 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6813 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6807 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) | 6814 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
6808 | { | 6815 | { |
6809 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 6816 | int expires = 0; |
6817 | if (hours != 0) | ||
6818 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
6819 | |||
6810 | if (UUID.TryParse(avatar, out key)) | 6820 | if (UUID.TryParse(avatar, out key)) |
6811 | { | 6821 | { |
6812 | if (land.LandData.ParcelAccessList.FindIndex( | 6822 | int idx = land.LandData.ParcelAccessList.FindIndex( |
6813 | delegate(ParcelManager.ParcelAccessEntry e) | 6823 | delegate(LandAccessEntry e) |
6814 | { | 6824 | { |
6815 | if (e.AgentID == key && e.Flags == AccessList.Access) | 6825 | if (e.AgentID == key && e.Flags == AccessList.Access) |
6816 | return true; | 6826 | return true; |
6817 | return false; | 6827 | return false; |
6818 | }) == -1) | 6828 | }); |
6819 | { | 6829 | |
6820 | entry.AgentID = key; | 6830 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
6821 | entry.Flags = AccessList.Access; | 6831 | return; |
6822 | entry.Time = DateTime.Now.AddHours(hours); | 6832 | |
6823 | land.LandData.ParcelAccessList.Add(entry); | 6833 | if (idx != -1) |
6824 | } | 6834 | land.LandData.ParcelAccessList.RemoveAt(idx); |
6835 | |||
6836 | LandAccessEntry entry = new LandAccessEntry(); | ||
6837 | |||
6838 | entry.AgentID = key; | ||
6839 | entry.Flags = AccessList.Access; | ||
6840 | entry.Expires = expires; | ||
6841 | |||
6842 | land.LandData.ParcelAccessList.Add(entry); | ||
6843 | |||
6844 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
6825 | } | 6845 | } |
6826 | } | 6846 | } |
6827 | ScriptSleep(100); | 6847 | ScriptSleep(100); |
@@ -10242,22 +10262,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10242 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 10262 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
10243 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 10263 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
10244 | { | 10264 | { |
10245 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 10265 | int expires = 0; |
10266 | if (hours != 0) | ||
10267 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
10268 | |||
10246 | if (UUID.TryParse(avatar, out key)) | 10269 | if (UUID.TryParse(avatar, out key)) |
10247 | { | 10270 | { |
10248 | if (land.LandData.ParcelAccessList.FindIndex( | 10271 | int idx = land.LandData.ParcelAccessList.FindIndex( |
10249 | delegate(ParcelManager.ParcelAccessEntry e) | 10272 | delegate(LandAccessEntry e) |
10250 | { | 10273 | { |
10251 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 10274 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
10252 | return true; | 10275 | return true; |
10253 | return false; | 10276 | return false; |
10254 | }) == -1) | 10277 | }); |
10255 | { | 10278 | |
10256 | entry.AgentID = key; | 10279 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
10257 | entry.Flags = AccessList.Ban; | 10280 | return; |
10258 | entry.Time = DateTime.Now.AddHours(hours); | 10281 | |
10259 | land.LandData.ParcelAccessList.Add(entry); | 10282 | if (idx != -1) |
10260 | } | 10283 | land.LandData.ParcelAccessList.RemoveAt(idx); |
10284 | |||
10285 | LandAccessEntry entry = new LandAccessEntry(); | ||
10286 | |||
10287 | entry.AgentID = key; | ||
10288 | entry.Flags = AccessList.Ban; | ||
10289 | entry.Expires = expires; | ||
10290 | |||
10291 | land.LandData.ParcelAccessList.Add(entry); | ||
10292 | |||
10293 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
10261 | } | 10294 | } |
10262 | } | 10295 | } |
10263 | ScriptSleep(100); | 10296 | ScriptSleep(100); |
@@ -10273,7 +10306,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10273 | if (UUID.TryParse(avatar, out key)) | 10306 | if (UUID.TryParse(avatar, out key)) |
10274 | { | 10307 | { |
10275 | int idx = land.LandData.ParcelAccessList.FindIndex( | 10308 | int idx = land.LandData.ParcelAccessList.FindIndex( |
10276 | delegate(ParcelManager.ParcelAccessEntry e) | 10309 | delegate(LandAccessEntry e) |
10277 | { | 10310 | { |
10278 | if (e.AgentID == key && e.Flags == AccessList.Access) | 10311 | if (e.AgentID == key && e.Flags == AccessList.Access) |
10279 | return true; | 10312 | return true; |
@@ -10281,7 +10314,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10281 | }); | 10314 | }); |
10282 | 10315 | ||
10283 | if (idx != -1) | 10316 | if (idx != -1) |
10317 | { | ||
10284 | land.LandData.ParcelAccessList.RemoveAt(idx); | 10318 | land.LandData.ParcelAccessList.RemoveAt(idx); |
10319 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
10320 | } | ||
10285 | } | 10321 | } |
10286 | } | 10322 | } |
10287 | ScriptSleep(100); | 10323 | ScriptSleep(100); |
@@ -10297,7 +10333,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10297 | if (UUID.TryParse(avatar, out key)) | 10333 | if (UUID.TryParse(avatar, out key)) |
10298 | { | 10334 | { |
10299 | int idx = land.LandData.ParcelAccessList.FindIndex( | 10335 | int idx = land.LandData.ParcelAccessList.FindIndex( |
10300 | delegate(ParcelManager.ParcelAccessEntry e) | 10336 | delegate(LandAccessEntry e) |
10301 | { | 10337 | { |
10302 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 10338 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
10303 | return true; | 10339 | return true; |
@@ -10305,7 +10341,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10305 | }); | 10341 | }); |
10306 | 10342 | ||
10307 | if (idx != -1) | 10343 | if (idx != -1) |
10344 | { | ||
10308 | land.LandData.ParcelAccessList.RemoveAt(idx); | 10345 | land.LandData.ParcelAccessList.RemoveAt(idx); |
10346 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
10347 | } | ||
10309 | } | 10348 | } |
10310 | } | 10349 | } |
10311 | ScriptSleep(100); | 10350 | ScriptSleep(100); |
@@ -10625,7 +10664,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10625 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10664 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
10626 | if (land.OwnerID == m_host.OwnerID) | 10665 | if (land.OwnerID == m_host.OwnerID) |
10627 | { | 10666 | { |
10628 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10667 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10629 | { | 10668 | { |
10630 | if (entry.Flags == AccessList.Ban) | 10669 | if (entry.Flags == AccessList.Ban) |
10631 | { | 10670 | { |
@@ -10642,7 +10681,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10642 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10681 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
10643 | if (land.OwnerID == m_host.OwnerID) | 10682 | if (land.OwnerID == m_host.OwnerID) |
10644 | { | 10683 | { |
10645 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10684 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10646 | { | 10685 | { |
10647 | if (entry.Flags == AccessList.Access) | 10686 | if (entry.Flags == AccessList.Access) |
10648 | { | 10687 | { |