* 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

@ -51,10 +51,10 @@ namespace OpenSim.Region.ClientStack
/// </summary> /// </summary>
public class ClientView : IClientAPI public class ClientView : IClientAPI
{ {
// ~ClientView() // ~ClientView()
// { // {
// System.Console.WriteLine("[CLIENTVIEW]: Destructor called"); // System.Console.WriteLine("[CLIENTVIEW]: Destructor called");
// } // }
private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@ -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;
@ -1602,7 +1602,7 @@ namespace OpenSim.Region.ClientStack
terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1]; terse.ObjectData = new ImprovedTerseObjectUpdatePacket.ObjectDataBlock[1];
terse.ObjectData[0] = terseBlock; terse.ObjectData[0] = terseBlock;
terse.Header.Reliable = false; terse.Header.Reliable = false;
OutPacket(terse, ThrottleOutPacketType.Task); OutPacket(terse, ThrottleOutPacketType.Task);
@ -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;
List<ObjectPermissionsPacket.ObjectDataBlock> permChanges =
new List<ObjectPermissionsPacket.ObjectDataBlock>();
for (int i = 0; i < newobjPerms.ObjectData.Length; i++)
{ {
permChanges.Add(newobjPerms.ObjectData[i]); ObjectPermissionsPacket newobjPerms = (ObjectPermissionsPacket)Pack;
LLUUID AgentID = newobjPerms.AgentData.AgentID;
LLUUID SessionID = newobjPerms.AgentData.SessionID;
for (int i = 0; i < newobjPerms.ObjectData.Length; 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

@ -46,9 +46,9 @@ using OpenSim.Region.Environment.Modules;
using OpenSim.Region.Environment.Scenes.Scripting; using OpenSim.Region.Environment.Scenes.Scripting;
using OpenSim.Region.Physics.Manager; using OpenSim.Region.Physics.Manager;
using OpenSim.Region.Terrain; using OpenSim.Region.Terrain;
using Caps=OpenSim.Region.Capabilities.Caps; using Caps = OpenSim.Region.Capabilities.Caps;
using Image=System.Drawing.Image; using Image = System.Drawing.Image;
using Timer=System.Timers.Timer; using Timer = System.Timers.Timer;
namespace OpenSim.Region.Environment.Scenes namespace OpenSim.Region.Environment.Scenes
{ {
@ -193,10 +193,10 @@ namespace OpenSim.Region.Environment.Scenes
} }
// Local reference to the objects in the scene (which are held in innerScene) // Local reference to the objects in the scene (which are held in innerScene)
// public Dictionary<LLUUID, SceneObjectGroup> Objects // public Dictionary<LLUUID, SceneObjectGroup> Objects
// { // {
// get { return m_innerScene.SceneObjects; } // get { return m_innerScene.SceneObjects; }
// } // }
// Reference to all of the agents in the scene (root and child) // Reference to all of the agents in the scene (root and child)
protected Dictionary<LLUUID, ScenePresence> m_scenePresences protected Dictionary<LLUUID, ScenePresence> m_scenePresences
@ -205,11 +205,11 @@ namespace OpenSim.Region.Environment.Scenes
set { m_innerScene.ScenePresences = value; } set { m_innerScene.ScenePresences = value; }
} }
// protected Dictionary<LLUUID, SceneObjectGroup> m_sceneObjects // protected Dictionary<LLUUID, SceneObjectGroup> m_sceneObjects
// { // {
// get { return m_innerScene.SceneObjects; } // get { return m_innerScene.SceneObjects; }
// set { m_innerScene.SceneObjects = value; } // set { m_innerScene.SceneObjects = value; }
// } // }
public Dictionary<LLUUID, EntityBase> Entities public Dictionary<LLUUID, EntityBase> Entities
{ {
@ -278,7 +278,7 @@ namespace OpenSim.Region.Environment.Scenes
//m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>(); //m_sceneObjects = new Dictionary<LLUUID, SceneObjectGroup>();
m_log.Info("[SCENE]: Creating LandMap"); m_log.Info("[SCENE]: Creating LandMap");
Terrain = new TerrainEngine((int) RegionInfo.RegionLocX, (int) RegionInfo.RegionLocY); Terrain = new TerrainEngine((int)RegionInfo.RegionLocX, (int)RegionInfo.RegionLocY);
httpListener = httpServer; httpListener = httpServer;
m_dumpAssetsToFile = dumpAssetsToFile; m_dumpAssetsToFile = dumpAssetsToFile;
@ -314,7 +314,7 @@ namespace OpenSim.Region.Environment.Scenes
} }
if (OSString.Length > 45) if (OSString.Length > 45)
{ {
OSString = OSString.Substring(0,45); OSString = OSString.Substring(0, 45);
} }
m_simulatorVersion = "OpenSimulator v0.5-SVN on " + OSString + " ChilTasks:" + m_sendTasksToChild.ToString() + " PhysPrim:" + m_physicalPrim.ToString(); m_simulatorVersion = "OpenSimulator v0.5-SVN on " + OSString + " ChilTasks:" + m_sendTasksToChild.ToString() + " PhysPrim:" + m_physicalPrim.ToString();
@ -383,7 +383,7 @@ namespace OpenSim.Region.Environment.Scenes
int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX); int resultX = Math.Abs((int)otherRegion.RegionLocX - (int)RegionInfo.RegionLocX);
int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY); int resultY = Math.Abs((int)otherRegion.RegionLocY - (int)RegionInfo.RegionLocY);
if ((resultX <= 1) && if ((resultX <= 1) &&
( resultY <= 1)) (resultY <= 1))
{ {
try try
{ {
@ -434,11 +434,11 @@ namespace OpenSim.Region.Environment.Scenes
{ {
// Now we figure out what to set the timer to that does the notifications and calls, RestartNow() // Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
m_restartTimer.Interval = 15000; m_restartTimer.Interval = 15000;
m_incrementsof15seconds = (int) seconds/15; m_incrementsof15seconds = (int)seconds / 15;
m_RestartTimerCounter = 0; m_RestartTimerCounter = 0;
m_restartTimer.AutoReset = true; m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Error("[REGION]: Restarting Region in " + (seconds/60) + " minutes"); m_log.Error("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start(); m_restartTimer.Start();
SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); SendRegionMessageFromEstateTools(LLUUID.Random(), LLUUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes");
//SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); //SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes");
@ -459,7 +459,7 @@ namespace OpenSim.Region.Environment.Scenes
((8 - m_RestartTimerCounter) * 15) + " seconds"); ((8 - m_RestartTimerCounter) * 15) + " seconds");
// SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) + // SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) +
//" seconds"); //" seconds");
} }
else else
{ {
@ -612,7 +612,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
m_log.Debug("[SCENE]: Starting timer"); m_log.Debug("[SCENE]: Starting timer");
m_heartbeatTimer.Enabled = true; m_heartbeatTimer.Enabled = true;
m_heartbeatTimer.Interval = (int) (m_timespan*1000); m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
} }
@ -683,39 +683,39 @@ namespace OpenSim.Region.Environment.Scenes
m_frame = 0; m_frame = 0;
physicsMS2 = System.Environment.TickCount; physicsMS2 = System.Environment.TickCount;
if ((m_frame%m_update_physics == 0) && m_physics_enabled) if ((m_frame % m_update_physics == 0) && m_physics_enabled)
m_innerScene.UpdatePreparePhysics(); m_innerScene.UpdatePreparePhysics();
physicsMS2 = System.Environment.TickCount - physicsMS2; physicsMS2 = System.Environment.TickCount - physicsMS2;
if (m_frame%m_update_entitymovement == 0) if (m_frame % m_update_entitymovement == 0)
m_innerScene.UpdateEntityMovement(); m_innerScene.UpdateEntityMovement();
physicsMS = System.Environment.TickCount; physicsMS = System.Environment.TickCount;
if ((m_frame%m_update_physics == 0) && m_physics_enabled) if ((m_frame % m_update_physics == 0) && m_physics_enabled)
physicsFPS = m_innerScene.UpdatePhysics( physicsFPS = m_innerScene.UpdatePhysics(
Math.Max(SinceLastFrame.TotalSeconds, m_timespan) Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
); );
physicsMS = System.Environment.TickCount - physicsMS; physicsMS = System.Environment.TickCount - physicsMS;
physicsMS += physicsMS2; physicsMS += physicsMS2;
otherMS = System.Environment.TickCount; otherMS = System.Environment.TickCount;
if (m_frame%m_update_entities == 0) if (m_frame % m_update_entities == 0)
m_innerScene.UpdateEntities(); m_innerScene.UpdateEntities();
if (m_frame%m_update_events == 0) if (m_frame % m_update_events == 0)
UpdateEvents(); UpdateEvents();
if (m_frame%m_update_backup == 0) if (m_frame % m_update_backup == 0)
UpdateStorageBackup(); UpdateStorageBackup();
if (m_frame%m_update_terrain == 0) if (m_frame % m_update_terrain == 0)
UpdateTerrain(); UpdateTerrain();
if (m_frame%m_update_land == 0) if (m_frame % m_update_land == 0)
UpdateLand(); UpdateLand();
otherMS = System.Environment.TickCount - otherMS; otherMS = System.Environment.TickCount - otherMS;
// if (m_frame%m_update_avatars == 0) // if (m_frame%m_update_avatars == 0)
// UpdateInWorldTime(); // UpdateInWorldTime();
m_statsReporter.AddPhysicsFPS(physicsFPS); m_statsReporter.AddPhysicsFPS(physicsFPS);
@ -746,7 +746,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
updateLock.ReleaseMutex(); updateLock.ReleaseMutex();
m_timedilation = m_timespan/(float) SinceLastFrame.TotalSeconds; m_timedilation = m_timespan / (float)SinceLastFrame.TotalSeconds;
m_lastupdate = DateTime.Now; m_lastupdate = DateTime.Now;
} }
} }
@ -871,10 +871,10 @@ namespace OpenSim.Region.Environment.Scenes
public void ExportWorldMap(string fileName) public void ExportWorldMap(string fileName)
{ {
List<MapBlockData> mapBlocks = List<MapBlockData> mapBlocks =
CommsManager.GridService.RequestNeighbourMapBlocks((int) (RegionInfo.RegionLocX - 9), CommsManager.GridService.RequestNeighbourMapBlocks((int)(RegionInfo.RegionLocX - 9),
(int) (RegionInfo.RegionLocY - 9), (int)(RegionInfo.RegionLocY - 9),
(int) (RegionInfo.RegionLocX + 9), (int)(RegionInfo.RegionLocX + 9),
(int) (RegionInfo.RegionLocY + 9)); (int)(RegionInfo.RegionLocY + 9));
List<AssetBase> textures = new List<AssetBase>(); List<AssetBase> textures = new List<AssetBase>();
List<Image> bitImages = new List<Image>(); List<Image> bitImages = new List<Image>();
@ -909,9 +909,9 @@ namespace OpenSim.Region.Environment.Scenes
for (int i = 0; i < mapBlocks.Count; i++) for (int i = 0; i < mapBlocks.Count; i++)
{ {
ushort x = (ushort) ((mapBlocks[i].X - RegionInfo.RegionLocX) + 10); ushort x = (ushort)((mapBlocks[i].X - RegionInfo.RegionLocX) + 10);
ushort y = (ushort) ((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10); ushort y = (ushort)((mapBlocks[i].Y - RegionInfo.RegionLocY) + 10);
g.DrawImage(bitImages[i], (x*128), (y*128), 128, 128); g.DrawImage(bitImages[i], (x * 128), (y * 128), 128, 128);
} }
mapTexture.Save(fileName, ImageFormat.Jpeg); mapTexture.Save(fileName, ImageFormat.Jpeg);
} }
@ -1019,17 +1019,17 @@ namespace OpenSim.Region.Environment.Scenes
public void loadAllLandObjectsFromStorage() public void loadAllLandObjectsFromStorage()
{ {
m_log.Info("[SCENE]: Loading land objects from storage"); m_log.Info("[SCENE]: Loading land objects from storage");
List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID); List<LandData> landData = m_storageManager.DataStore.LoadLandObjects(RegionInfo.RegionID);
if (landData.Count == 0) if (landData.Count == 0)
{ {
m_LandManager.NoLandDataFromStorage(); m_LandManager.NoLandDataFromStorage();
} }
else else
{ {
m_LandManager.IncomingLandObjectsFromStorage(landData); m_LandManager.IncomingLandObjectsFromStorage(landData);
} }
} }
#endregion #endregion
@ -1095,42 +1095,42 @@ namespace OpenSim.Region.Environment.Scenes
//ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID)); //ScenePresence presence = ((ScenePresence)GetScenePresence(ownerID));
//if (presence != null) //if (presence != null)
//{ //{
//Vector3 CameraPosition = presence.CameraPosition; //Vector3 CameraPosition = presence.CameraPosition;
//Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z); //Vector3 rayEnd = new Vector3(pos.X, pos.Y, pos.Z);
//float rayMag = m_innerScene.Vector3Distance(CameraPosition, rayEnd); //float rayMag = m_innerScene.Vector3Distance(CameraPosition, rayEnd);
//LLVector3 rayDirectionLL = Util.GetNormal(pos); //LLVector3 rayDirectionLL = Util.GetNormal(pos);
//Vector3 rayDirection = new Vector3(rayDirectionLL.X, rayDirectionLL.Y, rayDirectionLL.Z); //Vector3 rayDirection = new Vector3(rayDirectionLL.X, rayDirectionLL.Y, rayDirectionLL.Z);
//Ray rezRay = new Ray(CameraPosition, rayDirection); //Ray rezRay = new Ray(CameraPosition, rayDirection);
//Vector3 RezDirectionFromCamera = rezRay.Direction; //Vector3 RezDirectionFromCamera = rezRay.Direction;
//rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay); //rayTracing = m_innerScene.GetClosestIntersectingPrim(rezRay);
//} //}
//if ((rayTracing != null) && (rayTracing.HitTF)) //if ((rayTracing != null) && (rayTracing.HitTF))
//{ //{
// We raytraced and found a prim in the way of the ground.. so // We raytraced and found a prim in the way of the ground.. so
// We will rez the object somewhere close to the prim. Better math needed. This is a Stub // We will rez the object somewhere close to the prim. Better math needed. This is a Stub
//Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z); //Vector3 Newpos = new Vector3(rayTracing.obj.AbsolutePosition.X,rayTracing.obj.AbsolutePosition.Y,rayTracing.obj.AbsolutePosition.Z);
//Vector3 Newpos = rayTracing.ipoint; //Vector3 Newpos = rayTracing.ipoint;
//Vector3 NewScale = //Vector3 NewScale =
//new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z); //new Vector3(rayTracing.obj.Scale.X, rayTracing.obj.Scale.Y, rayTracing.obj.Scale.Z);
//Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation; //Quaternion ParentRot = rayTracing.obj.ParentGroup.Rotation;
//Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z); //Quaternion ParentRot = new Quaternion(primParentRot.W,primParentRot.X,primParentRot.Y,primParentRot.Z);
//LLQuaternion primLocalRot = rayTracing.obj.RotationOffset; //LLQuaternion primLocalRot = rayTracing.obj.RotationOffset;
//Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z); //Quaternion LocalRot = new Quaternion(primLocalRot.W, primLocalRot.X, primLocalRot.Y, primLocalRot.Z);
//Quaternion NewRot = LocalRot * ParentRot; //Quaternion NewRot = LocalRot * ParentRot;
//Vector3 RezPoint = Newpos; //Vector3 RezPoint = Newpos;
//m_log.Info("[REZINFO]: Possible Rez Point:" + RezPoint.ToString()); //m_log.Info("[REZINFO]: Possible Rez Point:" + RezPoint.ToString());
//pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z); //pos = new LLVector3(RezPoint.x, RezPoint.y, RezPoint.z);
//} //}
return pos; return pos;
@ -1159,7 +1159,7 @@ namespace OpenSim.Region.Environment.Scenes
if (PermissionsMngr.CanRezObject(ownerID, pos)) if (PermissionsMngr.CanRezObject(ownerID, pos))
{ {
// rez ON the ground, not IN the ground // rez ON the ground, not IN the ground
pos.Z += 0.25F; pos.Z += 0.25F;
AddNewPrim(ownerID, pos, rot, shape); AddNewPrim(ownerID, pos, rot, shape);
@ -1192,9 +1192,9 @@ namespace OpenSim.Region.Environment.Scenes
PrimitiveBaseShape treeShape = new PrimitiveBaseShape(); PrimitiveBaseShape treeShape = new PrimitiveBaseShape();
treeShape.PathCurve = 16; treeShape.PathCurve = 16;
treeShape.PathEnd = 49900; treeShape.PathEnd = 49900;
treeShape.PCode = newTree ? (byte) PCode.NewTree : (byte) PCode.Tree; treeShape.PCode = newTree ? (byte)PCode.NewTree : (byte)PCode.Tree;
treeShape.Scale = scale; treeShape.Scale = scale;
treeShape.State = (byte) treeType; treeShape.State = (byte)treeType;
return AddNewPrim(uuid, position, rotation, treeShape); return AddNewPrim(uuid, position, rotation, treeShape);
} }
@ -1680,7 +1680,7 @@ namespace OpenSim.Region.Environment.Scenes
m_innerScene.removeUserCount(true); m_innerScene.removeUserCount(true);
} }
// Tell a single agent to disconnect from the region. // Tell a single agent to disconnect from the region.
libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket) PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator); libsecondlife.Packets.DisableSimulatorPacket disable = (libsecondlife.Packets.DisableSimulatorPacket)PacketPool.Instance.GetPacket(libsecondlife.Packets.PacketType.DisableSimulator);
presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
presence.ControllingClient.Close(true); presence.ControllingClient.Close(true);
} }
@ -1794,9 +1794,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="mod"></param> /// <param name="mod"></param>
public void RegisterModuleInterface<M>(M mod) public void RegisterModuleInterface<M>(M mod)
{ {
if (!ModuleInterfaces.ContainsKey(typeof (M))) if (!ModuleInterfaces.ContainsKey(typeof(M)))
{ {
ModuleInterfaces.Add(typeof (M), mod); ModuleInterfaces.Add(typeof(M), mod);
} }
} }
@ -1806,9 +1806,9 @@ namespace OpenSim.Region.Environment.Scenes
/// <returns></returns> /// <returns></returns>
public T RequestModuleInterface<T>() public T RequestModuleInterface<T>()
{ {
if (ModuleInterfaces.ContainsKey(typeof (T))) if (ModuleInterfaces.ContainsKey(typeof(T)))
{ {
return (T) ModuleInterfaces[typeof (T)]; return (T)ModuleInterfaces[typeof(T)];
} }
else else
{ {
@ -1851,11 +1851,11 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID,string message,LLUUID TextureID,int ch,string[] buttonlabels) public void SendDialogToUser(LLUUID avatarID, string objectName, LLUUID objectID, LLUUID ownerID, string message, LLUUID TextureID, int ch, string[] buttonlabels)
{ {
if (m_scenePresences.ContainsKey(avatarID)) if (m_scenePresences.ContainsKey(avatarID))
{ {
m_scenePresences[avatarID].ControllingClient.SendDialog(objectName,objectID,ownerID,message,TextureID,ch,buttonlabels); m_scenePresences[avatarID].ControllingClient.SendDialog(objectName, objectID, ownerID, message, TextureID, ch, buttonlabels);
} }
} }
@ -1883,7 +1883,7 @@ namespace OpenSim.Region.Environment.Scenes
m_LandManager.resetAllLandPrimCounts(); m_LandManager.resetAllLandPrimCounts();
m_eventManager.TriggerParcelPrimCountUpdate(); m_eventManager.TriggerParcelPrimCountUpdate();
m_LandManager.finalizeLandPrimCountUpdate(); m_LandManager.finalizeLandPrimCountUpdate();
m_LandManager.landPrimCountTainted = false; m_LandManager.landPrimCountTainted = false;
} }
/// <summary> /// <summary>
@ -1895,7 +1895,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (obj is SceneObjectGroup) if (obj is SceneObjectGroup)
{ {
m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup) obj); m_eventManager.TriggerParcelPrimCountAdd((SceneObjectGroup)obj);
} }
} }
} }
@ -1910,9 +1910,9 @@ namespace OpenSim.Region.Environment.Scenes
/// </summary> /// </summary>
/// <param name="message">object containing the instant message data</param> /// <param name="message">object containing the instant message data</param>
/// <returns>void</returns> /// <returns>void</returns>
public void TriggerGridInstantMessage(GridInstantMessage message,InstantMessageReceiver options) public void TriggerGridInstantMessage(GridInstantMessage message, InstantMessageReceiver options)
{ {
m_eventManager.TriggerGridInstantMessage(message,options); m_eventManager.TriggerGridInstantMessage(message, options);
} }
@ -2108,7 +2108,7 @@ namespace OpenSim.Region.Environment.Scenes
ScenePresence p = GetScenePresence(controller.AgentId); ScenePresence p = GetScenePresence(controller.AgentId);
bool childagent = !p.Equals(null) && p.IsChildAgent; bool childagent = !p.Equals(null) && p.IsChildAgent;
if (controller.AgentId != godID && !childagent) if (controller.AgentId != godID && !childagent)
// Do we really want to kick the initiator of this madness? // Do we really want to kick the initiator of this madness?
{ {
controller.Close(true); controller.Close(true);
} }
@ -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 SceneObjectGroup chObjectGroup = GetGroupByPrim(localId);
byte field = permChanges[i].Field; chObjectGroup.UpdatePermissions(agentID, field, localId, mask, set);
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);
}
} }
} }
@ -2226,7 +2213,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
((SceneObjectGroup) ent).ScheduleGroupForFullUpdate(); ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate();
} }
} }
} }
@ -2246,7 +2233,7 @@ namespace OpenSim.Region.Environment.Scenes
{ {
if (ent is SceneObjectGroup) if (ent is SceneObjectGroup)
{ {
SceneObjectPart part = ((SceneObjectGroup) ent).GetChildPart(((SceneObjectGroup) ent).UUID); SceneObjectPart part = ((SceneObjectGroup)ent).GetChildPart(((SceneObjectGroup)ent).UUID);
if (part != null) if (part != null)
{ {
if (part.Name == cmdparams[0]) if (part.Name == cmdparams[0])
@ -2493,20 +2480,20 @@ namespace OpenSim.Region.Environment.Scenes
/// ///
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
// public void ForEachObject(Action<SceneObjectGroup> action) // public void ForEachObject(Action<SceneObjectGroup> action)
// { // {
// List<SceneObjectGroup> presenceList; // List<SceneObjectGroup> presenceList;
// //
// lock (m_sceneObjects) // lock (m_sceneObjects)
// { // {
// presenceList = new List<SceneObjectGroup>(m_sceneObjects.Values); // presenceList = new List<SceneObjectGroup>(m_sceneObjects.Values);
// } // }
// //
// foreach (SceneObjectGroup presence in presenceList) // foreach (SceneObjectGroup presence in presenceList)
// { // {
// action(presence); // action(presence);
// } // }
// } // }
/// <summary> /// <summary>
/// ///