aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie Thielker2008-12-14 22:27:40 +0000
committerMelanie Thielker2008-12-14 22:27:40 +0000
commit3aa7ad24dab4896a92a35c8246a26aa25e69361a (patch)
tree5e40e0103a5ab7368e3081242445e04bc7d236f8 /OpenSim/Region
parentWas missed some time ago, it seems... (diff)
downloadopensim-SC_OLD-3aa7ad24dab4896a92a35c8246a26aa25e69361a.zip
opensim-SC_OLD-3aa7ad24dab4896a92a35c8246a26aa25e69361a.tar.gz
opensim-SC_OLD-3aa7ad24dab4896a92a35c8246a26aa25e69361a.tar.bz2
opensim-SC_OLD-3aa7ad24dab4896a92a35c8246a26aa25e69361a.tar.xz
Make scripted item and folder gives pop up a "accept, decline" message
and allow deletion of the just received item.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs19
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs60
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
1121 /// <param name="folderID"></param> 1121 /// <param name="folderID"></param>
1122 /// <param name="part"></param> 1122 /// <param name="part"></param>
1123 /// <param name="itemID"></param> 1123 /// <param name="itemID"></param>
1124 public void MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId) 1124 public InventoryItemBase MoveTaskInventoryItem(IClientAPI remoteClient, UUID folderId, SceneObjectPart part, UUID itemId)
1125 { 1125 {
1126 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId); 1126 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(remoteClient.AgentId, part, itemId);
1127 1127
1128 if (agentItem == null) 1128 if (agentItem == null)
1129 return; 1129 return null;
1130 1130
1131 agentItem.Folder = folderId; 1131 agentItem.Folder = folderId;
1132 AddInventoryItem(remoteClient, agentItem); 1132 AddInventoryItem(remoteClient, agentItem);
1133 return agentItem;
1133 } 1134 }
1134 1135
1135 /// <summary> 1136 /// <summary>
@@ -1178,13 +1179,13 @@ namespace OpenSim.Region.Environment.Scenes
1178 /// <param name="folderID"></param> 1179 /// <param name="folderID"></param>
1179 /// <param name="part"></param> 1180 /// <param name="part"></param>
1180 /// <param name="itemID"></param> 1181 /// <param name="itemID"></param>
1181 public void MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId) 1182 public InventoryItemBase MoveTaskInventoryItem(UUID avatarId, UUID folderId, SceneObjectPart part, UUID itemId)
1182 { 1183 {
1183 ScenePresence avatar; 1184 ScenePresence avatar;
1184 1185
1185 if (TryGetAvatar(avatarId, out avatar)) 1186 if (TryGetAvatar(avatarId, out avatar))
1186 { 1187 {
1187 MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 1188 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
1188 } 1189 }
1189 else 1190 else
1190 { 1191 {
@@ -1201,11 +1202,13 @@ namespace OpenSim.Region.Environment.Scenes
1201 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1202 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
1202 1203
1203 if (agentItem == null) 1204 if (agentItem == null)
1204 return; 1205 return null;
1205 1206
1206 agentItem.Folder = folderId; 1207 agentItem.Folder = folderId;
1207 1208
1208 AddInventoryItem(avatarId, agentItem); 1209 AddInventoryItem(avatarId, agentItem);
1210
1211 return agentItem;
1209 } 1212 }
1210 } 1213 }
1211 1214
@@ -1310,7 +1313,7 @@ namespace OpenSim.Region.Environment.Scenes
1310 } 1313 }
1311 } 1314 }
1312 1315
1313 public void MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) 1316 public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items)
1314 { 1317 {
1315 CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID); 1318 CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID);
1316 if (profile == null || profile.RootFolder == null) 1319 if (profile == null || profile.RootFolder == null)
@@ -1319,7 +1322,7 @@ namespace OpenSim.Region.Environment.Scenes
1319 "[PRIM INVENTORY]: " + 1322 "[PRIM INVENTORY]: " +
1320 "Avatar {0} cannot be found to add items", 1323 "Avatar {0} cannot be found to add items",
1321 destID); 1324 destID);
1322 return; 1325 return UUID.Zero;
1323 } 1326 }
1324 1327
1325 UUID newFolderID = UUID.Random(); 1328 UUID newFolderID = UUID.Random();
@@ -1347,6 +1350,8 @@ namespace OpenSim.Region.Environment.Scenes
1347 profile.SendInventoryDecendents(avatar.ControllingClient, 1350 profile.SendInventoryDecendents(avatar.ControllingClient,
1348 newFolderID, false, true); 1351 newFolderID, false, true);
1349 } 1352 }
1353
1354 return newFolderID;
1350 } 1355 }
1351 1356
1352 /// <summary> 1357 /// <summary>
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
79 private DateTime m_timer = DateTime.Now; 79 private DateTime m_timer = DateTime.Now;
80 private bool m_waitingForScriptAnswer=false; 80 private bool m_waitingForScriptAnswer=false;
81 private bool m_automaticLinkPermission=false; 81 private bool m_automaticLinkPermission=false;
82 private IMessageTransferModule m_TransferModule = null;
82 83
83 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 84 //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
84 85
@@ -98,6 +99,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
98 m_automaticLinkPermission = 99 m_automaticLinkPermission =
99 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false); 100 m_ScriptEngine.Config.GetBoolean("AutomaticLinkPermission", false);
100 101
102 m_TransferModule =
103 m_ScriptEngine.World.RequestModuleInterface<IMessageTransferModule>();
101 AsyncCommands = new AsyncCommandManager(ScriptEngine); 104 AsyncCommands = new AsyncCommandManager(ScriptEngine);
102 } 105 }
103 106
@@ -2654,11 +2657,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2654 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid; 2657 msg.RegionID = World.RegionInfo.RegionID.Guid;//RegionID.Guid;
2655 msg.binaryBucket = new byte[0];// binaryBucket; 2658 msg.binaryBucket = new byte[0];// binaryBucket;
2656 2659
2657 IMessageTransferModule tr = World.RequestModuleInterface<IMessageTransferModule>(); 2660 if (m_TransferModule != null)
2658
2659 if (tr != null)
2660 { 2661 {
2661 tr.SendInstantMessage(msg, delegate(bool success) {} ); 2662 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
2662 } 2663 }
2663 ScriptSleep(2000); 2664 ScriptSleep(2000);
2664 } 2665 }
@@ -3318,6 +3319,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3318 bool found = false; 3319 bool found = false;
3319 UUID destId = UUID.Zero; 3320 UUID destId = UUID.Zero;
3320 UUID objId = UUID.Zero; 3321 UUID objId = UUID.Zero;
3322 int assetType = 0;
3323 string objName = String.Empty;
3321 3324
3322 if (!UUID.TryParse(destination, out destId)) 3325 if (!UUID.TryParse(destination, out destId))
3323 { 3326 {
@@ -3332,6 +3335,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3332 { 3335 {
3333 found = true; 3336 found = true;
3334 objId = inv.Key; 3337 objId = inv.Key;
3338 assetType = inv.Value.Type;
3339 objName = inv.Value.Name;
3335 break; 3340 break;
3336 } 3341 }
3337 } 3342 }
@@ -3346,7 +3351,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3346 if (World.GetScenePresence(destId) != null) 3351 if (World.GetScenePresence(destId) != null)
3347 { 3352 {
3348 // destination is an avatar 3353 // destination is an avatar
3349 World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId); 3354 InventoryItemBase agentItem =
3355 World.MoveTaskInventoryItem(destId, UUID.Zero, m_host, objId);
3356
3357 if (agentItem == null)
3358 return;
3359
3360 byte[] bucket = new byte[17];
3361 bucket[0] = (byte)assetType;
3362 byte[] objBytes = objId.GetBytes();
3363 Array.Copy(objBytes, 0, bucket, 1, 16);
3364
3365 GridInstantMessage msg = new GridInstantMessage(World,
3366 m_host.UUID, m_host.Name+", an object owned by "+
3367 resolveName(m_host.OwnerID)+",", destId,
3368 (byte)InstantMessageDialog.InventoryOffered,
3369 false, objName+"\n"+m_host.Name+" is located at "+
3370 World.RegionInfo.RegionName+" "+
3371 m_host.AbsolutePosition.ToString(),
3372 agentItem.ID, true, m_host.AbsolutePosition,
3373 bucket);
3374
3375 if (m_TransferModule != null)
3376 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
3350 } 3377 }
3351 else 3378 else
3352 { 3379 {
@@ -5485,7 +5512,28 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5485 if (itemList.Count == 0) 5512 if (itemList.Count == 0)
5486 return; 5513 return;
5487 5514
5488 m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList); 5515 UUID folderID = m_ScriptEngine.World.MoveTaskInventoryItems(destID, category, m_host, itemList);
5516
5517 if (folderID == UUID.Zero)
5518 return;
5519
5520 byte[] bucket = new byte[17];
5521 bucket[0] = (byte)AssetType.Folder;
5522 byte[] objBytes = folderID.GetBytes();
5523 Array.Copy(objBytes, 0, bucket, 1, 16);
5524
5525 GridInstantMessage msg = new GridInstantMessage(World,
5526 m_host.UUID, m_host.Name+", an object owned by "+
5527 resolveName(m_host.OwnerID)+",", destID,
5528 (byte)InstantMessageDialog.InventoryOffered,
5529 false, category+"\n"+m_host.Name+" is located at "+
5530 World.RegionInfo.RegionName+" "+
5531 m_host.AbsolutePosition.ToString(),
5532 folderID, true, m_host.AbsolutePosition,
5533 bucket);
5534
5535 if (m_TransferModule != null)
5536 m_TransferModule.SendInstantMessage(msg, delegate(bool success) {} );
5489 } 5537 }
5490 5538
5491 public void llSetVehicleType(int type) 5539 public void llSetVehicleType(int type)