diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 87 |
1 files changed, 83 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 2b8f344..f6f1367 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | |||
@@ -286,10 +286,89 @@ namespace OpenSim.Region.Environment.Scenes | |||
286 | "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); | 286 | "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | |||
290 | /// <summary> | ||
291 | /// Give an inventory item from one avatar to another | ||
292 | /// </summary> | ||
293 | /// <param name="recipientClient"></param> | ||
294 | /// <param name="sender"></param> | ||
295 | /// <param name="itemId"></param> | ||
296 | public void GiveInventoryItem(IClientAPI recipientClient, LLUUID senderId, LLUUID itemId) | ||
297 | { | ||
298 | // Retrieve the item from the sender | ||
299 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); | ||
300 | |||
301 | if (senderUserInfo == null) | ||
302 | { | ||
303 | m_log.ErrorFormat( | ||
304 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); | ||
305 | |||
306 | return; | ||
307 | } | ||
308 | |||
309 | if (senderUserInfo.RootFolder != null) | ||
310 | { | ||
311 | InventoryItemBase item = senderUserInfo.RootFolder.HasItem(itemId); | ||
312 | if (item != null) | ||
313 | { | ||
314 | // TODO get recipient's root folder | ||
315 | CachedUserInfo recipientUserInfo | ||
316 | = CommsManager.UserProfileCacheService.GetUserDetails(recipientClient.AgentId); | ||
317 | |||
318 | if (recipientUserInfo != null) | ||
319 | { | ||
320 | // Insert a copy of the item into the recipient | ||
321 | InventoryItemBase itemCopy = new InventoryItemBase(); | ||
322 | itemCopy.avatarID = recipientClient.AgentId; | ||
323 | itemCopy.creatorsID = recipientClient.AgentId; | ||
324 | itemCopy.inventoryID = LLUUID.Random(); | ||
325 | itemCopy.assetID = item.assetID; | ||
326 | itemCopy.inventoryDescription = item.inventoryDescription; | ||
327 | itemCopy.inventoryName = item.inventoryName; | ||
328 | itemCopy.assetType = item.assetType; | ||
329 | itemCopy.invType = item.invType; | ||
330 | itemCopy.parentFolderID = recipientUserInfo.RootFolder.folderID; | ||
331 | itemCopy.inventoryCurrentPermissions = 2147483647; | ||
332 | itemCopy.inventoryNextPermissions = 2147483647; | ||
333 | itemCopy.inventoryEveryOnePermissions = item.inventoryEveryOnePermissions; | ||
334 | itemCopy.inventoryBasePermissions = item.inventoryBasePermissions; | ||
335 | itemCopy.inventoryCurrentPermissions = item.inventoryCurrentPermissions; | ||
336 | |||
337 | recipientUserInfo.AddItem(recipientClient.AgentId, itemCopy); | ||
338 | |||
339 | // Let the recipient client know about this new item | ||
340 | recipientClient.SendBulkUpdateInventory(itemCopy); | ||
341 | } | ||
342 | else | ||
343 | { | ||
344 | m_log.ErrorFormat( | ||
345 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0}, {1} of item {2}, {3} from {4}", | ||
346 | recipientClient.Name, recipientClient.AgentId, item.inventoryName, | ||
347 | item.inventoryID, senderId); | ||
348 | } | ||
349 | } | ||
350 | else | ||
351 | { | ||
352 | m_log.ErrorFormat( | ||
353 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); | ||
354 | |||
355 | return; | ||
356 | } | ||
357 | } | ||
358 | else | ||
359 | { | ||
360 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); | ||
361 | return; | ||
362 | } | ||
363 | } | ||
289 | 364 | ||
290 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, | 365 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, LLUUID oldAgentID, LLUUID oldItemID, |
291 | LLUUID newFolderID, string newName) | 366 | LLUUID newFolderID, string newName) |
292 | { | 367 | { |
368 | m_log.DebugFormat( | ||
369 | "[AGENT INVENTORY]: CopyInventoryItem received by {0} with oldAgentID {1}, oldItemID {2}, new FolderID {3}, newName {4}", | ||
370 | remoteClient.AgentId, oldAgentID, oldItemID, newFolderID, newName); | ||
371 | |||
293 | InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID); | 372 | InventoryItemBase item = CommsManager.UserProfileCacheService.libraryRoot.HasItem(oldItemID); |
294 | if (item == null) | 373 | if (item == null) |
295 | { | 374 | { |
@@ -349,9 +428,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
349 | public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, | 428 | public void MoveInventoryItem(IClientAPI remoteClient, LLUUID folderID, LLUUID itemID, int length, |
350 | string newName) | 429 | string newName) |
351 | { | 430 | { |
352 | m_log.Info( | 431 | m_log.DebugFormat( |
353 | "[AGENT INVENTORY]: " + | 432 | "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); |
354 | "Moving item for " + remoteClient.AgentId.ToString()); | ||
355 | 433 | ||
356 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 434 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); |
357 | if (userInfo == null) | 435 | if (userInfo == null) |
@@ -429,7 +507,8 @@ namespace OpenSim.Region.Environment.Scenes | |||
429 | } | 507 | } |
430 | 508 | ||
431 | /// <summary> | 509 | /// <summary> |
432 | /// Create a new inventory item. | 510 | /// Create a new inventory item. Called when the client creates a new item directly within their |
511 | /// inventory (e.g. by selecting a context inventory menu option). | ||
433 | /// </summary> | 512 | /// </summary> |
434 | /// <param name="remoteClient"></param> | 513 | /// <param name="remoteClient"></param> |
435 | /// <param name="transactionID"></param> | 514 | /// <param name="transactionID"></param> |