Refactor: factor a method out of AgentAssetTransactionsManager

ThreadPoolClientBranch
Justin Clarke Casey 2008-02-12 22:41:57 +00:00
parent c0211c1ca2
commit 2018cf312b
2 changed files with 29 additions and 21 deletions

View File

@ -81,28 +81,17 @@ namespace OpenSim.Framework.Communications.Cache
/// Get the collection of asset transactions for the given user. /// Get the collection of asset transactions for the given user.
/// </summary> /// </summary>
/// <param name="userID"></param> /// <param name="userID"></param>
/// <returns></returns> /// <returns>null if this agent does not have an asset transactions collection</returns>
public AgentAssetTransactions GetUserTransactions(LLUUID userID) public AgentAssetTransactions GetUserTransactions(LLUUID userID)
{ {
if (AgentTransactions.ContainsKey(userID)) if (AgentTransactions.ContainsKey(userID))
{ {
return AgentTransactions[userID]; return AgentTransactions[userID];
} }
return null; return null;
} }
public void HandleInventoryFromTransaction(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType,
sbyte type, byte wearableType, uint nextOwnerMask)
{
AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId);
if (transactions != null)
{
transactions.RequestCreateInventoryItem(remoteClient, transactionID, folderID, callbackID, description,
name, invType, type, wearableType, nextOwnerMask);
}
}
public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type,
byte[] data, bool storeLocal, bool tempFile) byte[] data, bool storeLocal, bool tempFile)
{ {

View File

@ -449,7 +449,7 @@ namespace OpenSim.Region.Environment.Scenes
/// Create a new inventory item. /// Create a new inventory item.
/// </summary> /// </summary>
/// <param name="remoteClient"></param> /// <param name="remoteClient"></param>
/// <param name="transActionID"></param> /// <param name="transactionID"></param>
/// <param name="folderID"></param> /// <param name="folderID"></param>
/// <param name="callbackID"></param> /// <param name="callbackID"></param>
/// <param name="description"></param> /// <param name="description"></param>
@ -458,14 +458,16 @@ namespace OpenSim.Region.Environment.Scenes
/// <param name="type"></param> /// <param name="type"></param>
/// <param name="wearableType"></param> /// <param name="wearableType"></param>
/// <param name="nextOwnerMask"></param> /// <param name="nextOwnerMask"></param>
public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transActionID, LLUUID folderID, public void CreateNewInventoryItem(IClientAPI remoteClient, LLUUID transactionID, LLUUID folderID,
uint callbackID, string description, string name, sbyte invType, uint callbackID, string description, string name, sbyte invType,
sbyte assetType, sbyte assetType,
byte wearableType, uint nextOwnerMask) byte wearableType, uint nextOwnerMask)
{ {
if (transActionID == LLUUID.Zero) if (transactionID == LLUUID.Zero)
{ {
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); CachedUserInfo userInfo
= CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null) if (userInfo != null)
{ {
AssetBase asset = CreateAsset(name, description, invType, assetType, null); AssetBase asset = CreateAsset(name, description, invType, assetType, null);
@ -473,13 +475,30 @@ namespace OpenSim.Region.Environment.Scenes
CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask); CreateNewInventoryItem(remoteClient, folderID, callbackID, asset, nextOwnerMask);
} }
else
{
m_log.ErrorFormat(
"userInfo for agent uuid {0} unexpectedly null in CreateNewInventoryItem",
remoteClient.AgentId);
}
} }
else else
{ {
CommsManager.TransactionsManager.HandleInventoryFromTransaction(remoteClient, transActionID, folderID, AgentAssetTransactions transactions
callbackID, description, name, invType, = CommsManager.TransactionsManager.GetUserTransactions(remoteClient.AgentId);
assetType, wearableType, nextOwnerMask);
//System.Console.WriteLine("request to create inventory item from transaction " + transActionID); if (transactions != null)
{
transactions.RequestCreateInventoryItem(
remoteClient, transactionID, folderID, callbackID, description,
name, invType, assetType, wearableType, nextOwnerMask);
}
else
{
m_log.ErrorFormat(
"Agent asset transactions for agent {0} uuid {1} in transaction uuid {2} unexpectedly null!",
remoteClient.Name, remoteClient.AgentId, transactionID);
}
} }
} }