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.
0.7.3-extended
Justin Clark-Casey (justincc) 2012-07-26 23:44:29 +01:00
parent 55d383e4be
commit 25d39a19e1
2 changed files with 49 additions and 25 deletions

View File

@ -204,8 +204,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId); AssetBase asset = m_Scene.CreateAsset(name, description, assetType, data, remoteClient.AgentId);
m_Scene.AssetService.Store(asset); m_Scene.AssetService.Store(asset);
m_Scene.CreateNewInventoryItem(
m_Scene.CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, asset.Name, 0, callbackID, asset, invType, nextOwnerMask, creationDate); remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, 0, callbackID, asset, invType, nextOwnerMask, creationDate);
} }
else else
{ {

View File

@ -771,16 +771,20 @@ namespace OpenSim.Region.Framework.Scenes
&& oldAgentID == LibraryService.LibraryRootFolder.Owner)) && oldAgentID == LibraryService.LibraryRootFolder.Owner))
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, asset, (sbyte)item.InvType, remoteClient, item.CreatorId, item.CreatorData, newFolderID,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions, item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); newName, item.Description, item.Flags, callbackID, asset, (sbyte)item.InvType,
item.BasePermissions, item.CurrentPermissions, item.EveryOnePermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
} }
else else
{ {
// If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item. // If item is transfer or permissions are off or calling agent is allowed to copy item owner's inventory item.
if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0) && (m_permissions.BypassPermissions() || m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID))) if (((item.CurrentPermissions & (uint)PermissionMask.Transfer) != 0)
&& (m_permissions.BypassPermissions()
|| m_permissions.CanCopyUserInventory(remoteClient.AgentId, oldItemID)))
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Flags, callbackID, remoteClient, item.CreatorId, item.CreatorData, newFolderID, newName, item.Description, item.Flags, callbackID,
asset, (sbyte) item.InvType, asset, (sbyte) item.InvType,
item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions, item.NextPermissions, item.NextPermissions, item.EveryOnePermissions & item.NextPermissions,
item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch()); item.NextPermissions, item.GroupPermissions, Util.UnixTimeSinceEpoch());
@ -827,32 +831,50 @@ namespace OpenSim.Region.Framework.Scenes
/// <summary> /// <summary>
/// Create a new inventory item. /// Create a new inventory item.
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient">Client creating this inventory item.</param>
/// <param name="folderID"></param> /// <param name="creatorID"></param>
/// <param name="callbackID"></param> /// <param name="creatorData"></param>
/// <param name="asset"></param> /// <param name="folderID">UUID of folder in which this item should be placed.</param>
/// <param name="invType"></param> /// <param name="name">Item name.</para>
/// <param name="nextOwnerMask"></param> /// <param name="description">Item description.</param>
public void CreateNewInventoryItem(IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, /// <param name="flags">Item flags</param>
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate) /// <param name="callbackID">Generated by the client.</para>
/// <param name="asset">Asset to which this item refers.</param>
/// <param name="invType">Type of inventory item.</param>
/// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
/// <param name="creationDate">Unix timestamp at which this item was created.</param>
public void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID,
AssetBase asset, sbyte invType, uint nextOwnerMask, int creationDate)
{ {
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, creatorID, creatorData, folderID, name, flags, callbackID, asset, invType, remoteClient, creatorID, creatorData, folderID, name, description, flags, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate); (uint)PermissionMask.All, (uint)PermissionMask.All, 0, nextOwnerMask, 0, creationDate);
} }
/// <summary> /// <summary>
/// Create a new Inventory Item /// Create a new Inventory Item
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient">Client creating this inventory item.</param>
/// <param name="folderID"></param> /// <param name="creatorID"></param>
/// <param name="callbackID"></param> /// <param name="creatorData"></param>
/// <param name="asset"></param> /// <param name="folderID">UUID of folder in which this item should be placed.</param>
/// <param name="invType"></param> /// <param name="name">Item name.</para>
/// <param name="nextOwnerMask"></param> /// <param name="description">Item description.</param>
/// <param name="creationDate"></param> /// <param name="flags">Item flags</param>
/// <param name="callbackID">Generated by the client.</para>
/// <param name="asset">Asset to which this item refers.</param>
/// <param name="invType">Type of inventory item.</param>
/// <param name="baseMask">Base permissions mask.</param>
/// <param name="currentMask">Current permissions mask.</param>
/// <param name="everyoneMask">Everyone permissions mask.</param>
/// <param name="nextOwnerMask">Next owner pemrissions mask.</param>
/// <param name="groupMask">Group permissions mask.</param>
/// <param name="creationDate">Unix timestamp at which this item was created.</param>
private void CreateNewInventoryItem( private void CreateNewInventoryItem(
IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, IClientAPI remoteClient, string creatorID, string creatorData, UUID folderID,
string name, string description, uint flags, uint callbackID, AssetBase asset, sbyte invType,
uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate)
{ {
InventoryItemBase item = new InventoryItemBase(); InventoryItemBase item = new InventoryItemBase();
@ -861,8 +883,8 @@ namespace OpenSim.Region.Framework.Scenes
item.CreatorData = creatorData; item.CreatorData = creatorData;
item.ID = UUID.Random(); item.ID = UUID.Random();
item.AssetID = asset.FullID; item.AssetID = asset.FullID;
item.Description = asset.Description;
item.Name = name; item.Name = name;
item.Description = description;
item.Flags = flags; item.Flags = flags;
item.AssetType = asset.Type; item.AssetType = asset.Type;
item.InvType = invType; item.InvType = invType;
@ -944,7 +966,8 @@ namespace OpenSim.Region.Framework.Scenes
asset.Description = description; asset.Description = description;
CreateNewInventoryItem( CreateNewInventoryItem(
remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID, name, 0, callbackID, asset, invType, remoteClient, remoteClient.AgentId.ToString(), string.Empty, folderID,
name, description, 0, callbackID, asset, invType,
(uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All,
(uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch()); (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
} }