diff options
Diffstat (limited to 'OpenSim/Services')
6 files changed, 82 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs index 00b74b5..45e921a 100644 --- a/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/HGInventoryServiceConnector.cs | |||
@@ -253,6 +253,19 @@ namespace OpenSim.Services.Connectors.Inventory | |||
253 | return false; | 253 | return false; |
254 | } | 254 | } |
255 | 255 | ||
256 | public bool MoveItems(string id, List<InventoryItemBase> items, UUID sessionID) | ||
257 | { | ||
258 | string url = string.Empty; | ||
259 | string userID = string.Empty; | ||
260 | |||
261 | if (StringToUrlAndUserID(id, out url, out userID)) | ||
262 | { | ||
263 | ISessionAuthInventoryService connector = GetConnector(url); | ||
264 | return connector.MoveItems(userID, items, sessionID); | ||
265 | } | ||
266 | return false; | ||
267 | } | ||
268 | |||
256 | public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID) | 269 | public bool DeleteItems(string id, List<UUID> itemIDs, UUID sessionID) |
257 | { | 270 | { |
258 | string url = string.Empty; | 271 | string url = string.Empty; |
diff --git a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs index e4e713c..c89c9b7 100644 --- a/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs +++ b/OpenSim/Services/Connectors/Inventory/ISessionAuthInventoryService.cs | |||
@@ -116,6 +116,8 @@ namespace OpenSim.Services.Connectors | |||
116 | /// <returns>true if the item was successfully updated</returns> | 116 | /// <returns>true if the item was successfully updated</returns> |
117 | bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); | 117 | bool UpdateItem(string userID, InventoryItemBase item, UUID session_id); |
118 | 118 | ||
119 | bool MoveItems(string userID, List<InventoryItemBase> items, UUID session_id); | ||
120 | |||
119 | /// <summary> | 121 | /// <summary> |
120 | /// Delete an item from the user's inventory | 122 | /// Delete an item from the user's inventory |
121 | /// </summary> | 123 | /// </summary> |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index 9b2e331..bcf9d87 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -383,6 +383,48 @@ namespace OpenSim.Services.Connectors | |||
383 | return false; | 383 | return false; |
384 | } | 384 | } |
385 | 385 | ||
386 | /** | ||
387 | * MoveItems Async group | ||
388 | */ | ||
389 | |||
390 | delegate void MoveItemsDelegate(string userID, List<InventoryItemBase> items, UUID sessionID); | ||
391 | |||
392 | private void MoveItemsAsync(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
393 | { | ||
394 | try | ||
395 | { | ||
396 | SynchronousRestSessionObjectPoster<List<InventoryItemBase>, bool>.BeginPostObject( | ||
397 | "POST", m_ServerURI + "/MoveItems/", items, sessionID.ToString(), userID.ToString()); | ||
398 | |||
399 | // Success | ||
400 | return; | ||
401 | } | ||
402 | catch (Exception e) | ||
403 | { | ||
404 | m_log.ErrorFormat("[INVENTORY CONNECTOR]: Move inventory items operation failed, {0} {1} (old server?). Trying slow way.", | ||
405 | e.Source, e.Message); | ||
406 | } | ||
407 | |||
408 | foreach (InventoryItemBase item in items) | ||
409 | { | ||
410 | InventoryItemBase itm = this.QueryItem(userID, item, sessionID); | ||
411 | itm.Name = item.Name; | ||
412 | itm.Folder = item.Folder; | ||
413 | this.UpdateItem(userID, itm, sessionID); | ||
414 | } | ||
415 | } | ||
416 | |||
417 | private void MoveItemsCompleted(IAsyncResult iar) | ||
418 | { | ||
419 | } | ||
420 | |||
421 | public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID) | ||
422 | { | ||
423 | MoveItemsDelegate d = MoveItemsAsync; | ||
424 | d.BeginInvoke(userID, items, sessionID, MoveItemsCompleted, d); | ||
425 | return true; | ||
426 | } | ||
427 | |||
386 | public bool DeleteItems(string userID, List<UUID> items, UUID sessionID) | 428 | public bool DeleteItems(string userID, List<UUID> items, UUID sessionID) |
387 | { | 429 | { |
388 | try | 430 | try |
diff --git a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs index 3bbf129..cd283ff 100644 --- a/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/QuickAndDirtyInventoryServiceConnector.cs | |||
@@ -151,6 +151,11 @@ namespace OpenSim.Services.Connectors | |||
151 | return false; | 151 | return false; |
152 | } | 152 | } |
153 | 153 | ||
154 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
155 | { | ||
156 | return false; | ||
157 | } | ||
158 | |||
154 | public bool DeleteItems(UUID owner, List<UUID> itemIDs) | 159 | public bool DeleteItems(UUID owner, List<UUID> itemIDs) |
155 | { | 160 | { |
156 | return false; | 161 | return false; |
diff --git a/OpenSim/Services/Interfaces/IInventoryService.cs b/OpenSim/Services/Interfaces/IInventoryService.cs index 6409b57..ebdb09a 100644 --- a/OpenSim/Services/Interfaces/IInventoryService.cs +++ b/OpenSim/Services/Interfaces/IInventoryService.cs | |||
@@ -142,6 +142,8 @@ namespace OpenSim.Services.Interfaces | |||
142 | /// <returns>true if the item was successfully updated</returns> | 142 | /// <returns>true if the item was successfully updated</returns> |
143 | bool UpdateItem(InventoryItemBase item); | 143 | bool UpdateItem(InventoryItemBase item); |
144 | 144 | ||
145 | bool MoveItems(UUID ownerID, List<InventoryItemBase> items); | ||
146 | |||
145 | /// <summary> | 147 | /// <summary> |
146 | /// Delete an item from the user's inventory | 148 | /// Delete an item from the user's inventory |
147 | /// </summary> | 149 | /// </summary> |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index 69b1b28..e0217f6 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -386,6 +386,24 @@ namespace OpenSim.Services.InventoryService | |||
386 | return true; | 386 | return true; |
387 | } | 387 | } |
388 | 388 | ||
389 | public virtual bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
390 | { | ||
391 | m_log.InfoFormat( | ||
392 | "[INVENTORY SERVICE]: Moving {0} items from user {1}", items.Count, ownerID); | ||
393 | |||
394 | InventoryItemBase itm = null; | ||
395 | foreach (InventoryItemBase item in items) | ||
396 | { | ||
397 | itm = GetInventoryItem(item.ID); | ||
398 | itm.Folder = item.Folder; | ||
399 | if ((item.Name != null) && !item.Name.Equals(string.Empty)) | ||
400 | itm.Name = item.Name; | ||
401 | m_Database.updateInventoryItem(itm); | ||
402 | } | ||
403 | |||
404 | return true; | ||
405 | } | ||
406 | |||
389 | // See IInventoryServices | 407 | // See IInventoryServices |
390 | public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs) | 408 | public virtual bool DeleteItems(UUID owner, List<UUID> itemIDs) |
391 | { | 409 | { |