aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs19
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs30
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs2
-rw-r--r--OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs13
6 files changed, 37 insertions, 40 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index 15066cd..c5bbd6a 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -202,6 +202,25 @@ namespace OpenSim.Framework.Communications.Cache
202 m_rootFolder = null; 202 m_rootFolder = null;
203 } 203 }
204 } 204 }
205
206 /// <summary>
207 /// Fetch inventory for this user.
208 /// </summary>
209 /// This has to be executed as a separate step once user information is retreived.
210 /// This will occur synchronously if the inventory service is in the same process as this class, and
211 /// asynchronously otherwise.
212 public void FetchInventory()
213 {
214 if (m_commsManager.SecureInventoryService != null)
215 {
216 m_commsManager.SecureInventoryService.RequestInventoryForUser(
217 UserProfile.ID, SessionID, InventoryReceive);
218 }
219 else
220 {
221 m_commsManager.InventoryService.RequestInventoryForUser(UserProfile.ID, InventoryReceive);
222 }
223 }
205 224
206 /// <summary> 225 /// <summary>
207 /// Callback invoked when the inventory is received from an async request to the inventory service 226 /// Callback invoked when the inventory is received from an async request to the inventory service
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index ef190c8..b1ce3e7 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -105,36 +105,6 @@ namespace OpenSim.Framework.Communications.Cache
105 } 105 }
106 106
107 /// <summary> 107 /// <summary>
108 /// Request the inventory data for the given user. This will occur asynchronously if running on a grid
109 /// </summary>
110 /// <param name="userID"></param>
111 /// <param name="userInfo"></param>
112 public void RequestInventoryForUser(UUID userID)
113 {
114 CachedUserInfo userInfo = GetUserDetails(userID);
115 if (userInfo != null)
116 {
117 if (m_commsManager.SecureInventoryService != null)
118 {
119 m_commsManager.SecureInventoryService.RequestInventoryForUser(userID, userInfo.SessionID, userInfo.InventoryReceive);
120 }
121 else
122 {
123 m_commsManager.InventoryService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
124 }
125 //IInventoryServices invService = userInfo.GetInventoryService();
126 //if (invService != null)
127 //{
128 // invService.RequestInventoryForUser(userID, userInfo.InventoryReceive);
129 //}
130 }
131 else
132 {
133 m_log.ErrorFormat("[USER CACHE]: RequestInventoryForUser() - user profile for user {0} not found", userID);
134 }
135 }
136
137 /// <summary>
138 /// Get cached details of the given user. If the user isn't in cache then the user is requested from the 108 /// Get cached details of the given user. If the user isn't in cache then the user is requested from the
139 /// profile service. 109 /// profile service.
140 /// </summary> 110 /// </summary>
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
index cda9d5c..e2576ef 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileCacheServiceTests.cs
@@ -64,7 +64,7 @@ namespace OpenSim.Framework.Communications.Tests
64 /// Test requesting inventory for a user 64 /// Test requesting inventory for a user
65 /// </summary> 65 /// </summary>
66 [Test] 66 [Test]
67 public void TestRequestInventoryForUser() 67 public void TestFetchInventory()
68 { 68 {
69 TestCommunicationsManager commsManager = new TestCommunicationsManager(); 69 TestCommunicationsManager commsManager = new TestCommunicationsManager();
70 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager); 70 CachedUserInfo userInfo = UserProfileTestUtils.CreateUserWithInventory(commsManager);
diff --git a/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs b/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
index 85cc940..93ce916 100644
--- a/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
+++ b/OpenSim/Framework/Communications/Tests/Cache/UserProfileTestUtils.cs
@@ -59,9 +59,10 @@ namespace OpenSim.Framework.Communications.Tests
59 59
60 lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId); 60 lus.AddUser("Bill", "Bailey", "troll", "bill@bailey.com", 1000, 1000, userId);
61 61
62 commsManager.UserProfileCacheService.RequestInventoryForUser(userId); 62 CachedUserInfo userInfo = commsManager.UserProfileCacheService.GetUserDetails(userId);
63 userInfo.FetchInventory();
63 64
64 return commsManager.UserProfileCacheService.GetUserDetails(userId); 65 return userInfo;
65 } 66 }
66 } 67 }
67} 68}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index e366c79..847d32d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Framework.Scenes
472 if (recipientUserInfo != null) 472 if (recipientUserInfo != null)
473 { 473 {
474 if (!recipientUserInfo.HasReceivedInventory) 474 if (!recipientUserInfo.HasReceivedInventory)
475 CommsManager.UserProfileCacheService.RequestInventoryForUser(recipient); 475 recipientUserInfo.FetchInventory();
476 476
477 // Insert a copy of the item into the recipient 477 // Insert a copy of the item into the recipient
478 InventoryItemBase itemCopy = new InventoryItemBase(); 478 InventoryItemBase itemCopy = new InventoryItemBase();
@@ -1202,7 +1202,8 @@ namespace OpenSim.Region.Framework.Scenes
1202 avatarId); 1202 avatarId);
1203 } 1203 }
1204 if (!profile.HasReceivedInventory) 1204 if (!profile.HasReceivedInventory)
1205 CommsManager.UserProfileCacheService.RequestInventoryForUser(avatarId); 1205 profile.FetchInventory();
1206
1206 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1207 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
1207 1208
1208 if (agentItem == null) 1209 if (agentItem == null)
@@ -1841,8 +1842,7 @@ namespace OpenSim.Region.Framework.Scenes
1841 // Async inventory requests will queue, but they will never 1842 // Async inventory requests will queue, but they will never
1842 // execute unless inventory is actually fetched 1843 // execute unless inventory is actually fetched
1843 // 1844 //
1844 CommsManager.UserProfileCacheService.RequestInventoryForUser( 1845 userInfo.FetchInventory();
1845 userInfo.UserProfile.ID);
1846 } 1846 }
1847 1847
1848 if (userInfo != null) 1848 if (userInfo != null)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 0ed35af..2dd305a 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -847,7 +847,13 @@ namespace OpenSim.Region.Framework.Scenes
847 //SendAnimPack(); 847 //SendAnimPack();
848 848
849 m_scene.SwapRootAgentCount(false); 849 m_scene.SwapRootAgentCount(false);
850 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(m_uuid); 850
851 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
852 if (userInfo != null)
853 userInfo.FetchInventory();
854 else
855 m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
856
851 //m_scene.CapsModule.AddCapsHandler(m_uuid); 857 //m_scene.CapsModule.AddCapsHandler(m_uuid);
852 858
853 // On the next prim update, all objects will be sent 859 // On the next prim update, all objects will be sent
@@ -2504,8 +2510,9 @@ namespace OpenSim.Region.Framework.Scenes
2504 } 2510 }
2505 else 2511 else
2506 { 2512 {
2507 // Restore the user structures that we needed to delete before asking the receiving region to complete the crossing 2513 // Restore the user structures that we needed to delete before asking the receiving region
2508 m_scene.CommsManager.UserProfileCacheService.RequestInventoryForUser(UUID); 2514 // to complete the crossing
2515 userInfo.FetchInventory();
2509 m_scene.CapsModule.AddCapsHandler(UUID); 2516 m_scene.CapsModule.AddCapsHandler(UUID);
2510 } 2517 }
2511 } 2518 }