From 349a17f664f661acf97896d4b778368edb822044 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sat, 17 May 2008 00:16:16 +0000 Subject: [PATCH] * Tweaked patch mantis 1302 and committing it. --- OpenSim/Framework/IClientAPI.cs | 11 +++++- .../ClientStack/LindenUDP/LLClientView.cs | 23 ++++++++++++ .../Modules/World/NPC/NPCAvatar.cs | 17 ++++++++- .../World/Permissions/PermissionsModule.cs | 4 +- .../Environment/Scenes/Scene.Inventory.cs | 2 +- .../Scenes/SceneObjectGroup.Inventory.cs | 4 +- .../Scenes/SceneObjectPart.Inventory.cs | 37 +++++++++++++++---- .../Examples/SimpleModule/MyNpcCharacter.cs | 15 ++++++++ 8 files changed, 98 insertions(+), 15 deletions(-) diff --git a/OpenSim/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 44d32958c5..098943c586 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -634,9 +634,14 @@ namespace OpenSim.Framework LLUUID SecureSessionId { get; } - [Obsolete("LLClientView Specific - Use .Name instead. Do not assume an av has two names. Adam, this is impossible to completely refactor out. Nor would I suggest it. All applications that i've ever dealt with have firstname and lastname. However the firstname and lastname are not always the username.")] + LLUUID ActiveGroupId { get; } + + string ActiveGroupName { get; } + + ulong ActiveGroupPowers { get; } + string FirstName { get; } - [Obsolete("LLClientView Specific - Use .Name instead. Do not assume an av has two names. Adam, this is impossible to completely refactor out. Nor would I suggest it. All applications that i've ever dealt with have firstname and lastname. However the firstname and lastname are not always the username.")] + string LastName { get; } [Obsolete("LLClientView Specific - Replace with ???")] @@ -655,6 +660,8 @@ namespace OpenSim.Framework set; } + + [Obsolete("LLClientView Specific - Circuits are unique to LLClientView")] uint CircuitCode { get; } [Obsolete("LLClientView Specific - Replace with more bare-bones arguments.")] diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 180a806dc0..a86941f507 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -129,6 +129,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP protected LLVector3 m_startpos; protected EndPoint m_userEndPoint; protected EndPoint m_proxyEndPoint; + protected LLUUID m_activeGroupID = LLUUID.Zero; + protected string m_activeGroupName = String.Empty; + protected ulong m_activeGroupPowers = 0; /* Instantiated Designated Event Delegates */ //- used so we don't create new objects for each incoming packet and then toss it out later */ @@ -274,6 +277,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP get { return m_agentId; } } + public LLUUID ActiveGroupId + { + get { return m_activeGroupID; } + } + + public string ActiveGroupName + { + get { return m_activeGroupName; } + } + + public ulong ActiveGroupPowers + { + get { return m_activeGroupPowers; } + } + /// /// This is a utility method used by single states to not duplicate kicks and blue card of death messages. /// @@ -1691,6 +1709,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP public void SendAgentDataUpdate(LLUUID agentid, LLUUID activegroupid, string firstname, string lastname, ulong grouppowers, string groupname, string grouptitle) { + + m_activeGroupID = activegroupid; + m_activeGroupName = groupname; + m_activeGroupPowers = grouppowers; + AgentDataUpdatePacket sendAgentDataUpdate = (AgentDataUpdatePacket)PacketPool.Instance.GetPacket(PacketType.AgentDataUpdate); sendAgentDataUpdate.AgentData.ActiveGroupID = activegroupid; sendAgentDataUpdate.AgentData.AgentID = agentid; diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs index f37e12a5e8..815a505919 100644 --- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs @@ -331,6 +331,21 @@ namespace OpenSim.Region.Environment.Modules.World.NPC set { } } + public LLUUID ActiveGroupId + { + get { return LLUUID.Zero; } + } + + public string ActiveGroupName + { + get { return String.Empty; } + } + + public ulong ActiveGroupPowers + { + get { return 0; } + } + public virtual int NextAnimationSequenceNumber { get { return 1; } @@ -743,4 +758,4 @@ namespace OpenSim.Region.Environment.Modules.World.NPC } #endregion } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs index 43e8f36d8f..a3191195ec 100644 --- a/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Permissions/PermissionsModule.cs @@ -882,7 +882,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - return true; + return false; } private bool CanViewNotecard(LLUUID notecard, LLUUID objectID, LLUUID user, Scene scene) @@ -890,7 +890,7 @@ namespace OpenSim.Region.Environment.Modules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - return true; + return false; } #endregion diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 88f0cb4e44..8b94100e1c 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -769,7 +769,7 @@ namespace OpenSim.Region.Environment.Scenes { if (XferManager != null) { - group.RequestInventoryFile(primLocalID, XferManager); + group.RequestInventoryFile(remoteClient, primLocalID, XferManager); } } } diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs index c26ff516bf..d35765cceb 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs @@ -157,12 +157,12 @@ namespace OpenSim.Region.Environment.Scenes /// /// /// - public void RequestInventoryFile(uint localID, IXfer xferManager) + public void RequestInventoryFile(IClientAPI client, uint localID, IXfer xferManager) { SceneObjectPart part = GetChildPart(localID); if (part != null) { - part.RequestInventoryFile(xferManager); + part.RequestInventoryFile(client, xferManager); } else { diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index a9dc9cfe74..8c5737cfa7 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs @@ -484,7 +484,7 @@ namespace OpenSim.Region.Environment.Scenes /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client /// /// - public void RequestInventoryFile(IXfer xferManager) + public void RequestInventoryFile(IClientAPI client, IXfer xferManager) { byte[] fileData = new byte[0]; @@ -497,23 +497,45 @@ namespace OpenSim.Region.Environment.Scenes { foreach (TaskInventoryItem item in m_taskInventory.Values) { + LLUUID ownerID=item.OwnerID; + uint everyoneMask=0; + uint baseMask=item.BaseMask; + uint ownerMask=item.OwnerMask; + + if(item.InvType == 10) // Script + { + if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanViewScript(item.ItemID, UUID, client.AgentId)) + { + ownerID=client.AgentId; + baseMask=0x7fffffff; + ownerMask=0x7fffffff; + everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer); + } + if((item.OwnerID != client.AgentId) && m_parentGroup.Scene.ExternalChecks.ExternalChecksCanEditScript(item.ItemID, UUID, client.AgentId)) + { + ownerID=client.AgentId; + baseMask=0x7fffffff; + ownerMask=0x7fffffff; + everyoneMask=(uint)(PermissionMask.Move | PermissionMask.Transfer | PermissionMask.Modify); + } + } + invString.AddItemStart(); invString.AddNameValueLine("item_id", item.ItemID.ToString()); invString.AddNameValueLine("parent_id", UUID.ToString()); invString.AddPermissionsStart(); - invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask)); - invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask)); - invString.AddNameValueLine("group_mask", "00000000"); - invString.AddNameValueLine("everyone_mask", "00000000"); + invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(baseMask)); + invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(ownerMask)); + invString.AddNameValueLine("group_mask", Helpers.UIntToHexString(0)); + invString.AddNameValueLine("everyone_mask", Helpers.UIntToHexString(everyoneMask)); invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); - invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); + invString.AddNameValueLine("owner_id", ownerID.ToString()); invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); -// invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString()); invString.AddNameValueLine("group_id", item.GroupID.ToString()); invString.AddSectionEnd(); @@ -538,6 +560,7 @@ namespace OpenSim.Region.Environment.Scenes fileData = Helpers.StringToField(invString.BuildString); + //Console.WriteLine(Helpers.FieldToUTF8String(fileData)); //m_log.Debug("[PRIM INVENTORY]: RequestInventoryFile fileData: " + Helpers.FieldToUTF8String(fileData)); if (fileData.Length > 2) diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 78b5d1fab3..ca8636f4e4 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -246,6 +246,21 @@ namespace OpenSim.Region.Examples.SimpleModule set { } } + public LLUUID ActiveGroupId + { + get { return LLUUID.Zero; } + } + + public string ActiveGroupName + { + get { return String.Empty; } + } + + public ulong ActiveGroupPowers + { + get { return 0; } + } + public virtual int NextAnimationSequenceNumber { get { return 1; }