From e2ed1a4e1f2776e5b929207f1ca6e271a4d6f6e1 Mon Sep 17 00:00:00 2001 From: mingchen Date: Sun, 16 Dec 2007 19:53:27 +0000 Subject: *Adding and Removing Avatars from the Access/Ban List for a parcel now works, but the actual ban lines, etc are not done. --- OpenSim/Region/Environment/LandManagement/Land.cs | 101 ++++++++++++++++++++- .../Environment/LandManagement/LandManager.cs | 24 +++++ 2 files changed, 124 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Environment/LandManagement') diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs index a738bc0..791b3ea 100644 --- a/OpenSim/Region/Environment/LandManagement/Land.cs +++ b/OpenSim/Region/Environment/LandManagement/Land.cs @@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.LandManagement public LandData landData = new LandData(); public List primsOverMe = new List(); - + public List parcelAccessList = new List(); public Scene m_scene; private bool[,] landBitmap = new bool[64,64]; @@ -242,6 +242,105 @@ namespace OpenSim.Region.Environment.LandManagement #endregion + #region AccessList Functions + + public ParcelAccessListReplyPacket.ListBlock[] createAccessListArrayByFlag(ParcelManager.AccessList flag) + { + List list = new List(); + foreach (ParcelManager.ParcelAccessEntry entry in parcelAccessList) + { + if (entry.Flags == flag) + { + ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); + + listBlock.Flags = (uint)0; + listBlock.ID = entry.AgentID; + listBlock.Time = 0; + + list.Add(listBlock); + } + } + + if (list.Count == 0) + { + ParcelAccessListReplyPacket.ListBlock listBlock = new ParcelAccessListReplyPacket.ListBlock(); + + listBlock.Flags = (uint)0; + listBlock.ID = LLUUID.Zero; + listBlock.Time = 0; + + list.Add(listBlock); + } + return list.ToArray(); + } + + public void sendAccessList(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, IClientAPI remote_client) + { + + ParcelAccessListReplyPacket replyPacket; + + if (flags == (uint)ParcelManager.AccessList.Access || flags == (uint)ParcelManager.AccessList.Both) + { + replyPacket = new ParcelAccessListReplyPacket(); + replyPacket.Data.AgentID = agentID; + replyPacket.Data.Flags = (uint)ParcelManager.AccessList.Access; + replyPacket.Data.LocalID = this.landData.localID; + replyPacket.Data.SequenceID = 0; + + replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Access); + remote_client.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task); + } + + if (flags == (uint)ParcelManager.AccessList.Ban || flags == (uint)ParcelManager.AccessList.Both) + { + replyPacket = new ParcelAccessListReplyPacket(); + replyPacket.Data.AgentID = agentID; + replyPacket.Data.Flags = (uint)ParcelManager.AccessList.Ban; + replyPacket.Data.LocalID = this.landData.localID; + replyPacket.Data.SequenceID = 0; + + replyPacket.List = createAccessListArrayByFlag(ParcelManager.AccessList.Ban); + remote_client.OutPacket((Packet)replyPacket, ThrottleOutPacketType.Task); + } + + } + + public void updateAccessList(uint flags, List entries, IClientAPI remote_client) + { + if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero) + { + entries.Clear(); + } + + List toRemove = new List(); + foreach (ParcelManager.ParcelAccessEntry entry in parcelAccessList) + { + if (entry.Flags == (ParcelManager.AccessList)flags) + { + toRemove.Add(entry); + } + } + + foreach (ParcelManager.ParcelAccessEntry entry in toRemove) + { + parcelAccessList.Remove(entry); + } + foreach (ParcelManager.ParcelAccessEntry entry in entries) + { + ParcelManager.ParcelAccessEntry temp = new ParcelManager.ParcelAccessEntry(); + temp.AgentID = entry.AgentID; + temp.Time = new DateTime() ; //Pointless? Yes. + temp.Flags = (ParcelManager.AccessList)flags; + + if (!this.parcelAccessList.Contains(temp)) + { + this.parcelAccessList.Add(temp); + } + } + } + + #endregion + #region Update Functions /// diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs index c0fa296..0fa2c23 100644 --- a/OpenSim/Region/Environment/LandManagement/LandManager.cs +++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs @@ -554,6 +554,30 @@ namespace OpenSim.Region.Environment.LandManagement } } + + public void handleParcelAccessRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID, IClientAPI remote_client) + { + if (landList.ContainsKey(landLocalID)) + { + landList[landLocalID].sendAccessList(agentID, sessionID, flags, sequenceID,remote_client); + } + } + + public void handleParcelAccessUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List entries, IClientAPI remote_client) + { + if (landList.ContainsKey(landLocalID)) + { + if (agentID == landList[landLocalID].landData.ownerID) + { + landList[landLocalID].updateAccessList(flags, entries, remote_client); + } + } + else + { + Console.WriteLine("INVALID LOCAL LAND ID"); + } + } + public void resetAllLandPrimCounts() { foreach (Land p in landList.Values) -- cgit v1.1