aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs87
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs27
2 files changed, 70 insertions, 44 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 46777e1..a119efc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -140,7 +140,8 @@ namespace OpenSim.Region.Framework.Scenes
140 /// <returns></returns> 140 /// <returns></returns>
141 public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) 141 public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data)
142 { 142 {
143 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 143 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
144 item = InventoryService.GetItem(item);
144 145
145 if (item != null) 146 if (item != null)
146 { 147 {
@@ -315,7 +316,8 @@ namespace OpenSim.Region.Framework.Scenes
315 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, 316 public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID,
316 UUID itemID, InventoryItemBase itemUpd) 317 UUID itemID, InventoryItemBase itemUpd)
317 { 318 {
318 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 319 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
320 item = InventoryService.GetItem(item);
319 321
320 if (item != null) 322 if (item != null)
321 { 323 {
@@ -408,7 +410,8 @@ namespace OpenSim.Region.Framework.Scenes
408 { 410 {
409 Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); 411 Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem");
410 412
411 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId)); 413 InventoryItemBase item = new InventoryItemBase(itemId, senderId);
414 item = InventoryService.GetItem(item);
412 415
413 if ((item != null) && (item.Owner == senderId)) 416 if ((item != null) && (item.Owner == senderId))
414 { 417 {
@@ -474,7 +477,11 @@ namespace OpenSim.Region.Framework.Scenes
474 if (!Permissions.BypassPermissions()) 477 if (!Permissions.BypassPermissions())
475 { 478 {
476 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 479 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
477 InventoryService.DeleteItem(new InventoryItemBase(itemId)); 480 {
481 List<UUID> items = new List<UUID>();
482 items.Add(itemId);
483 InventoryService.DeleteItems(senderId, items);
484 }
478 } 485 }
479 486
480 return itemCopy; 487 return itemCopy;
@@ -558,7 +565,8 @@ namespace OpenSim.Region.Framework.Scenes
558 565
559 if (item == null) 566 if (item == null)
560 { 567 {
561 item = InventoryService.GetItem(new InventoryItemBase(oldItemID)); 568 item = new InventoryItemBase(oldItemID, remoteClient.AgentId);
569 item = InventoryService.GetItem(item);
562 570
563 if (item == null) 571 if (item == null)
564 { 572 {
@@ -630,33 +638,13 @@ namespace OpenSim.Region.Framework.Scenes
630 /// <param name="itemID"></param> 638 /// <param name="itemID"></param>
631 /// <param name="length"></param> 639 /// <param name="length"></param>
632 /// <param name="newName"></param> 640 /// <param name="newName"></param>
633 public void MoveInventoryItem(IClientAPI remoteClient, UUID folderID, UUID itemID, int length, 641 public void MoveInventoryItem(IClientAPI remoteClient, List<InventoryItemBase> items)
634 string newName)
635 { 642 {
636 m_log.DebugFormat( 643 m_log.DebugFormat(
637 "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); 644 "[AGENT INVENTORY]: Moving {0} items for user {1}", items.Count, remoteClient.AgentId);
638
639 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID));
640 645
641 if (item != null) 646 if (!InventoryService.MoveItems(remoteClient.AgentId, items))
642 { 647 m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId);
643 if (newName != String.Empty)
644 {
645 item.Name = newName;
646 }
647 item.Folder = folderID;
648
649 // Diva comment: can't we just update?
650 InventoryService.DeleteItem(item);
651
652 AddInventoryItem(remoteClient, item);
653 }
654 else
655 {
656 m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
657
658 return;
659 }
660 } 648 }
661 649
662 /// <summary> 650 /// <summary>
@@ -794,9 +782,10 @@ namespace OpenSim.Region.Framework.Scenes
794 /// </summary> 782 /// </summary>
795 /// <param name="remoteClient"></param> 783 /// <param name="remoteClient"></param>
796 /// <param name="itemID"></param> 784 /// <param name="itemID"></param>
797 private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) 785 private void RemoveInventoryItem(IClientAPI remoteClient, List<UUID> itemIDs)
798 { 786 {
799 InventoryService.DeleteItem(new InventoryItemBase(itemID)); 787 //m_log.Debug("[SCENE INVENTORY]: user " + remoteClient.AgentId);
788 InventoryService.DeleteItems(remoteClient.AgentId, itemIDs);
800 } 789 }
801 790
802 /// <summary> 791 /// <summary>
@@ -1224,7 +1213,8 @@ namespace OpenSim.Region.Framework.Scenes
1224 UUID copyID = UUID.Random(); 1213 UUID copyID = UUID.Random();
1225 if (itemID != UUID.Zero) 1214 if (itemID != UUID.Zero)
1226 { 1215 {
1227 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1216 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1217 item = InventoryService.GetItem(item);
1228 1218
1229 // Try library 1219 // Try library
1230 if (null == item) 1220 if (null == item)
@@ -1242,7 +1232,11 @@ namespace OpenSim.Region.Framework.Scenes
1242 if (!Permissions.BypassPermissions()) 1232 if (!Permissions.BypassPermissions())
1243 { 1233 {
1244 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) 1234 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1245 RemoveInventoryItem(remoteClient, itemID); 1235 {
1236 List<UUID> uuids = new List<UUID>();
1237 uuids.Add(itemID);
1238 RemoveInventoryItem(remoteClient, uuids);
1239 }
1246 } 1240 }
1247 } 1241 }
1248 else 1242 else
@@ -1287,7 +1281,8 @@ namespace OpenSim.Region.Framework.Scenes
1287 1281
1288 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory 1282 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
1289 { 1283 {
1290 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1284 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1285 item = InventoryService.GetItem(item);
1291 1286
1292 // Try library 1287 // Try library
1293 // XXX clumsy, possibly should be one call 1288 // XXX clumsy, possibly should be one call
@@ -1672,7 +1667,7 @@ namespace OpenSim.Region.Framework.Scenes
1672 1667
1673 if (DeRezAction.SaveToExistingUserInventoryItem == action) 1668 if (DeRezAction.SaveToExistingUserInventoryItem == action)
1674 { 1669 {
1675 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID); 1670 item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID, userID);
1676 item = InventoryService.GetItem(item); 1671 item = InventoryService.GetItem(item);
1677 1672
1678 //item = userInfo.RootFolder.FindItem( 1673 //item = userInfo.RootFolder.FindItem(
@@ -1834,7 +1829,8 @@ namespace OpenSim.Region.Framework.Scenes
1834 1829
1835 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); 1830 string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup);
1836 1831
1837 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1832 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1833 item = InventoryService.GetItem(item);
1838 1834
1839 if (item != null) 1835 if (item != null)
1840 { 1836 {
@@ -1984,7 +1980,8 @@ namespace OpenSim.Region.Framework.Scenes
1984 BypassRayCast, bRayEndIsIntersection,true,scale, false); 1980 BypassRayCast, bRayEndIsIntersection,true,scale, false);
1985 1981
1986 // Rez object 1982 // Rez object
1987 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 1983 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
1984 item = InventoryService.GetItem(item);
1988 1985
1989 if (item != null) 1986 if (item != null)
1990 { 1987 {
@@ -2135,7 +2132,11 @@ namespace OpenSim.Region.Framework.Scenes
2135 // copy ones will be lost, so avoid it 2132 // copy ones will be lost, so avoid it
2136 // 2133 //
2137 if (!attachment) 2134 if (!attachment)
2138 InventoryService.DeleteItem(item); 2135 {
2136 List<UUID> uuids = new List<UUID>();
2137 uuids.Add(item.ID);
2138 InventoryService.DeleteItems(item.Owner, uuids);
2139 }
2139 } 2140 }
2140 } 2141 }
2141 2142
@@ -2309,7 +2310,8 @@ namespace OpenSim.Region.Framework.Scenes
2309 ScenePresence presence; 2310 ScenePresence presence;
2310 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2311 if (TryGetAvatar(remoteClient.AgentId, out presence))
2311 { 2312 {
2312 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId)); 2313 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2314 item = InventoryService.GetItem(item);
2313 2315
2314 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2316 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2315 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2317 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
@@ -2360,7 +2362,8 @@ namespace OpenSim.Region.Framework.Scenes
2360 if (TryGetAvatar(remoteClient.AgentId, out presence)) 2362 if (TryGetAvatar(remoteClient.AgentId, out presence))
2361 { 2363 {
2362 // XXYY!! 2364 // XXYY!!
2363 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 2365 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
2366 item = InventoryService.GetItem(item);
2364 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); 2367 presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/);
2365 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); 2368 IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>();
2366 if (ava != null) 2369 if (ava != null)
@@ -2393,7 +2396,9 @@ namespace OpenSim.Region.Framework.Scenes
2393 } 2396 }
2394 part.ParentGroup.DetachToGround(); 2397 part.ParentGroup.DetachToGround();
2395 2398
2396 InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); 2399 List<UUID> uuids = new List<UUID>();
2400 uuids.Add(inventoryID);
2401 InventoryService.DeleteItems(remoteClient.AgentId, uuids);
2397 remoteClient.SendRemoveInventoryItem(inventoryID); 2402 remoteClient.SendRemoveInventoryItem(inventoryID);
2398 } 2403 }
2399 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); 2404 SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index fde922f..77b980c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -25,6 +25,7 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System;
28using System.Collections.Generic; 29using System.Collections.Generic;
29using System.Threading; 30using System.Threading;
30using OpenMetaverse; 31using OpenMetaverse;
@@ -404,7 +405,8 @@ namespace OpenSim.Region.Framework.Scenes
404 return; 405 return;
405 } 406 }
406 407
407 InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); 408 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId);
409 item = InventoryService.GetItem(item);
408 410
409 if (item != null) 411 if (item != null)
410 { 412 {
@@ -557,15 +559,34 @@ namespace OpenSim.Region.Framework.Scenes
557 /// <param name="remoteClient"></param> 559 /// <param name="remoteClient"></param>
558 /// <param name="folderID"></param> 560 /// <param name="folderID"></param>
559 561
562 delegate void PurgeFolderDelegate(UUID userID, UUID folder);
563
560 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) 564 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
561 { 565 {
562 InventoryFolderBase folder = new InventoryFolderBase(folderID); 566 PurgeFolderDelegate d = PurgeFolderAsync;
567 try
568 {
569 d.BeginInvoke(remoteClient.AgentId, folderID, PurgeFolderCompleted, d);
570 }
571 catch (Exception e)
572 {
573 m_log.WarnFormat("[AGENT INVENTORY]: Exception on purge folder for user {0}: {1}", remoteClient.AgentId, e.Message);
574 }
575 }
576
577
578 private void PurgeFolderAsync(UUID userID, UUID folderID)
579 {
580 InventoryFolderBase folder = new InventoryFolderBase(folderID, userID);
563 581
564 if (InventoryService.PurgeFolder(folder)) 582 if (InventoryService.PurgeFolder(folder))
565 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID); 583 m_log.DebugFormat("[AGENT INVENTORY]: folder {0} purged successfully", folderID);
566 else 584 else
567 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID); 585 m_log.WarnFormat("[AGENT INVENTORY]: could not purge folder {0}", folderID);
568 } 586 }
569 587
588 private void PurgeFolderCompleted(IAsyncResult iar)
589 {
590 }
570 } 591 }
571} 592}