diff options
author | Melanie | 2012-02-02 23:40:56 +0000 |
---|---|---|
committer | Melanie | 2012-02-02 23:40:56 +0000 |
commit | 447a66d66005c5ec54a786d1d0a532738729251c (patch) | |
tree | 78c286a7c43586e7ce0747bd71369c3a3be344df /OpenSim/Region | |
parent | OpenID: server connector had a copy-and-paste error that made identity querie... (diff) | |
download | opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.zip opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.gz opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.bz2 opensim-SC-447a66d66005c5ec54a786d1d0a532738729251c.tar.xz |
Replace ParcelAccessEntry with a new struct, LandAccessEntry, which more
accurately reflects the data sent by the viewer. Add times bans and the
expiration of timed bans.
Warning: Contains a Migration (and nuts)
Diffstat (limited to 'OpenSim/Region')
6 files changed, 139 insertions, 66 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index a7bf06d..cdd4957 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4623,7 +4623,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4623 | } | 4623 | } |
4624 | } | 4624 | } |
4625 | 4625 | ||
4626 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 4626 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
4627 | { | 4627 | { |
4628 | ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); | 4628 | ParcelAccessListReplyPacket replyPacket = (ParcelAccessListReplyPacket)PacketPool.Instance.GetPacket(PacketType.ParcelAccessListReply); |
4629 | replyPacket.Data.AgentID = AgentId; | 4629 | replyPacket.Data.AgentID = AgentId; |
@@ -4632,12 +4632,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4632 | replyPacket.Data.SequenceID = 0; | 4632 | replyPacket.Data.SequenceID = 0; |
4633 | 4633 | ||
4634 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); | 4634 | List<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>(); |
4635 | foreach (UUID avatar in avatars) | 4635 | foreach (LandAccessEntry entry in accessList) |
4636 | { | 4636 | { |
4637 | ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); | 4637 | ParcelAccessListReplyPacket.ListBlock block = new ParcelAccessListReplyPacket.ListBlock(); |
4638 | block.Flags = accessFlag; | 4638 | block.Flags = accessFlag; |
4639 | block.ID = avatar; | 4639 | block.ID = entry.AgentID; |
4640 | block.Time = 0; | 4640 | block.Time = entry.Expires; |
4641 | list.Add(block); | 4641 | list.Add(block); |
4642 | } | 4642 | } |
4643 | 4643 | ||
@@ -8577,13 +8577,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
8577 | } | 8577 | } |
8578 | #endregion | 8578 | #endregion |
8579 | 8579 | ||
8580 | List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>(); | 8580 | List<LandAccessEntry> entries = new List<LandAccessEntry>(); |
8581 | foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) | 8581 | foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List) |
8582 | { | 8582 | { |
8583 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 8583 | LandAccessEntry entry = new LandAccessEntry(); |
8584 | entry.AgentID = block.ID; | 8584 | entry.AgentID = block.ID; |
8585 | entry.Flags = (AccessList)block.Flags; | 8585 | entry.Flags = (AccessList)block.Flags; |
8586 | entry.Time = Util.ToDateTime(block.Time); | 8586 | entry.Expires = block.Time; |
8587 | entries.Add(entry); | 8587 | entries.Add(entry); |
8588 | } | 8588 | } |
8589 | 8589 | ||
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 94bba83..1c503aa 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -550,7 +550,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
550 | 550 | ||
551 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, | 551 | public void ClientOnParcelAccessListUpdateRequest(UUID agentID, |
552 | uint flags, int landLocalID, UUID transactionID, int sequenceID, | 552 | uint flags, int landLocalID, UUID transactionID, int sequenceID, |
553 | int sections, List<ParcelManager.ParcelAccessEntry> entries, | 553 | int sections, List<LandAccessEntry> entries, |
554 | IClientAPI remote_client) | 554 | IClientAPI remote_client) |
555 | { | 555 | { |
556 | // Flags is the list to update, it can mean either the ban or | 556 | // Flags is the list to update, it can mean either the ban or |
@@ -1712,4 +1712,4 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1712 | MainConsole.Instance.Output(report.ToString()); | 1712 | MainConsole.Instance.Output(report.ToString()); |
1713 | } | 1713 | } |
1714 | } | 1714 | } |
1715 | } \ No newline at end of file | 1715 | } |
diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 79b13c3..3b4336f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs | |||
@@ -418,13 +418,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
418 | 418 | ||
419 | public bool IsBannedFromLand(UUID avatar) | 419 | public bool IsBannedFromLand(UUID avatar) |
420 | { | 420 | { |
421 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 421 | ExpireAccessList(); |
422 | |||
423 | if (m_scene.Permissions.IsAdministrator(avatar)) | ||
424 | return false; | ||
425 | |||
426 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
427 | return false; | ||
428 | |||
429 | if (avatar == LandData.OwnerID) | ||
422 | return false; | 430 | return false; |
423 | 431 | ||
424 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) | 432 | if ((LandData.Flags & (uint) ParcelFlags.UseBanList) > 0) |
425 | { | 433 | { |
426 | if (LandData.ParcelAccessList.FindIndex( | 434 | if (LandData.ParcelAccessList.FindIndex( |
427 | delegate(ParcelManager.ParcelAccessEntry e) | 435 | delegate(LandAccessEntry e) |
428 | { | 436 | { |
429 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) | 437 | if (e.AgentID == avatar && e.Flags == AccessList.Ban) |
430 | return true; | 438 | return true; |
@@ -439,13 +447,21 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
439 | 447 | ||
440 | public bool IsRestrictedFromLand(UUID avatar) | 448 | public bool IsRestrictedFromLand(UUID avatar) |
441 | { | 449 | { |
442 | if (m_scene.Permissions.CanEditParcelProperties(avatar, this, 0)) | 450 | ExpireAccessList(); |
451 | |||
452 | if (m_scene.Permissions.IsAdministrator(avatar)) | ||
453 | return false; | ||
454 | |||
455 | if (m_scene.RegionInfo.EstateSettings.IsEstateManager(avatar)) | ||
456 | return false; | ||
457 | |||
458 | if (avatar == LandData.OwnerID) | ||
443 | return false; | 459 | return false; |
444 | 460 | ||
445 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) | 461 | if ((LandData.Flags & (uint) ParcelFlags.UseAccessList) > 0) |
446 | { | 462 | { |
447 | if (LandData.ParcelAccessList.FindIndex( | 463 | if (LandData.ParcelAccessList.FindIndex( |
448 | delegate(ParcelManager.ParcelAccessEntry e) | 464 | delegate(LandAccessEntry e) |
449 | { | 465 | { |
450 | if (e.AgentID == avatar && e.Flags == AccessList.Access) | 466 | if (e.AgentID == avatar && e.Flags == AccessList.Access) |
451 | return true; | 467 | return true; |
@@ -511,19 +527,24 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
511 | 527 | ||
512 | #region AccessList Functions | 528 | #region AccessList Functions |
513 | 529 | ||
514 | public List<UUID> CreateAccessListArrayByFlag(AccessList flag) | 530 | public List<LandAccessEntry> CreateAccessListArrayByFlag(AccessList flag) |
515 | { | 531 | { |
516 | List<UUID> list = new List<UUID>(); | 532 | ExpireAccessList(); |
517 | foreach (ParcelManager.ParcelAccessEntry entry in LandData.ParcelAccessList) | 533 | |
534 | List<LandAccessEntry> list = new List<LandAccessEntry>(); | ||
535 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
518 | { | 536 | { |
519 | if (entry.Flags == flag) | 537 | if (entry.Flags == flag) |
520 | { | 538 | list.Add(entry); |
521 | list.Add(entry.AgentID); | ||
522 | } | ||
523 | } | 539 | } |
524 | if (list.Count == 0) | 540 | if (list.Count == 0) |
525 | { | 541 | { |
526 | list.Add(UUID.Zero); | 542 | LandAccessEntry e = new LandAccessEntry(); |
543 | e.AgentID = UUID.Zero; | ||
544 | e.Flags = 0; | ||
545 | e.Expires = 0; | ||
546 | |||
547 | list.Add(e); | ||
527 | } | 548 | } |
528 | 549 | ||
529 | return list; | 550 | return list; |
@@ -535,20 +556,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
535 | 556 | ||
536 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) | 557 | if (flags == (uint) AccessList.Access || flags == (uint) AccessList.Both) |
537 | { | 558 | { |
538 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Access); | 559 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Access); |
539 | remote_client.SendLandAccessListData(avatars,(uint) AccessList.Access,LandData.LocalID); | 560 | remote_client.SendLandAccessListData(accessEntries,(uint) AccessList.Access,LandData.LocalID); |
540 | } | 561 | } |
541 | 562 | ||
542 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) | 563 | if (flags == (uint) AccessList.Ban || flags == (uint) AccessList.Both) |
543 | { | 564 | { |
544 | List<UUID> avatars = CreateAccessListArrayByFlag(AccessList.Ban); | 565 | List<LandAccessEntry> accessEntries = CreateAccessListArrayByFlag(AccessList.Ban); |
545 | remote_client.SendLandAccessListData(avatars, (uint)AccessList.Ban, LandData.LocalID); | 566 | remote_client.SendLandAccessListData(accessEntries, (uint)AccessList.Ban, LandData.LocalID); |
546 | } | 567 | } |
547 | } | 568 | } |
548 | 569 | ||
549 | public void UpdateAccessList(uint flags, UUID transactionID, | 570 | public void UpdateAccessList(uint flags, UUID transactionID, |
550 | int sequenceID, int sections, | 571 | int sequenceID, int sections, |
551 | List<ParcelManager.ParcelAccessEntry> entries, | 572 | List<LandAccessEntry> entries, |
552 | IClientAPI remote_client) | 573 | IClientAPI remote_client) |
553 | { | 574 | { |
554 | LandData newData = LandData.Copy(); | 575 | LandData newData = LandData.Copy(); |
@@ -558,16 +579,16 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
558 | { | 579 | { |
559 | m_listTransactions[flags] = transactionID; | 580 | m_listTransactions[flags] = transactionID; |
560 | 581 | ||
561 | List<ParcelManager.ParcelAccessEntry> toRemove = | 582 | List<LandAccessEntry> toRemove = |
562 | new List<ParcelManager.ParcelAccessEntry>(); | 583 | new List<LandAccessEntry>(); |
563 | 584 | ||
564 | foreach (ParcelManager.ParcelAccessEntry entry in newData.ParcelAccessList) | 585 | foreach (LandAccessEntry entry in newData.ParcelAccessList) |
565 | { | 586 | { |
566 | if (entry.Flags == (AccessList)flags) | 587 | if (entry.Flags == (AccessList)flags) |
567 | toRemove.Add(entry); | 588 | toRemove.Add(entry); |
568 | } | 589 | } |
569 | 590 | ||
570 | foreach (ParcelManager.ParcelAccessEntry entry in toRemove) | 591 | foreach (LandAccessEntry entry in toRemove) |
571 | { | 592 | { |
572 | newData.ParcelAccessList.Remove(entry); | 593 | newData.ParcelAccessList.Remove(entry); |
573 | } | 594 | } |
@@ -582,13 +603,13 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
582 | } | 603 | } |
583 | } | 604 | } |
584 | 605 | ||
585 | foreach (ParcelManager.ParcelAccessEntry entry in entries) | 606 | foreach (LandAccessEntry entry in entries) |
586 | { | 607 | { |
587 | ParcelManager.ParcelAccessEntry temp = | 608 | LandAccessEntry temp = |
588 | new ParcelManager.ParcelAccessEntry(); | 609 | new LandAccessEntry(); |
589 | 610 | ||
590 | temp.AgentID = entry.AgentID; | 611 | temp.AgentID = entry.AgentID; |
591 | temp.Time = entry.Time; | 612 | temp.Expires = entry.Expires; |
592 | temp.Flags = (AccessList)flags; | 613 | temp.Flags = (AccessList)flags; |
593 | 614 | ||
594 | newData.ParcelAccessList.Add(temp); | 615 | newData.ParcelAccessList.Add(temp); |
@@ -1105,5 +1126,20 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1105 | } | 1126 | } |
1106 | 1127 | ||
1107 | #endregion | 1128 | #endregion |
1129 | |||
1130 | private void ExpireAccessList() | ||
1131 | { | ||
1132 | List<LandAccessEntry> delete = new List<LandAccessEntry>(); | ||
1133 | |||
1134 | foreach (LandAccessEntry entry in LandData.ParcelAccessList) | ||
1135 | { | ||
1136 | if (entry.Expires != 0 && entry.Expires < Util.UnixTimeSinceEpoch()) | ||
1137 | delete.Add(entry); | ||
1138 | } | ||
1139 | foreach (LandAccessEntry entry in delete) | ||
1140 | LandData.ParcelAccessList.Remove(entry); | ||
1141 | |||
1142 | m_scene.EventManager.TriggerLandObjectUpdated((uint)LandData.LocalID, this); | ||
1143 | } | ||
1108 | } | 1144 | } |
1109 | } | 1145 | } |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index bbf3729..11f927c 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -1253,7 +1253,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1253 | 1253 | ||
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 1256 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
1257 | { | 1257 | { |
1258 | 1258 | ||
1259 | } | 1259 | } |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 6d40a92..81bf9ed 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -940,7 +940,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
940 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) | 940 | public void SendLandProperties(int sequence_id, bool snap_selection, int request_result, ILandObject lo, float simObjectBonusFactor,int parcelObjectCapacity, int simObjectCapacity, uint regionFlags) |
941 | { | 941 | { |
942 | } | 942 | } |
943 | public void SendLandAccessListData(List<UUID> avatars, uint accessFlag, int localLandID) | 943 | public void SendLandAccessListData(List<LandAccessEntry> accessList, uint accessFlag, int localLandID) |
944 | { | 944 | { |
945 | } | 945 | } |
946 | public void SendForceClientSelectObjects(List<uint> objectIDs) | 946 | 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 67dee02..0bdd84a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5714,16 +5714,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5714 | public void llEjectFromLand(string pest) | 5714 | public void llEjectFromLand(string pest) |
5715 | { | 5715 | { |
5716 | m_host.AddScriptLPS(1); | 5716 | m_host.AddScriptLPS(1); |
5717 | UUID agentId = new UUID(); | 5717 | UUID agentID = new UUID(); |
5718 | if (UUID.TryParse(pest, out agentId)) | 5718 | if (UUID.TryParse(pest, out agentID)) |
5719 | { | 5719 | { |
5720 | ScenePresence presence = World.GetScenePresence(agentId); | 5720 | ScenePresence presence = World.GetScenePresence(agentID); |
5721 | if (presence != null) | 5721 | if (presence != null) |
5722 | { | 5722 | { |
5723 | // agent must be over the owners land | 5723 | // agent must be over the owners land |
5724 | if (m_host.OwnerID == World.LandChannel.GetLandObject( | 5724 | ILandObject land = World.LandChannel.GetLandObject(presence.AbsolutePosition.X, presence.AbsolutePosition.Y); |
5725 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) | 5725 | if (land == null) |
5726 | World.TeleportClientHome(agentId, presence.ControllingClient); | 5726 | return; |
5727 | |||
5728 | if (m_host.OwnerID == land.LandData.OwnerID) | ||
5729 | { | ||
5730 | World.TeleportClientHome(agentID, presence.ControllingClient); | ||
5731 | } | ||
5727 | } | 5732 | } |
5728 | } | 5733 | } |
5729 | ScriptSleep(5000); | 5734 | ScriptSleep(5000); |
@@ -6408,24 +6413,37 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6408 | m_host.AddScriptLPS(1); | 6413 | m_host.AddScriptLPS(1); |
6409 | UUID key; | 6414 | UUID key; |
6410 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6415 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6411 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageAllowed)) | 6416 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
6412 | { | 6417 | { |
6413 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 6418 | int expires = 0; |
6419 | if (hours != 0) | ||
6420 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
6421 | |||
6414 | if (UUID.TryParse(avatar, out key)) | 6422 | if (UUID.TryParse(avatar, out key)) |
6415 | { | 6423 | { |
6416 | if (land.LandData.ParcelAccessList.FindIndex( | 6424 | int idx = land.LandData.ParcelAccessList.FindIndex( |
6417 | delegate(ParcelManager.ParcelAccessEntry e) | 6425 | delegate(LandAccessEntry e) |
6418 | { | 6426 | { |
6419 | if (e.AgentID == key && e.Flags == AccessList.Access) | 6427 | if (e.AgentID == key && e.Flags == AccessList.Access) |
6420 | return true; | 6428 | return true; |
6421 | return false; | 6429 | return false; |
6422 | }) == -1) | 6430 | }); |
6423 | { | 6431 | |
6424 | entry.AgentID = key; | 6432 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
6425 | entry.Flags = AccessList.Access; | 6433 | return; |
6426 | entry.Time = DateTime.Now.AddHours(hours); | 6434 | |
6427 | land.LandData.ParcelAccessList.Add(entry); | 6435 | if (idx != -1) |
6428 | } | 6436 | land.LandData.ParcelAccessList.RemoveAt(idx); |
6437 | |||
6438 | LandAccessEntry entry = new LandAccessEntry(); | ||
6439 | |||
6440 | entry.AgentID = key; | ||
6441 | entry.Flags = AccessList.Access; | ||
6442 | entry.Expires = expires; | ||
6443 | |||
6444 | land.LandData.ParcelAccessList.Add(entry); | ||
6445 | |||
6446 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
6429 | } | 6447 | } |
6430 | } | 6448 | } |
6431 | ScriptSleep(100); | 6449 | ScriptSleep(100); |
@@ -9679,22 +9697,35 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9679 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 9697 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
9680 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) | 9698 | if (World.Permissions.CanEditParcelProperties(m_host.OwnerID, land, GroupPowers.LandManageBanned)) |
9681 | { | 9699 | { |
9682 | ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry(); | 9700 | int expires = 0; |
9701 | if (hours != 0) | ||
9702 | expires = Util.UnixTimeSinceEpoch() + (int)(3600.0 * hours); | ||
9703 | |||
9683 | if (UUID.TryParse(avatar, out key)) | 9704 | if (UUID.TryParse(avatar, out key)) |
9684 | { | 9705 | { |
9685 | if (land.LandData.ParcelAccessList.FindIndex( | 9706 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9686 | delegate(ParcelManager.ParcelAccessEntry e) | 9707 | delegate(LandAccessEntry e) |
9687 | { | 9708 | { |
9688 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 9709 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9689 | return true; | 9710 | return true; |
9690 | return false; | 9711 | return false; |
9691 | }) == -1) | 9712 | }); |
9692 | { | 9713 | |
9693 | entry.AgentID = key; | 9714 | if (idx != -1 && (land.LandData.ParcelAccessList[idx].Expires == 0 || (expires != 0 && expires < land.LandData.ParcelAccessList[idx].Expires))) |
9694 | entry.Flags = AccessList.Ban; | 9715 | return; |
9695 | entry.Time = DateTime.Now.AddHours(hours); | 9716 | |
9696 | land.LandData.ParcelAccessList.Add(entry); | 9717 | if (idx != -1) |
9697 | } | 9718 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9719 | |||
9720 | LandAccessEntry entry = new LandAccessEntry(); | ||
9721 | |||
9722 | entry.AgentID = key; | ||
9723 | entry.Flags = AccessList.Ban; | ||
9724 | entry.Expires = expires; | ||
9725 | |||
9726 | land.LandData.ParcelAccessList.Add(entry); | ||
9727 | |||
9728 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9698 | } | 9729 | } |
9699 | } | 9730 | } |
9700 | ScriptSleep(100); | 9731 | ScriptSleep(100); |
@@ -9710,7 +9741,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9710 | if (UUID.TryParse(avatar, out key)) | 9741 | if (UUID.TryParse(avatar, out key)) |
9711 | { | 9742 | { |
9712 | int idx = land.LandData.ParcelAccessList.FindIndex( | 9743 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9713 | delegate(ParcelManager.ParcelAccessEntry e) | 9744 | delegate(LandAccessEntry e) |
9714 | { | 9745 | { |
9715 | if (e.AgentID == key && e.Flags == AccessList.Access) | 9746 | if (e.AgentID == key && e.Flags == AccessList.Access) |
9716 | return true; | 9747 | return true; |
@@ -9718,7 +9749,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9718 | }); | 9749 | }); |
9719 | 9750 | ||
9720 | if (idx != -1) | 9751 | if (idx != -1) |
9752 | { | ||
9721 | land.LandData.ParcelAccessList.RemoveAt(idx); | 9753 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9754 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9755 | } | ||
9722 | } | 9756 | } |
9723 | } | 9757 | } |
9724 | ScriptSleep(100); | 9758 | ScriptSleep(100); |
@@ -9734,7 +9768,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9734 | if (UUID.TryParse(avatar, out key)) | 9768 | if (UUID.TryParse(avatar, out key)) |
9735 | { | 9769 | { |
9736 | int idx = land.LandData.ParcelAccessList.FindIndex( | 9770 | int idx = land.LandData.ParcelAccessList.FindIndex( |
9737 | delegate(ParcelManager.ParcelAccessEntry e) | 9771 | delegate(LandAccessEntry e) |
9738 | { | 9772 | { |
9739 | if (e.AgentID == key && e.Flags == AccessList.Ban) | 9773 | if (e.AgentID == key && e.Flags == AccessList.Ban) |
9740 | return true; | 9774 | return true; |
@@ -9742,7 +9776,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9742 | }); | 9776 | }); |
9743 | 9777 | ||
9744 | if (idx != -1) | 9778 | if (idx != -1) |
9779 | { | ||
9745 | land.LandData.ParcelAccessList.RemoveAt(idx); | 9780 | land.LandData.ParcelAccessList.RemoveAt(idx); |
9781 | World.EventManager.TriggerLandObjectUpdated((uint)land.LandData.LocalID, land); | ||
9782 | } | ||
9746 | } | 9783 | } |
9747 | } | 9784 | } |
9748 | ScriptSleep(100); | 9785 | ScriptSleep(100); |
@@ -9997,7 +10034,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
9997 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10034 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
9998 | if (land.OwnerID == m_host.OwnerID) | 10035 | if (land.OwnerID == m_host.OwnerID) |
9999 | { | 10036 | { |
10000 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10037 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10001 | { | 10038 | { |
10002 | if (entry.Flags == AccessList.Ban) | 10039 | if (entry.Flags == AccessList.Ban) |
10003 | { | 10040 | { |
@@ -10014,7 +10051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10014 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; | 10051 | LandData land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).LandData; |
10015 | if (land.OwnerID == m_host.OwnerID) | 10052 | if (land.OwnerID == m_host.OwnerID) |
10016 | { | 10053 | { |
10017 | foreach (ParcelManager.ParcelAccessEntry entry in land.ParcelAccessList) | 10054 | foreach (LandAccessEntry entry in land.ParcelAccessList) |
10018 | { | 10055 | { |
10019 | if (entry.Flags == AccessList.Access) | 10056 | if (entry.Flags == AccessList.Access) |
10020 | { | 10057 | { |