Merge branch 'master' into careminster-presence-refactor

avinationmerge
Melanie 2010-04-21 19:51:17 +01:00
commit af778f09d5
5 changed files with 113 additions and 28 deletions

View File

@ -7078,33 +7078,91 @@ namespace OpenSim.Region.ClientStack.LindenUDP
taskID = new UUID(transfer.TransferInfo.Params, 48); taskID = new UUID(transfer.TransferInfo.Params, 48);
UUID itemID = new UUID(transfer.TransferInfo.Params, 64); UUID itemID = new UUID(transfer.TransferInfo.Params, 64);
UUID requestID = new UUID(transfer.TransferInfo.Params, 80); UUID requestID = new UUID(transfer.TransferInfo.Params, 80);
// m_log.DebugFormat(
// "[CLIENT]: Got request for asset {0} from item {1} in prim {2} by {3}",
// requestID, itemID, taskID, Name);
if (!(((Scene)m_scene).Permissions.BypassPermissions())) if (!(((Scene)m_scene).Permissions.BypassPermissions()))
{ {
if (taskID != UUID.Zero) // Prim if (taskID != UUID.Zero) // Prim
{ {
SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID); SceneObjectPart part = ((Scene)m_scene).GetSceneObjectPart(taskID);
if (part == null)
return true;
if (part.OwnerID != AgentId) if (part == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but prim does not exist",
Name, requestID, itemID, taskID);
return true; return true;
}
TaskInventoryItem tii = part.Inventory.GetInventoryItem(itemID);
if (tii == null)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item does not exist",
Name, requestID, itemID, taskID);
return true;
}
if (tii.Type == (int)AssetType.LSLText)
{
if (!((Scene)m_scene).Permissions.CanEditScript(itemID, taskID, AgentId))
return true;
}
else if (tii.Type == (int)AssetType.Notecard)
{
if (!((Scene)m_scene).Permissions.CanEditNotecard(itemID, taskID, AgentId))
return true;
}
else
{
// TODO: Change this code to allow items other than notecards and scripts to be successfully
// shared with group. In fact, this whole block of permissions checking should move to an IPermissionsModule
if (part.OwnerID != AgentId)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the prim is owned by {4}",
Name, requestID, itemID, taskID, part.OwnerID);
return true;
}
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but modify permissions are not set",
Name, requestID, itemID, taskID);
return true; return true;
}
TaskInventoryItem ti = part.Inventory.GetInventoryItem(itemID); if (tii.OwnerID != AgentId)
if (ti == null) {
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but the item is owned by {4}",
Name, requestID, itemID, taskID, tii.OwnerID);
return true; return true;
}
if (ti.OwnerID != AgentId) if ((
tii.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
!= ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer))
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but item permissions are not modify/copy/transfer",
Name, requestID, itemID, taskID);
return true; return true;
}
if ((ti.CurrentPermissions & ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) != ((uint)PermissionMask.Modify | (uint)PermissionMask.Copy | (uint)PermissionMask.Transfer)) if (tii.AssetID != requestID)
return true; {
m_log.WarnFormat(
if (ti.AssetID != requestID) "[CLIENT]: {0} requested asset {1} from item {2} in prim {3} but this does not match item's asset {4}",
Name, requestID, itemID, taskID, tii.AssetID);
return true; return true;
} }
}
}
else // Agent else // Agent
{ {
IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
@ -7123,7 +7181,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// only to notecards and scripts. All // only to notecards and scripts. All
// other asset types are always available // other asset types are always available
// //
if (assetRequestItem.AssetType == 10) if (assetRequestItem.AssetType == (int)AssetType.LSLText)
{ {
if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId)) if (!((Scene)m_scene).Permissions.CanViewScript(itemID, UUID.Zero, AgentId))
{ {
@ -7131,7 +7189,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true; return true;
} }
} }
else if (assetRequestItem.AssetType == 7) else if (assetRequestItem.AssetType == (int)AssetType.Notecard)
{ {
if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId)) if (!((Scene)m_scene).Permissions.CanViewNotecard(itemID, UUID.Zero, AgentId))
{ {
@ -7141,10 +7199,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
if (assetRequestItem.AssetID != requestID) if (assetRequestItem.AssetID != requestID)
{
m_log.WarnFormat(
"[CLIENT]: {0} requested asset {1} from item {2} but this does not match item's asset {3}",
Name, requestID, itemID, assetRequestItem.AssetID);
return true; return true;
} }
} }
} }
}
//m_assetCache.AddAssetRequest(this, transfer); //m_assetCache.AddAssetRequest(this, transfer);
@ -11376,7 +11439,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// } // }
} }
//m_log.DebugFormat("[LLCLIENTVIEW]: {0} requesting asset {1}", Name, requestID); // m_log.DebugFormat("[CLIENT]: {0} requesting asset {1}", Name, requestID);
m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived); m_assetService.Get(requestID.ToString(), transferRequest, AssetReceived);
} }

View File

@ -181,10 +181,13 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
Manager.MyScene.AssetService.Store(asset); Manager.MyScene.AssetService.Store(asset);
if (part.Inventory.UpdateInventoryItem(item)) if (part.Inventory.UpdateInventoryItem(item))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
} }
} }
} }
}
public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID, public void RequestUpdateInventoryItem(IClientAPI remoteClient, UUID transactionID,

View File

@ -1079,7 +1079,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1600,7 +1602,9 @@ namespace OpenSim.Region.CoreModules.World.Permissions
if ((part.GroupMask & (uint)PermissionMask.Modify) == 0) if ((part.GroupMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} else { }
else
{
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0) if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return false; return false;
} }
@ -1855,7 +1859,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
return GenericObjectPermission(agentID, prim, false); return GenericObjectPermission(agentID, prim, false);
} }
private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene) { private bool CanCompileScript(UUID ownerUUID, int scriptType, Scene scene)
{
//m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType); //m_log.DebugFormat("check if {0} is allowed to compile {1}", ownerUUID, scriptType);
switch (scriptType) { switch (scriptType) {
case 0: case 0:

View File

@ -202,7 +202,9 @@ namespace OpenSim.Region.Framework.Scenes
// Update item with new asset // Update item with new asset
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
group.UpdateInventoryItem(item); if (group.UpdateInventoryItem(item))
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
// Trigger rerunning of script (use TriggerRezScript event, see RezScript) // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
@ -1229,9 +1231,12 @@ namespace OpenSim.Region.Framework.Scenes
remoteClient, part, transactionID, currentItem); remoteClient, part, transactionID, currentItem);
} }
if (part.Inventory.UpdateInventoryItem(itemInfo)) if (part.Inventory.UpdateInventoryItem(itemInfo))
{
remoteClient.SendAgentAlertMessage("Notecard saved", false);
part.GetProperties(remoteClient); part.GetProperties(remoteClient);
} }
} }
}
else else
{ {
m_log.WarnFormat( m_log.WarnFormat(

View File

@ -302,6 +302,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
float dz; float dz;
Quaternion q = SensePoint.RotationOffset; Quaternion q = SensePoint.RotationOffset;
if (SensePoint.ParentGroup.RootPart.IsAttachment)
{
// In attachments, the sensor cone always orients with the
// avatar rotation. This may include a nonzero elevation if
// in mouselook.
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
q = avatar.Rotation;
}
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);