From 3aa7ad24dab4896a92a35c8246a26aa25e69361a Mon Sep 17 00:00:00 2001
From: Melanie Thielker
Date: Sun, 14 Dec 2008 22:27:40 +0000
Subject: Make scripted item and folder gives pop up a "accept, decline"
message and allow deletion of the just received item.
---
.../Region/Environment/Scenes/Scene.Inventory.cs | 19 ++++---
.../Shared/Api/Implementation/LSL_Api.cs | 60 +++++++++++++++++++---
2 files changed, 66 insertions(+), 13 deletions(-)
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 2546a26..5e16082 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -1121,15 +1121,16 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
+ public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
{
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
if (agentItem == null)
- return;
+ return null;
agentItem.Folder = folderId;
AddInventoryItem(remoteClient, agentItem);
+ return agentItem;
}
///
@@ -1178,13 +1179,13 @@ namespace OpenSim.Region.Environment.Scenes
///
///
///
- public void MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId)
+ public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId)
{
ScenePresence avatar;
if (TryGetAvatar(avatarId, out avatar))
{
- MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
+ return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
}
else
{
@@ -1201,11 +1202,13 @@ namespace OpenSim.Region.Environment.Scenes
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
if (agentItem == null)
- return;
+ return null;
agentItem.Folder = folderId;
AddInventoryItem(avatarId, agentItem);
+
+ return agentItem;
}
}
@@ -1310,7 +1313,7 @@ namespace OpenSim.Region.Environment.Scenes
}
}
- public void MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List items)
+ public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List items)
{
CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID);
if (profile == null || profile.RootFolder == null)
@@ -1319,7 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes
"[PRIM INVENTORY]: " +
"Avatar {0} cannot be found to add items",
destID);
- return;
+ return UUID.Zero;
}
UUID newFolderID = UUID.Random();
@@ -1347,6 +1350,8 @@ namespace OpenSim.Region.Environment.Scenes
profile.SendInventoryDecendents(avatar.ControllingClient,
newFolderID, false, true);
}
+
+ return newFolderID;
}
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index ab7e934..b15189e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -79,6 +79,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
private DateTime m_timer = DateTime.Now;
private bool m_waitingForScriptAnswer=false;
private bool m_automaticLinkPermission=false;
+ private IMessageTransferModule m_TransferModule = null;
//private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -98,6 +99,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
m_automaticLinkPermission =
m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
+ m_TransferModule =
+ m_ScriptEngine.World.RequestModuleInterface();
AsyncCommands = new AsyncCommandManager(ScriptEngine);
}
@@ -2654,11 +2657,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
msg.binaryBucket = new byte[0];// binaryBucket;
- IMessageTransferModule tr = World.RequestModuleInterface();
-
- if (tr != null)
+ if (m_TransferModule != null)
{
- tr.SendInstantMessage(msg, delegate(bool success) {} );
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
}
ScriptSleep(2000);
}
@@ -3318,6 +3319,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
bool found = false;
UUID destId = UUID.Zero;
UUID objId = UUID.Zero;
+ int assetType = 0;
+ string objName = String.Empty;
if (!UUID.TryParse(destination, out destId))
{
@@ -3332,6 +3335,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
found = true;
objId = inv.Key;
+ assetType = inv.Value.Type;
+ objName = inv.Value.Name;
break;
}
}
@@ -3346,7 +3351,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (World.GetScenePresence(destId) != null)
{
// destination is an avatar
- World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
+ InventoryItemBase agentItem =
+ World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
+
+ if (agentItem == null)
+ return;
+
+ byte[] bucket = new byte[17];
+ bucket[0] = (byte)assetType;
+ byte[] objBytes = objId.GetBytes();
+ Array.Copy(objBytes, 0, bucket, 1, 16);
+
+ GridInstantMessage msg = new GridInstantMessage(World,
+ m_host.UUID, m_host.Name+", an object owned by "+
+ resolveName(m_host.OwnerID)+",", destId,
+ (byte)InstantMessageDialog.InventoryOffered,
+ false, objName+"\n"+m_host.Name+" is located at "+
+ World.RegionInfo.RegionName+" "+
+ m_host.AbsolutePosition.ToString(),
+ agentItem.ID, true, m_host.AbsolutePosition,
+ bucket);
+
+ if (m_TransferModule != null)
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
}
else
{
@@ -5485,7 +5512,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (itemList.Count == 0)
return;
- m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList);
+ UUID folderID = m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList);
+
+ if (folderID == UUID.Zero)
+ return;
+
+ byte[] bucket = new byte[17];
+ bucket[0] = (byte)AssetType.Folder;
+ byte[] objBytes = folderID.GetBytes();
+ Array.Copy(objBytes, 0, bucket, 1, 16);
+
+ GridInstantMessage msg = new GridInstantMessage(World,
+ m_host.UUID, m_host.Name+", an object owned by "+
+ resolveName(m_host.OwnerID)+",", destID,
+ (byte)InstantMessageDialog.InventoryOffered,
+ false, category+"\n"+m_host.Name+" is located at "+
+ World.RegionInfo.RegionName+" "+
+ m_host.AbsolutePosition.ToString(),
+ folderID, true, m_host.AbsolutePosition,
+ bucket);
+
+ if (m_TransferModule != null)
+ m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
}
public void llSetVehicleType(int type)
--
cgit v1.1