* refactor: Move RequestInventoryForUser() from service to CachedUserInfo
* This simplifies callers in most cases - CachedUserInfo is already handling the rest of the fetch inventory work anyway0.6.3-post-fixes
parent
058ec414b4
commit
31ca3a8d4d
|
@ -203,6 +203,25 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fetch inventory for this user.
|
||||||
|
/// </summary>
|
||||||
|
/// This has to be executed as a separate step once user information is retreived.
|
||||||
|
/// This will occur synchronously if the inventory service is in the same process as this class, and
|
||||||
|
/// asynchronously otherwise.
|
||||||
|
public void FetchInventory()
|
||||||
|
{
|
||||||
|
if (m_commsManager.SecureInventoryService != null)
|
||||||
|
{
|
||||||
|
m_commsManager.SecureInventoryService.RequestInventoryForUser(
|
||||||
|
UserProfile.ID, SessionID, InventoryReceive);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Callback invoked when the inventory is received from an async request to the inventory service
|
/// Callback invoked when the inventory is received from an async request to the inventory service
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -104,36 +104,6 @@ namespace OpenSim.Framework.Communications.Cache
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Request the inventory data for the given user. This will occur asynchronously if running on a grid
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <param name="userInfo"></param>
|
|
||||||
public void RequestInventoryForUser(UUID userID)
|
|
||||||
{
|
|
||||||
CachedUserInfo userInfo = GetUserDetails(userID);
|
|
||||||
if (userInfo != null)
|
|
||||||
{
|
|
||||||
if (m_commsManager.SecureInventoryService != null)
|
|
||||||
{
|
|
||||||
m_commsManager.SecureInventoryService.RequestInventoryForUser(userID, userInfo.SessionID, userInfo.InventoryReceive);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
|
|
||||||
}
|
|
||||||
//IInventoryServices invService = userInfo.GetInventoryService();
|
|
||||||
//if (invService != null)
|
|
||||||
//{
|
|
||||||
// invService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_log.ErrorFormat("[USER CACHE]: RequestInventoryForUser() - user profile for user {0} not found", userID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get cached details of the given user. If the user isn't in cache then the user is requested from the
|
/// Get cached details of the given user. If the user isn't in cache then the user is requested from the
|
||||||
/// profile service.
|
/// profile service.
|
||||||
|
|
|
@ -64,7 +64,7 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
/// Test requesting inventory for a user
|
/// Test requesting inventory for a user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TestRequestInventoryForUser()
|
public void TestFetchInventory()
|
||||||
{
|
{
|
||||||
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
TestCommunicationsManager commsManager = new TestCommunicationsManager();
|
||||||
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
|
||||||
|
|
|
@ -59,9 +59,10 @@ namespace OpenSim.Framework.Communications.Tests
|
||||||
|
|
||||||
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
|
lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
|
||||||
|
|
||||||
commsManager.UserProfileCacheService.RequestInventoryForUser(userId);
|
CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
|
||||||
|
userInfo.FetchInventory();
|
||||||
|
|
||||||
return commsManager.UserProfileCacheService.GetUserDetails(userId);
|
return userInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -472,7 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (recipientUserInfo != null)
|
if (recipientUserInfo != null)
|
||||||
{
|
{
|
||||||
if (!recipientUserInfo.HasReceivedInventory)
|
if (!recipientUserInfo.HasReceivedInventory)
|
||||||
CommsManager.UserProfileCacheService.RequestInventoryForUser(recipient);
|
recipientUserInfo.FetchInventory();
|
||||||
|
|
||||||
// Insert a copy of the item into the recipient
|
// Insert a copy of the item into the recipient
|
||||||
InventoryItemBase itemCopy = new InventoryItemBase();
|
InventoryItemBase itemCopy = new InventoryItemBase();
|
||||||
|
@ -1202,7 +1202,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
avatarId);
|
avatarId);
|
||||||
}
|
}
|
||||||
if (!profile.HasReceivedInventory)
|
if (!profile.HasReceivedInventory)
|
||||||
CommsManager.UserProfileCacheService.RequestInventoryForUser(avatarId);
|
profile.FetchInventory();
|
||||||
|
|
||||||
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
|
InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
|
||||||
|
|
||||||
if (agentItem == null)
|
if (agentItem == null)
|
||||||
|
@ -1841,8 +1842,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// Async inventory requests will queue, but they will never
|
// Async inventory requests will queue, but they will never
|
||||||
// execute unless inventory is actually fetched
|
// execute unless inventory is actually fetched
|
||||||
//
|
//
|
||||||
CommsManager.UserProfileCacheService.RequestInventoryForUser(
|
userInfo.FetchInventory();
|
||||||
userInfo.UserProfile.ID);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userInfo != null)
|
if (userInfo != null)
|
||||||
|
|
|
@ -847,7 +847,13 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//SendAnimPack();
|
//SendAnimPack();
|
||||||
|
|
||||||
m_scene.SwapRootAgentCount(false);
|
m_scene.SwapRootAgentCount(false);
|
||||||
m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid);
|
|
||||||
|
CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
|
||||||
|
if (userInfo != null)
|
||||||
|
userInfo.FetchInventory();
|
||||||
|
else
|
||||||
|
m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
|
||||||
|
|
||||||
//m_scene.CapsModule.AddCapsHandler(m_uuid);
|
//m_scene.CapsModule.AddCapsHandler(m_uuid);
|
||||||
|
|
||||||
// On the next prim update, all objects will be sent
|
// On the next prim update, all objects will be sent
|
||||||
|
@ -2504,8 +2510,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Restore the user structures that we needed to delete before asking the receiving region to complete the crossing
|
// Restore the user structures that we needed to delete before asking the receiving region
|
||||||
m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(UUID);
|
// to complete the crossing
|
||||||
|
userInfo.FetchInventory();
|
||||||
m_scene.CapsModule.AddCapsHandler(UUID);
|
m_scene.CapsModule.AddCapsHandler(UUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue