thanks lkalif for Mantis #4676 - a patch that adds support for inventory links

Signed-off-by: dahlia <dahliaTrimble@gmail.removeme.com>
slimupdates
dahlia 2010-04-12 17:10:51 -07:00
parent 56c176f0a3
commit 3d0860ae61
12 changed files with 79 additions and 0 deletions

View File

@ -88,6 +88,7 @@ what it is today.
* Kitto Flora
* KittyLiu
* Kurt Taylor (IBM)
* lkalif
* lulurun
* M.Igarashi
* maimedleech

View File

@ -642,6 +642,7 @@ namespace OpenSim.Client.MXP.ClientStack
public event Action<UUID> OnRemoveAvatar;
public event ObjectPermissions OnObjectPermissions;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -288,6 +288,7 @@ namespace OpenSim.Client.Sirikata.ClientStack
public event Action<UUID> OnRemoveAvatar;
public event ObjectPermissions OnObjectPermissions;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -291,6 +291,7 @@ namespace OpenSim.Client.VWoHTTP.ClientStack
public event Action<UUID> OnRemoveAvatar = delegate { };
public event ObjectPermissions OnObjectPermissions = delegate { };
public event CreateNewInventoryItem OnCreateNewInventoryItem = delegate { };
public event LinkInventoryItem OnLinkInventoryItem = delegate { };
public event CreateInventoryFolder OnCreateNewInventoryFolder = delegate { };
public event UpdateInventoryFolder OnUpdateInventoryFolder = delegate { };
public event MoveInventoryFolder OnMoveInventoryFolder = delegate { };

View File

@ -236,6 +236,10 @@ namespace OpenSim.Framework
IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name,
sbyte invType, sbyte type, byte wearableType, uint nextOwnerMask, int creationDate);
public delegate void LinkInventoryItem(
IClientAPI remoteClient, UUID transActionID, UUID folderID, uint callbackID, string description, string name,
sbyte invType, sbyte type, UUID olditemID);
public delegate void FetchInventoryDescendents(
IClientAPI remoteClient, UUID folderID, UUID ownerID, bool fetchFolders, bool fetchItems, int sortOrder);
@ -930,6 +934,7 @@ namespace OpenSim.Framework
event ObjectPermissions OnObjectPermissions;
event CreateNewInventoryItem OnCreateNewInventoryItem;
event LinkInventoryItem OnLinkInventoryItem;
event CreateInventoryFolder OnCreateNewInventoryFolder;
event UpdateInventoryFolder OnUpdateInventoryFolder;
event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -182,6 +182,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public event TeleportLocationRequest OnSetStartLocationRequest;
public event UpdateAvatarProperties OnUpdateAvatarProperties;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;
@ -4749,6 +4750,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
AddLocalPacketHandler(PacketType.UpdateInventoryFolder, HandleUpdateInventoryFolder);
AddLocalPacketHandler(PacketType.MoveInventoryFolder, HandleMoveInventoryFolder);
AddLocalPacketHandler(PacketType.CreateInventoryItem, HandleCreateInventoryItem);
AddLocalPacketHandler(PacketType.LinkInventoryItem, HandleLinkInventoryItem);
AddLocalPacketHandler(PacketType.FetchInventory, HandleFetchInventory);
AddLocalPacketHandler(PacketType.FetchInventoryDescendents, HandleFetchInventoryDescendents);
AddLocalPacketHandler(PacketType.PurgeInventoryDescendents, HandlePurgeInventoryDescendents);
@ -7348,6 +7350,38 @@ namespace OpenSim.Region.ClientStack.LindenUDP
return true;
}
private bool HandleLinkInventoryItem(IClientAPI sender, Packet Pack)
{
LinkInventoryItemPacket createLink = (LinkInventoryItemPacket)Pack;
#region Packet Session and User Check
if (m_checkPackets)
{
if (createLink.AgentData.SessionID != SessionId ||
createLink.AgentData.AgentID != AgentId)
return true;
}
#endregion
LinkInventoryItem linkInventoryItem = OnLinkInventoryItem;
if (linkInventoryItem != null)
{
linkInventoryItem(
this,
createLink.InventoryBlock.TransactionID,
createLink.InventoryBlock.FolderID,
createLink.InventoryBlock.CallbackID,
Util.FieldToString(createLink.InventoryBlock.Description),
Util.FieldToString(createLink.InventoryBlock.Name),
createLink.InventoryBlock.InvType,
createLink.InventoryBlock.Type,
createLink.InventoryBlock.OldItemID);
}
return true;
}
private bool HandleFetchInventory(IClientAPI sender, Packet Pack)
{
if (OnFetchInventory != null)

View File

@ -129,6 +129,7 @@ namespace OpenSim.Region.Examples.SimpleModule
public event Action<UUID> OnRemoveAvatar;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -722,6 +722,37 @@ namespace OpenSim.Region.Framework.Scenes
}
}
private void HandleLinkInventoryItem(IClientAPI remoteClient, UUID transActionID, UUID folderID,
uint callbackID, string description, string name,
sbyte invType, sbyte type, UUID olditemID)
{
m_log.DebugFormat("[AGENT INVENTORY]: Received request to create inventory item link {0} in folder {1} pointing to {2}", name, folderID, olditemID);
if (!Permissions.CanCreateUserInventory(invType, remoteClient.AgentId))
return;
ScenePresence presence;
if (TryGetScenePresence(remoteClient.AgentId, out presence))
{
byte[] data = null;
AssetBase asset = new AssetBase();
asset.FullID = olditemID;
asset.Type = type;
asset.Name = name;
asset.Description = description;
CreateNewInventoryItem(remoteClient, remoteClient.AgentId.ToString(), folderID, name, 0, callbackID, asset, invType, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, (uint)PermissionMask.All, Util.UnixTimeSinceEpoch());
}
else
{
m_log.ErrorFormat(
"ScenePresence for agent uuid {0} unexpectedly not found in HandleLinkInventoryItem",
remoteClient.AgentId);
}
}
/// <summary>
/// Remove an inventory item for the client's inventory
/// </summary>

View File

@ -2749,6 +2749,7 @@ namespace OpenSim.Region.Framework.Scenes
public virtual void SubscribeToClientInventoryEvents(IClientAPI client)
{
client.OnCreateNewInventoryItem += CreateNewInventoryItem;
client.OnLinkInventoryItem += HandleLinkInventoryItem;
client.OnCreateNewInventoryFolder += HandleCreateInventoryFolder;
client.OnUpdateInventoryFolder += HandleUpdateInventoryFolder;
client.OnMoveInventoryFolder += HandleMoveInventoryFolder; // 2; //!!

View File

@ -724,6 +724,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server
public event Action<UUID> OnRemoveAvatar;
public event ObjectPermissions OnObjectPermissions;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -235,6 +235,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC
public event Action<UUID> OnRemoveAvatar;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;

View File

@ -141,6 +141,7 @@ namespace OpenSim.Tests.Common.Mock
public event Action<UUID> OnRemoveAvatar;
public event CreateNewInventoryItem OnCreateNewInventoryItem;
public event LinkInventoryItem OnLinkInventoryItem;
public event CreateInventoryFolder OnCreateNewInventoryFolder;
public event UpdateInventoryFolder OnUpdateInventoryFolder;
public event MoveInventoryFolder OnMoveInventoryFolder;