* Refactored permissions handling to extract info out of permisisons block in ClientView
* Changed some uint constants to Enum valuesThreadPoolClientBranch
parent
8d37e91454
commit
e0424254bd
|
@ -406,9 +406,7 @@ namespace OpenSim.Framework
|
|||
// 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 ObjectPermissions(
|
||||
IClientAPI remoteClinet, LLUUID AgentID, LLUUID SessionID,
|
||||
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges);
|
||||
public delegate void ObjectPermissions(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set);
|
||||
|
||||
public interface IClientAPI
|
||||
{
|
||||
|
|
|
@ -1006,7 +1006,7 @@ namespace OpenSim.Region.ClientStack
|
|||
int MAX_ITEMS_PER_PACKET = 6;
|
||||
|
||||
Encoding enc = Encoding.ASCII;
|
||||
uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
|
||||
InventoryDescendentsPacket descend;
|
||||
int i;
|
||||
int count;
|
||||
|
@ -1179,7 +1179,7 @@ namespace OpenSim.Region.ClientStack
|
|||
public void SendInventoryItemDetails(LLUUID ownerID, InventoryItemBase item)
|
||||
{
|
||||
Encoding enc = Encoding.ASCII;
|
||||
uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
|
||||
FetchInventoryReplyPacket inventoryReply = (FetchInventoryReplyPacket)PacketPool.Instance.GetPacket(PacketType.FetchInventoryReply);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
inventoryReply.AgentData.AgentID = AgentId;
|
||||
|
@ -1221,7 +1221,7 @@ namespace OpenSim.Region.ClientStack
|
|||
public void SendInventoryItemCreateUpdate(InventoryItemBase Item)
|
||||
{
|
||||
Encoding enc = Encoding.ASCII;
|
||||
uint FULL_MASK_PERMISSIONS = 2147483647;
|
||||
uint FULL_MASK_PERMISSIONS = (uint)PermissionMask.All;
|
||||
UpdateCreateInventoryItemPacket InventoryReply = (UpdateCreateInventoryItemPacket)PacketPool.Instance.GetPacket(PacketType.UpdateCreateInventoryItem);
|
||||
// TODO: don't create new blocks if recycling an old packet
|
||||
InventoryReply.AgentData.AgentID = AgentId;
|
||||
|
@ -3100,15 +3100,25 @@ namespace OpenSim.Region.ClientStack
|
|||
}
|
||||
break;
|
||||
case PacketType.ObjectPermissions:
|
||||
m_log.Warn("[CLIENT]: unhandled packet " + PacketType.ObjectPermissions.ToString());
|
||||
if (OnObjectPermissions != null)
|
||||
{
|
||||
ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
|
||||
|
||||
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges =
|
||||
new List<ObjectPermissionsPacket.ObjectDataBlock>();
|
||||
LLUUID AgentID = newobjPerms.AgentData.AgentID;
|
||||
LLUUID SessionID = newobjPerms.AgentData.SessionID;
|
||||
|
||||
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,
|
||||
|
@ -3123,12 +3133,6 @@ namespace OpenSim.Region.ClientStack
|
|||
// 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.
|
||||
|
||||
LLUUID AgentID = newobjPerms.AgentData.AgentID;
|
||||
LLUUID SessionID = newobjPerms.AgentData.SessionID;
|
||||
if (OnObjectPermissions != null)
|
||||
{
|
||||
OnObjectPermissions(this, AgentID, SessionID, permChanges);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -2138,29 +2138,16 @@ namespace OpenSim.Region.Environment.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </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)
|
||||
public void HandleObjectPermissionsUpdate(IClientAPI controller, LLUUID agentID, LLUUID sessionID, byte field, uint localId, uint mask, byte set)
|
||||
{
|
||||
// Check for spoofing.. since this is permissions we're talking about here!
|
||||
if ((controller.SessionId == sessionID) && (controller.AgentId == agentID))
|
||||
{
|
||||
for (int i = 0; i < permChanges.Count; i++)
|
||||
{
|
||||
|
||||
// Tell the object to do permission update
|
||||
byte field = permChanges[i].Field;
|
||||
uint localID = permChanges[i].ObjectLocalID;
|
||||
uint mask = permChanges[i].Mask;
|
||||
byte addRemTF = permChanges[i].Set;
|
||||
SceneObjectGroup chObjectGroup = GetGroupByPrim(localID);
|
||||
chObjectGroup.UpdatePermissions(agentID, field, localID, mask, addRemTF);
|
||||
}
|
||||
SceneObjectGroup chObjectGroup = GetGroupByPrim(localId);
|
||||
chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue