*Adding and Removing Avatars from the Access/Ban List for a parcel now works, but the actual ban lines, etc are not done.

afrisby
mingchen 2007-12-16 19:53:27 +00:00
parent 2061f55007
commit e2ed1a4e1f
6 changed files with 164 additions and 7 deletions

View File

@ -301,6 +301,10 @@ namespace OpenSim.Framework
public delegate void MoveObject(LLUUID objectID, LLVector3 offset, LLVector3 grapPos, IClientAPI remoteClient);
public delegate void ParcelAccessListRequest(LLUUID agentID, LLUUID sessionID, uint flags, int sequenceID, int landLocalID,IClientAPI remote_client);
public delegate void ParcelAccessListUpdateRequest(LLUUID agentID, LLUUID sessionID,uint flags, int landLocalID, List<libsecondlife.ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client);
public delegate void ParcelPropertiesRequest(
int start_x, int start_y, int end_x, int end_y, int sequence_id, bool snap_selection, IClientAPI remote_client);
@ -453,6 +457,8 @@ namespace OpenSim.Framework
event UUIDNameRequest OnNameFromUUIDRequest;
event ParcelAccessListRequest OnParcelAccessListRequest;
event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
event ParcelPropertiesRequest OnParcelPropertiesRequest;
event ParcelDivideRequest OnParcelDivideRequest;
event ParcelJoinRequest OnParcelJoinRequest;

View File

@ -516,6 +516,8 @@ namespace OpenSim.Region.ClientStack
public event UUIDNameRequest OnNameFromUUIDRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelPropertiesRequest OnParcelPropertiesRequest;
public event ParcelDivideRequest OnParcelDivideRequest;
public event ParcelJoinRequest OnParcelJoinRequest;
@ -3117,8 +3119,33 @@ namespace OpenSim.Region.ClientStack
break;
#region Parcel related packets
case PacketType.ParcelAccessListRequest:
ParcelAccessListRequestPacket requestPacket = (ParcelAccessListRequestPacket)Pack;
if (OnParcelAccessListRequest != null)
{
OnParcelAccessListRequest(requestPacket.AgentData.AgentID, requestPacket.AgentData.SessionID, requestPacket.Data.Flags, requestPacket.Data.SequenceID, requestPacket.Data.LocalID,this);
}
break;
case PacketType.ParcelAccessListUpdate:
ParcelAccessListUpdatePacket updatePacket = (ParcelAccessListUpdatePacket)Pack;
List<ParcelManager.ParcelAccessEntry> entries = new List<ParcelManager.ParcelAccessEntry>();
foreach (ParcelAccessListUpdatePacket.ListBlock block in updatePacket.List)
{
ParcelManager.ParcelAccessEntry entry = new ParcelManager.ParcelAccessEntry();
entry.AgentID = block.ID;
entry.Flags = (ParcelManager.AccessList)block.Flags;
entry.Time = new DateTime();
entries.Add(entry);
}
if (OnParcelAccessListUpdateRequest != null)
{
OnParcelAccessListUpdateRequest(updatePacket.AgentData.AgentID, updatePacket.AgentData.SessionID, updatePacket.Data.Flags, updatePacket.Data.LocalID, entries, this);
}
break;
case PacketType.ParcelPropertiesRequest:
ParcelPropertiesRequestPacket propertiesRequest = (ParcelPropertiesRequestPacket) Pack;
if (OnParcelPropertiesRequest != null)
{
@ -3151,10 +3178,10 @@ namespace OpenSim.Region.ClientStack
}
break;
case PacketType.ParcelPropertiesUpdate:
ParcelPropertiesUpdatePacket updatePacket = (ParcelPropertiesUpdatePacket) Pack;
ParcelPropertiesUpdatePacket parcelPropertiesPacket = (ParcelPropertiesUpdatePacket) Pack;
if (OnParcelPropertiesUpdateRequest != null)
{
OnParcelPropertiesUpdateRequest(updatePacket, this);
OnParcelPropertiesUpdateRequest(parcelPropertiesPacket, this);
}
break;
case PacketType.ParcelSelectObjects:
@ -3283,10 +3310,7 @@ namespace OpenSim.Region.ClientStack
// TODO: handle this packet
MainLog.Instance.Warn("CLIENT", "unhandled AgentDataUpdateRequest packet");
break;
case PacketType.ParcelAccessListRequest:
// TODO: handle this packet
MainLog.Instance.Warn("CLIENT", "unhandled ParcelAccessListRequest packet");
break;
case PacketType.ParcelDwellRequest:
// TODO: handle this packet
MainLog.Instance.Warn("CLIENT", "unhandled ParcelDwellRequest packet");

View File

@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.LandManagement
public LandData landData = new LandData();
public List<SceneObjectGroup> primsOverMe = new List<SceneObjectGroup>();
public List<libsecondlife.ParcelManager.ParcelAccessEntry> parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
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<ParcelAccessListReplyPacket.ListBlock> list = new List<ParcelAccessListReplyPacket.ListBlock>();
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<ParcelManager.ParcelAccessEntry> entries, IClientAPI remote_client)
{
if (entries.Count == 1 && entries[0].AgentID == LLUUID.Zero)
{
entries.Clear();
}
List<ParcelManager.ParcelAccessEntry> toRemove = new List<ParcelManager.ParcelAccessEntry>();
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
/// <summary>

View File

@ -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<libsecondlife.ParcelManager.ParcelAccessEntry> 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)

View File

@ -1093,6 +1093,8 @@ namespace OpenSim.Region.Environment.Scenes
client.OnParcelSelectObjects += new ParcelSelectObjects(m_LandManager.handleParcelSelectObjectsRequest);
client.OnParcelObjectOwnerRequest +=
new ParcelObjectOwnerRequest(m_LandManager.handleParcelObjectOwnersRequest);
client.OnParcelAccessListRequest += new ParcelAccessListRequest(m_LandManager.handleParcelAccessRequest);
client.OnParcelAccessListUpdateRequest += new ParcelAccessListUpdateRequest(m_LandManager.handleParcelAccessUpdateRequest);
client.OnEstateOwnerMessage += new EstateOwnerMessageRequest(m_estateManager.handleEstateOwnerMessage);
client.OnRequestGodlikePowers += handleRequestGodlikePowers;

View File

@ -131,6 +131,8 @@ namespace SimpleApp
public event ParcelJoinRequest OnParcelJoinRequest;
public event ParcelPropertiesUpdateRequest OnParcelPropertiesUpdateRequest;
public event ParcelAccessListRequest OnParcelAccessListRequest;
public event ParcelAccessListUpdateRequest OnParcelAccessListUpdateRequest;
public event ParcelSelectObjects OnParcelSelectObjects;
public event ParcelObjectOwnerRequest OnParcelObjectOwnerRequest;
public event ObjectDeselect OnObjectDeselect;