* Refactored permissions handling to extract info out of permisisons block in ClientView

* Changed some uint constants to Enum values
ThreadPoolClientBranch
lbsa71 2008-02-10 14:27:21 +00:00
parent 8d37e91454
commit e0424254bd
3 changed files with 173 additions and 184 deletions

View File

@ -406,9 +406,7 @@ namespace OpenSim.Framework
// We keep all this information for fraud purposes in the future. // We keep all this information for fraud purposes in the future.
public delegate void MoneyBalanceRequest(IClientAPI remoteClient, LLUUID agentID, LLUUID sessionID, LLUUID TransactionID); public delegate void MoneyBalanceRequest(IClientAPI remoteClient, LLUUID agentID, LLUUID sessionID, LLUUID TransactionID);
public delegate void ObjectPermissions( public delegate void ObjectPermissions(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set);
IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID,
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
public interface IClientAPI public interface IClientAPI
{ {

View File

@ -1006,7 +1006,7 @@ namespace OpenSim.Region.ClientStack
int MAX_ITEMS_PER_PACKET = 6; int MAX_ITEMS_PER_PACKET = 6;
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647; uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
InventoryDescendentsPacket descend; InventoryDescendentsPacket descend;
int i; int i;
int count; int count;
@ -1179,7 +1179,7 @@ namespace OpenSim.Region.ClientStack
public void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item) public void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item)
{ {
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647; uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply); FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
inventoryReply.AgentData.AgentID = AgentId; inventoryReply.AgentData.AgentID = AgentId;
@ -1221,7 +1221,7 @@ namespace OpenSim.Region.ClientStack
public void SendInventoryItemCreateUpdate(InventoryItemBase Item) public void SendInventoryItemCreateUpdate(InventoryItemBase Item)
{ {
Encoding enc = Encoding.ASCII; Encoding enc = Encoding.ASCII;
uint FULL_MASK_PERMISSIONS = 2147483647; uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem); UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
// TODO: don't create new blocks if recycling an old packet // TODO: don't create new blocks if recycling an old packet
InventoryReply.AgentData.AgentID = AgentId; InventoryReply.AgentData.AgentID = AgentId;
@ -3100,15 +3100,25 @@ namespace OpenSim.Region.ClientStack
} }
break; break;
case PacketType.ObjectPermissions: case PacketType.ObjectPermissions:
m_log.Warn("[CLIENT]: unhandled packet " + PacketType.ObjectPermissions.ToString()); if (OnObjectPermissions != null)
{
ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack; ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges = LLUUID AgentID = newobjPerms.AgentData.AgentID;
new List<ObjectPermissionsPacket.ObjectDataBlock>(); LLUUID SessionID = newobjPerms.AgentData.SessionID;
for (int i = 0; i < newobjPerms.ObjectData.Length; i++) for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
{ {
permChanges.Add(newobjPerms.ObjectData[i]); ObjectPermissionsPacket.ObjectDataBlock permChanges = newobjPerms.ObjectData[i];
byte field = permChanges.Field;
uint localID = permChanges.ObjectLocalID;
uint mask = permChanges.Mask;
byte set = permChanges.Set;
OnObjectPermissions(this, AgentID, SessionID, field, localID, mask, set);
}
} }
// Here's our data, // Here's our data,
@ -3123,12 +3133,6 @@ namespace OpenSim.Region.ClientStack
// Unfortunately, we have to pass the event the packet because objData is an array // Unfortunately, we have to pass the event the packet because objData is an array
// That means multiple object perms may be updated in a single packet. // That means multiple object perms may be updated in a single packet.
LLUUID AgentID = newobjPerms.AgentData.AgentID;
LLUUID SessionID = newobjPerms.AgentData.SessionID;
if (OnObjectPermissions != null)
{
OnObjectPermissions(this, AgentID, SessionID, permChanges);
}
break; break;

View File

@ -2138,29 +2138,16 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
/// <summary> public void HandleObjectPermissionsUpdate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set)
///
/// </summary>
/// <param name="controller"></param>
/// <param name="agentID"></param>
/// <param name="sessionID"></param>
/// <param name="permChanges"></param>
public void HandleObjectPermissionsUpdate(IClientAPI controller, LLUUID agentID, LLUUID sessionID,
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges)
{ {
// Check for spoofing.. since this is permissions we're talking about here! // Check for spoofing.. since this is permissions we're talking about here!
if ((controller.SessionId == sessionID) && (controller.AgentId == agentID)) if ((controller.SessionId == sessionID) && (controller.AgentId == agentID))
{ {
for (int i = 0; i < permChanges.Count; i++)
{
// Tell the object to do permission update // Tell the object to do permission update
byte field = permChanges[i].Field; SceneObjectGroup chObjectGroup = GetGroupByPrim(localId);
uint localID = permChanges[i].ObjectLocalID; chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set);
uint mask = permChanges[i].Mask;
byte addRemTF = permChanges[i].Set;
SceneObjectGroup chObjectGroup = GetGroupByPrim(localID);
chObjectGroup.UpdatePermissions(agentID, field, localID, mask, addRemTF);
}
} }
} }