diff options
author | Melanie | 2012-02-02 21:36:45 +0100 |
---|---|---|
committer | Melanie | 2012-02-02 21:36:45 +0100 |
commit | 07c487a28f6ce6d85cf32fba0c2ded724f7b5af7 (patch) | |
tree | 7852ae5fa1c6a9d91f6c5b7930615a45245b694e /OpenSim/Region/CoreModules | |
parent | Streamline banning code using existing methods. (diff) | |
download | opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.zip opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.gz opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.bz2 opensim-SC_OLD-07c487a28f6ce6d85cf32fba0c2ded724f7b5af7.tar.xz |
Make ban, eject, freeze and the scripted versions of those work.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandObject.cs | 78 |
2 files changed, 57 insertions, 27 deletions
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 | } |