diff options
author | Justin Clark-Casey (justincc) | 2012-07-26 23:44:29 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-07-26 23:44:29 +0100 |
commit | 66824dd18c331423914e0df414edb662ddf43869 (patch) | |
tree | 2b11e6762e686be5b6e429f796e465d58967705f /OpenSim/Region | |
parent | Move Watchdog and MemoryWatchdog classes into OpenSim.Framework.Monitoring wi... (diff) | |
download | opensim-SC_OLD-66824dd18c331423914e0df414edb662ddf43869.zip opensim-SC_OLD-66824dd18c331423914e0df414edb662ddf43869.tar.gz opensim-SC_OLD-66824dd18c331423914e0df414edb662ddf43869.tar.bz2 opensim-SC_OLD-66824dd18c331423914e0df414edb662ddf43869.tar.xz |
When copying items, copy the item description field instead of the asset description field.
If we copy the asset description then we will only ever replicate the very first description, if there was one, not any subsequent changes.
Thanks to Oren Hurvitz of Kitely for this patch from http://opensimulator.org/mantis/view.php?id=6107
I have adapted it slightly to change the order of arguments (name before description rather than vice-versa) and slightly improve some method doc.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | 5 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 69 |
2 files changed, 49 insertions, 25 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7d51eed..8b34c28 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -204,8 +204,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
204 | 204 | ||
205 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); | 205 | AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); |
206 | m_Scene.AssetService.Store(asset); | 206 | m_Scene.AssetService.Store(asset); |
207 | 207 | m_Scene.CreateNewInventoryItem( | |
208 | m_Scene.CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | 208 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
209 | name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate); | ||
209 | } | 210 | } |
210 | else | 211 | else |
211 | { | 212 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index e413281..d18fffd 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -814,16 +814,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
814 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) | 814 | && oldAgentID == LibraryService.LibraryRootFolder.Owner)) |
815 | { | 815 | { |
816 | CreateNewInventoryItem( | 816 | CreateNewInventoryItem( |
817 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, | 817 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, |
818 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 818 | newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType, |
819 | item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, | ||
820 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | ||
819 | } | 821 | } |
820 | else | 822 | else |
821 | { | 823 | { |
822 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. | 824 | // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. |
823 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) && (m_permissions.BypassPermissions() || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) | 825 | if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) |
826 | && (m_permissions.BypassPermissions() | ||
827 | || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) | ||
824 | { | 828 | { |
825 | CreateNewInventoryItem( | 829 | CreateNewInventoryItem( |
826 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, | 830 | remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID, |
827 | asset, (sbyte) item.InvType, | 831 | asset, (sbyte) item.InvType, |
828 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, | 832 | item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, |
829 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); | 833 | item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); |
@@ -870,32 +874,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
870 | /// <summary> | 874 | /// <summary> |
871 | /// Create a new inventory item. | 875 | /// Create a new inventory item. |
872 | /// </summary> | 876 | /// </summary> |
873 | /// <param name="remoteClient"></param> | 877 | /// <param name="remoteClient">Client creating this inventory item.</param> |
874 | /// <param name="folderID"></param> | 878 | /// <param name="creatorID"></param> |
875 | /// <param name="callbackID"></param> | 879 | /// <param name="creatorData"></param> |
876 | /// <param name="asset"></param> | 880 | /// <param name="folderID">UUID of folder in which this item should be placed.</param> |
877 | /// <param name="invType"></param> | 881 | /// <param name="name">Item name.</para> |
878 | /// <param name="nextOwnerMask"></param> | 882 | /// <param name="description">Item description.</param> |
879 | public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, | 883 | /// <param name="flags">Item flags</param> |
880 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | 884 | /// <param name="callbackID">Generated by the client.</para> |
885 | /// <param name="asset">Asset to which this item refers.</param> | ||
886 | /// <param name="invType">Type of inventory item.</param> | ||
887 | /// <param name="nextOwnerMask">Next owner pemrissions mask.</param> | ||
888 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> | ||
889 | public void CreateNewInventoryItem( | ||
890 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, | ||
891 | string name, string description, uint flags, uint callbackID, | ||
892 | AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) | ||
881 | { | 893 | { |
882 | CreateNewInventoryItem( | 894 | CreateNewInventoryItem( |
883 | remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, | 895 | remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType, |
884 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); | 896 | (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); |
885 | } | 897 | } |
886 | 898 | ||
887 | /// <summary> | 899 | /// <summary> |
888 | /// Create a new Inventory Item | 900 | /// Create a new Inventory Item |
889 | /// </summary> | 901 | /// </summary> |
890 | /// <param name="remoteClient"></param> | 902 | /// <param name="remoteClient">Client creating this inventory item.</param> |
891 | /// <param name="folderID"></param> | 903 | /// <param name="creatorID"></param> |
892 | /// <param name="callbackID"></param> | 904 | /// <param name="creatorData"></param> |
893 | /// <param name="asset"></param> | 905 | /// <param name="folderID">UUID of folder in which this item should be placed.</param> |
894 | /// <param name="invType"></param> | 906 | /// <param name="name">Item name.</para> |
895 | /// <param name="nextOwnerMask"></param> | 907 | /// <param name="description">Item description.</param> |
896 | /// <param name="creationDate"></param> | 908 | /// <param name="flags">Item flags</param> |
909 | /// <param name="callbackID">Generated by the client.</para> | ||
910 | /// <param name="asset">Asset to which this item refers.</param> | ||
911 | /// <param name="invType">Type of inventory item.</param> | ||
912 | /// <param name="baseMask">Base permissions mask.</param> | ||
913 | /// <param name="currentMask">Current permissions mask.</param> | ||
914 | /// <param name="everyoneMask">Everyone permissions mask.</param> | ||
915 | /// <param name="nextOwnerMask">Next owner pemrissions mask.</param> | ||
916 | /// <param name="groupMask">Group permissions mask.</param> | ||
917 | /// <param name="creationDate">Unix timestamp at which this item was created.</param> | ||
897 | private void CreateNewInventoryItem( | 918 | private void CreateNewInventoryItem( |
898 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 919 | IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, |
920 | string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType, | ||
899 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 921 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) |
900 | { | 922 | { |
901 | InventoryItemBase item = new InventoryItemBase(); | 923 | InventoryItemBase item = new InventoryItemBase(); |
@@ -904,8 +926,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
904 | item.CreatorData = creatorData; | 926 | item.CreatorData = creatorData; |
905 | item.ID = UUID.Random(); | 927 | item.ID = UUID.Random(); |
906 | item.AssetID = asset.FullID; | 928 | item.AssetID = asset.FullID; |
907 | item.Description = asset.Description; | ||
908 | item.Name = name; | 929 | item.Name = name; |
930 | item.Description = description; | ||
909 | item.Flags = flags; | 931 | item.Flags = flags; |
910 | item.AssetType = asset.Type; | 932 | item.AssetType = asset.Type; |
911 | item.InvType = invType; | 933 | item.InvType = invType; |
@@ -987,7 +1009,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
987 | asset.Description = description; | 1009 | asset.Description = description; |
988 | 1010 | ||
989 | CreateNewInventoryItem( | 1011 | CreateNewInventoryItem( |
990 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, | 1012 | remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, |
1013 | name, description, 0, callbackID, asset, invType, | ||
991 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, | 1014 | (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, |
992 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); | 1015 | (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); |
993 | } | 1016 | } |