aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-02-12 22:41:57 +0000
committerJustin Clarke Casey2008-02-12 22:41:57 +0000
commit2018cf312bd51350f1f71a8ff1c710d0085a6358 (patch)
tree1ebc025710d1a7644f67e1192e42a5277eeb5b43 /OpenSim
parent* Add missing locking to mysql inventory plugin (diff)
downloadopensim-SC-2018cf312bd51350f1f71a8ff1c710d0085a6358.zip
opensim-SC-2018cf312bd51350f1f71a8ff1c710d0085a6358.tar.gz
opensim-SC-2018cf312bd51350f1f71a8ff1c710d0085a6358.tar.bz2
opensim-SC-2018cf312bd51350f1f71a8ff1c710d0085a6358.tar.xz
Refactor: factor a method out of AgentAssetTransactionsManager
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.Inventory.cs35
2 files changed, 29 insertions, 21 deletions
diff --git a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
index 70471cc..c9c35d2 100644
--- a/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
+++ b/OpenSim/Framework/Communications/Cache/AgentAssetTransactionsManager.cs
@@ -81,28 +81,17 @@ namespace OpenSim.Framework.Communications.Cache
81 /// Get the collection of asset transactions for the given user. 81 /// Get the collection of asset transactions for the given user.
82 /// </summary> 82 /// </summary>
83 /// <param name="userID"></param> 83 /// <param name="userID"></param>
84 /// <returns></returns> 84 /// <returns>null if this agent does not have an asset transactions collection</returns>
85 public AgentAssetTransactions GetUserTransactions(LLUUID userID) 85 public AgentAssetTransactions GetUserTransactions(LLUUID userID)
86 { 86 {
87 if (AgentTransactions.ContainsKey(userID)) 87 if (AgentTransactions.ContainsKey(userID))
88 { 88 {
89 return AgentTransactions[userID]; 89 return AgentTransactions[userID];
90 } 90 }
91
91 return null; 92 return null;
92 } 93 }
93 94
94 public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
95 uint callbackID, string description, string name, sbyte invType,
96 sbyte type, byte wearableType, uint nextOwnerMask)
97 {
98 AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
99 if (transactions != null)
100 {
101 transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
102 name, invType, type, wearableType, nextOwnerMask);
103 }
104 }
105
106 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, 95 public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
107 byte[] data, bool storeLocal, bool tempFile) 96 byte[] data, bool storeLocal, bool tempFile)
108 { 97 {
diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
index 953dce7..0dc3139 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs
@@ -449,7 +449,7 @@ namespace OpenSim.Region.Environment.Scenes
449 /// Create a new inventory item. 449 /// Create a new inventory item.
450 /// </summary> 450 /// </summary>
451 /// <param name="remoteClient"></param> 451 /// <param name="remoteClient"></param>
452 /// <param name="transActionID"></param> 452 /// <param name="transactionID"></param>
453 /// <param name="folderID"></param> 453 /// <param name="folderID"></param>
454 /// <param name="callbackID"></param> 454 /// <param name="callbackID"></param>
455 /// <param name="description"></param> 455 /// <param name="description"></param>
@@ -458,14 +458,16 @@ namespace OpenSim.Region.Environment.Scenes
458 /// <param name="type"></param> 458 /// <param name="type"></param>
459 /// <param name="wearableType"></param> 459 /// <param name="wearableType"></param>
460 /// <param name="nextOwnerMask"></param> 460 /// <param name="nextOwnerMask"></param>
461 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, 461 public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
462 uint callbackID, string description, string name, sbyte invType, 462 uint callbackID, string description, string name, sbyte invType,
463 sbyte assetType, 463 sbyte assetType,
464 byte wearableType, uint nextOwnerMask) 464 byte wearableType, uint nextOwnerMask)
465 { 465 {
466 if (transActionID == LLUUID.Zero) 466 if (transactionID == LLUUID.Zero)
467 { 467 {
468 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 468 CachedUserInfo userInfo
469 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
470
469 if (userInfo != null) 471 if (userInfo != null)
470 { 472 {
471 AssetBase asset = CreateAsset(name, description, invType, assetType, null); 473 AssetBase asset = CreateAsset(name, description, invType, assetType, null);
@@ -473,13 +475,30 @@ namespace OpenSim.Region.Environment.Scenes
473 475
474 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask); 476 CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask);
475 } 477 }
478 else
479 {
480 m_log.ErrorFormat(
481 "userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem",
482 remoteClient.AgentId);
483 }
476 } 484 }
477 else 485 else
478 { 486 {
479 CommsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, 487 AgentAssetTransactions transactions
480 callbackID, description, name, invType, 488 = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
481 assetType, wearableType, nextOwnerMask); 489
482 //System.Console.WriteLine("request to create inventory item from transaction " + transActionID); 490 if (transactions != null)
491 {
492 transactions.RequestCreateInventoryItem(
493 remoteClient, transactionID, folderID, callbackID, description,
494 name, invType, assetType, wearableType, nextOwnerMask);
495 }
496 else
497 {
498 m_log.ErrorFormat(
499 "Agent asset transactions for agent {0} uuid {1} in transaction uuid {2} unexpectedly null!",
500 remoteClient.Name, remoteClient.AgentId, transactionID);
501 }
483 } 502 }
484 } 503 }
485 504