aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorDiva Canto2009-08-19 10:56:08 -0700
committerDiva Canto2009-08-19 10:56:08 -0700
commitd519f1885f587409592cf92bc0f4ba8533a1866f (patch)
treedc8d0073d09050c8787121290b1e3a8f65119812 /OpenSim/Region
parentAsync purge so that the client thread doesn't wait. (diff)
downloadopensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.zip
opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.gz
opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.bz2
opensim-SC_OLD-d519f1885f587409592cf92bc0f4ba8533a1866f.tar.xz
Added MoveItems, which is most useful upon viewer-delete inventory operation. Moving a batch of items is a 1-time operation. Made it async anyway, so that the viewer doesn't wait in case the DB layer is dumb (which is the case currently).
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs19
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs2
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs17
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs6
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs31
6 files changed, 52 insertions, 33 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index e2fb659..6969a3d 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -7027,14 +7027,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7027 if (OnMoveInventoryItem != null) 7027 if (OnMoveInventoryItem != null)
7028 { 7028 {
7029 handlerMoveInventoryItem = null; 7029 handlerMoveInventoryItem = null;
7030 InventoryItemBase itm = null;
7031 List<InventoryItemBase> items = new List<InventoryItemBase>();
7030 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData) 7032 foreach (MoveInventoryItemPacket.InventoryDataBlock datablock in moveitem.InventoryData)
7031 { 7033 {
7032 handlerMoveInventoryItem = OnMoveInventoryItem; 7034 itm = new InventoryItemBase(datablock.ItemID, AgentId);
7033 if (handlerMoveInventoryItem != null) 7035 itm.Folder = datablock.FolderID;
7034 { 7036 itm.Name = Util.FieldToString(datablock.NewName);
7035 handlerMoveInventoryItem(this, datablock.FolderID, datablock.ItemID, datablock.Length, 7037 // weird, comes out as empty string
7036 Util.FieldToString(datablock.NewName)); 7038 //m_log.DebugFormat("[XXX] new name: {0}", itm.Name);
7037 } 7039 items.Add(itm);
7040 }
7041 handlerMoveInventoryItem = OnMoveInventoryItem;
7042 if (handlerMoveInventoryItem != null)
7043 {
7044 handlerMoveInventoryItem(this, items);
7038 } 7045 }
7039 } 7046 }
7040 break; 7047 break;
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
index d1ae3e4..d4cb616 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs
@@ -181,6 +181,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
181 /// <returns>true if the item was successfully updated</returns> 181 /// <returns>true if the item was successfully updated</returns>
182 public abstract bool UpdateItem(InventoryItemBase item); 182 public abstract bool UpdateItem(InventoryItemBase item);
183 183
184 public abstract bool MoveItems(UUID ownerID, List<InventoryItemBase> items);
185
184 /// <summary> 186 /// <summary>
185 /// Delete an item from the user's inventory 187 /// Delete an item from the user's inventory
186 /// </summary> 188 /// </summary>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
index 6a1f2d5..787c6c8 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs
@@ -393,6 +393,23 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
393 } 393 }
394 } 394 }
395 395
396 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
397 {
398 if (items == null)
399 return false;
400 if (items.Count == 0)
401 return true;
402
403 if (IsLocalGridUser(ownerID))
404 return m_GridService.MoveItems(ownerID, items);
405 else
406 {
407 UUID sessionID = GetSessionID(ownerID);
408 string uri = GetUserInventoryURI(ownerID) + "/" + ownerID.ToString();
409 return m_HGService.MoveItems(uri, items, sessionID);
410 }
411 }
412
396 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 413 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
397 { 414 {
398 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); 415 m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID);
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
index b2640af..562c5dd 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs
@@ -289,6 +289,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
289 return m_InventoryService.UpdateItem(item); 289 return m_InventoryService.UpdateItem(item);
290 } 290 }
291 291
292
293 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
294 {
295 return m_InventoryService.MoveItems(ownerID, items);
296 }
297
292 /// <summary> 298 /// <summary>
293 /// Delete an item from the user's inventory 299 /// Delete an item from the user's inventory
294 /// </summary> 300 /// </summary>
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
index 081d0f7..201442c 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs
@@ -273,6 +273,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
273 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID); 273 return m_RemoteConnector.UpdateItem(item.Owner.ToString(), item, sessionID);
274 } 274 }
275 275
276 public override bool MoveItems(UUID ownerID, List<InventoryItemBase> items)
277 {
278 if (items == null)
279 return false;
280
281 UUID sessionID = GetSessionID(ownerID);
282 return m_RemoteConnector.MoveItems(ownerID.ToString(), items, sessionID);
283 }
284
285
276 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs) 286 public override bool DeleteItems(UUID ownerID, List<UUID> itemIDs)
277 { 287 {
278 if (itemIDs == null) 288 if (itemIDs == null)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 5e2eb73..a119efc 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -638,36 +638,13 @@ namespace OpenSim.Region.Framework.Scenes
638 /// <param name="itemID"></param> 638 /// <param name="itemID"></param>
639 /// <param name="length"></param> 639 /// <param name="length"></param>
640 /// <param name="newName"></param> 640 /// <param name="newName"></param>
641 public void MoveInventoryItem(IClientAPI remoteClient, UUID folderID, UUID itemID, int length, 641 public void MoveInventoryItem(IClientAPI remoteClient, List<InventoryItemBase> items)
642 string newName)
643 { 642 {
644 m_log.DebugFormat( 643 m_log.DebugFormat(
645 "[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);
646 645
647 InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); 646 if (!InventoryService.MoveItems(remoteClient.AgentId, items))
648 item = InventoryService.GetItem(item); 647 m_log.Warn("[AGENT INVENTORY]: Failed to move items for user " + remoteClient.AgentId);
649
650 if (item != null)
651 {
652 if (newName != String.Empty)
653 {
654 item.Name = newName;
655 }
656 item.Folder = folderID;
657
658 // Diva comment: can't we just update?
659 List<UUID> uuids = new List<UUID>();
660 uuids.Add(item.ID);
661 InventoryService.DeleteItems(item.Owner, uuids);
662
663 AddInventoryItem(remoteClient, item);
664 }
665 else
666 {
667 m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString());
668
669 return;
670 }
671 } 648 }
672 649
673 /// <summary> 650 /// <summary>