diff options
author | Melanie Thielker | 2009-03-21 18:14:06 +0000 |
---|---|---|
committer | Melanie Thielker | 2009-03-21 18:14:06 +0000 |
commit | 1e6587f1d3573608e5db0732dde2078cac293002 (patch) | |
tree | 2e8ba887a19a4820fdc33cd056cf87549faa78af /OpenSim/Region/CoreModules/Avatar | |
parent | Moving HGStandaloneAssetService to a new place, and giving it a more generic ... (diff) | |
download | opensim-SC_OLD-1e6587f1d3573608e5db0732dde2078cac293002.zip opensim-SC_OLD-1e6587f1d3573608e5db0732dde2078cac293002.tar.gz opensim-SC_OLD-1e6587f1d3573608e5db0732dde2078cac293002.tar.bz2 opensim-SC_OLD-1e6587f1d3573608e5db0732dde2078cac293002.tar.xz |
Add code to the inventory transfer module to use the new DB functionality
Not tested!
Diffstat (limited to 'OpenSim/Region/CoreModules/Avatar')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 0a67689..64ec356 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs | |||
@@ -79,6 +79,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
79 | 79 | ||
80 | scene.EventManager.OnNewClient += OnNewClient; | 80 | scene.EventManager.OnNewClient += OnNewClient; |
81 | scene.EventManager.OnClientClosed += ClientLoggedOut; | 81 | scene.EventManager.OnClientClosed += ClientLoggedOut; |
82 | scene.EventManager.OnIncomingInstantMessage += OnGridInstantMessage; | ||
82 | } | 83 | } |
83 | } | 84 | } |
84 | 85 | ||
@@ -384,5 +385,76 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | |||
384 | if (m_AgentRegions.ContainsKey(agentID)) | 385 | if (m_AgentRegions.ContainsKey(agentID)) |
385 | m_AgentRegions.Remove(agentID); | 386 | m_AgentRegions.Remove(agentID); |
386 | } | 387 | } |
388 | |||
389 | /// <summary> | ||
390 | /// | ||
391 | /// </summary> | ||
392 | /// <param name="msg"></param> | ||
393 | private void OnGridInstantMessage(GridInstantMessage msg) | ||
394 | { | ||
395 | Scene scene = FindClientScene(new UUID(msg.toAgentID)); | ||
396 | |||
397 | // Find agent to deliver to | ||
398 | // | ||
399 | ScenePresence user = scene.GetScenePresence(new UUID(msg.toAgentID)); | ||
400 | |||
401 | if (user == null) // Shouldn't happen | ||
402 | { | ||
403 | m_log.Debug("[INVENTORY TRANSFER] Can't find recipient"); | ||
404 | return; | ||
405 | } | ||
406 | |||
407 | CachedUserInfo userInfo = | ||
408 | scene.CommsManager.UserProfileCacheService. | ||
409 | GetUserDetails(user.ControllingClient.AgentId); | ||
410 | |||
411 | if (userInfo == null) | ||
412 | { | ||
413 | m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient"); | ||
414 | return; | ||
415 | } | ||
416 | |||
417 | AssetType assetType = (AssetType)msg.binaryBucket[0]; | ||
418 | |||
419 | if (AssetType.Folder == assetType) | ||
420 | { | ||
421 | // Folders not implemented yet | ||
422 | // | ||
423 | return; | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | UUID itemID = new UUID(msg.binaryBucket, 1); | ||
428 | |||
429 | // Fetch from database | ||
430 | // | ||
431 | if (!userInfo.QueryItem(itemID)) | ||
432 | { | ||
433 | m_log.Debug("[INVENTORY TRANSFER] Can't find item to give"); | ||
434 | return; | ||
435 | } | ||
436 | |||
437 | // Get item info | ||
438 | // | ||
439 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | ||
440 | if (item == null) | ||
441 | { | ||
442 | m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give"); | ||
443 | return; | ||
444 | } | ||
445 | |||
446 | // Update item to viewer (makes it appear in proper folder) | ||
447 | // | ||
448 | user.ControllingClient.SendBulkUpdateInventory(item); | ||
449 | |||
450 | // Deliver message | ||
451 | // | ||
452 | user.ControllingClient.SendInstantMessage( | ||
453 | new UUID(msg.fromAgentID), msg.message, | ||
454 | new UUID(msg.toAgentID), | ||
455 | msg.fromAgentName, msg.dialog, msg.timestamp, | ||
456 | itemID, false, msg.binaryBucket); | ||
457 | } | ||
458 | } | ||
387 | } | 459 | } |
388 | } | 460 | } |