aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs17
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs4
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs45
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs46
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs194
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs129
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs10
10 files changed, 146 insertions, 390 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 7633b7b..aaa236c 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -6609,20 +6609,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
6609 } 6609 }
6610 else // Agent 6610 else // Agent
6611 { 6611 {
6612 CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId); 6612 //InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
6613 if (userInfo == null) 6613 IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>();
6614 { 6614 InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(itemID));
6615 m_log.ErrorFormat(
6616 "[CLIENT]: Could not resolve user {0} for caps inventory update",
6617 AgentId);
6618
6619 break;
6620 }
6621
6622 if (userInfo.RootFolder == null)
6623 break;
6624
6625 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID);
6626 if (assetRequestItem == null) 6615 if (assetRequestItem == null)
6627 { 6616 {
6628 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); 6617 assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
index fa5369f..956dd10 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs
@@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache;
37using OpenSim.Region.Framework.Interfaces; 37using OpenSim.Region.Framework.Interfaces;
38using OpenSim.Region.Framework.Scenes; 38using OpenSim.Region.Framework.Scenes;
39using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>; 39using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>;
40using OpenSim.Services.Interfaces;
40 41
41namespace OpenSim.Region.CoreModules.Agent.TextureDownload 42namespace OpenSim.Region.CoreModules.Agent.TextureDownload
42{ 43{
@@ -217,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
217 if (profile == null) // Deny unknown user 218 if (profile == null) // Deny unknown user
218 return; 219 return;
219 220
220 if (profile.RootFolder == null) // Deny no inventory 221 IInventoryService invService = scene.InventoryService;
222 if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory
221 return; 223 return;
222 224
223 if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned 225 if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index 33dc7a5..547f923 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -34,6 +34,7 @@ using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
36using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
37using OpenSim.Services.Interfaces;
37 38
38namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory 39namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
39{ 40{
@@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
115 } 116 }
116 117
117 118
118 public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance) 119 public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance)
119 { 120 {
120 if (profile.RootFolder != null) 121 IInventoryService invService = m_scene.InventoryService;
122
123 if (invService.GetRootFolder(userID) != null)
121 { 124 {
122 for (int i = 0; i < 13; i++) 125 for (int i = 0; i < 13; i++)
123 { 126 {
@@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
127 } 130 }
128 else 131 else
129 { 132 {
130 InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); 133 InventoryItemBase baseItem = invService.QueryItem(new InventoryItemBase(appearance.Wearables[i].ItemID));
131 134
132 if (baseItem != null) 135 if (baseItem != null)
133 { 136 {
@@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
143 } 146 }
144 else 147 else
145 { 148 {
146 m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work"); 149 m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID);
147 } 150 }
148 } 151 }
149 152
@@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
163 return; 166 return;
164 } 167 }
165 168
166 CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId);
167
168 AvatarAppearance avatAppearance = null; 169 AvatarAppearance avatAppearance = null;
169 if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) 170 if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance))
170 { 171 {
@@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
174 175
175 //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); 176 //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name);
176 177
177 if (profile != null) 178 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing)
178 { 179 {
179 if (profile.RootFolder != null) 180 if (wear.Type < 13)
180 { 181 {
181 foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) 182 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
182 {
183 if (wear.Type < 13)
184 {
185 avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID;
186 }
187 }
188
189 SetAppearanceAssets(profile, ref avatAppearance);
190
191 m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
192 avatar.Appearance = avatAppearance;
193 }
194 else
195 {
196 m_log.WarnFormat(
197 "[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables",
198 clientView.Name);
199 } 183 }
200 } 184 }
201 else 185
202 { 186 SetAppearanceAssets(avatar.UUID, ref avatAppearance);
203 m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name); 187
204 } 188 m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance);
189 avatar.Appearance = avatAppearance;
205 } 190 }
206 191
207 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) 192 public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams)
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
index 6db9cbf..8f99395 100644
--- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
+++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
38 39
39// Temporary fix of wrong GroupPowers constants in OpenMetaverse library 40// Temporary fix of wrong GroupPowers constants in OpenMetaverse library
40enum GroupPowers : long 41enum GroupPowers : long
@@ -964,19 +965,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
964 965
965 if (objectID == UUID.Zero) // User inventory 966 if (objectID == UUID.Zero) // User inventory
966 { 967 {
967 CachedUserInfo userInfo = 968 IInventoryService invService = m_scene.InventoryService;
968 scene.CommsManager.UserProfileCacheService.GetUserDetails(user); 969 InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(notecard));
969
970 if (userInfo == null)
971 {
972 m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for edit notecard check", user);
973 return false;
974 }
975
976 if (userInfo.RootFolder == null)
977 return false;
978
979 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
980 if (assetRequestItem == null) // Library item 970 if (assetRequestItem == null) // Library item
981 { 971 {
982 assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 972 assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
@@ -1394,19 +1384,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1394 1384
1395 if (objectID == UUID.Zero) // User inventory 1385 if (objectID == UUID.Zero) // User inventory
1396 { 1386 {
1397 CachedUserInfo userInfo = 1387 IInventoryService invService = m_scene.InventoryService;
1398 scene.CommsManager.UserProfileCacheService.GetUserDetails(user); 1388 InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(script));
1399
1400 if (userInfo == null)
1401 {
1402 m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for administrator check", user);
1403 return false;
1404 }
1405
1406 if (userInfo.RootFolder == null)
1407 return false;
1408
1409 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script);
1410 if (assetRequestItem == null) // Library item 1389 if (assetRequestItem == null) // Library item
1411 { 1390 {
1412 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); 1391 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script);
@@ -1499,19 +1478,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions
1499 1478
1500 if (objectID == UUID.Zero) // User inventory 1479 if (objectID == UUID.Zero) // User inventory
1501 { 1480 {
1502 CachedUserInfo userInfo = 1481 IInventoryService invService = m_scene.InventoryService;
1503 scene.CommsManager.UserProfileCacheService.GetUserDetails(user); 1482 InventoryItemBase assetRequestItem = invService.QueryItem(new InventoryItemBase(notecard));
1504
1505 if (userInfo == null)
1506 {
1507 m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for view notecard check", user);
1508 return false;
1509 }
1510
1511 if (userInfo.RootFolder == null)
1512 return false;
1513
1514 InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard);
1515 if (assetRequestItem == null) // Library item 1483 if (assetRequestItem == null) // Library item
1516 { 1484 {
1517 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); 1485 assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard);
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
index 4224198..5d65f98 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs
@@ -201,31 +201,31 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
201 } 201 }
202 } 202 }
203 203
204 public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) 204 //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo)
205 { 205 //{
206 InventoryClient invCli = null; 206 // InventoryClient invCli = null;
207 string inventoryURL = UserInventoryURL(item.Owner); 207 // string inventoryURL = UserInventoryURL(item.Owner);
208 if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) 208 // if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli))
209 { 209 // {
210 m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL); 210 // m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL);
211 invCli = new InventoryClient(inventoryURL); 211 // invCli = new InventoryClient(inventoryURL);
212 m_inventoryServers.Add(inventoryURL, invCli); 212 // m_inventoryServers.Add(inventoryURL, invCli);
213 } 213 // }
214 214
215 item = invCli.GetInventoryItem(item); 215 // item = invCli.GetInventoryItem(item);
216 if (item != null) 216 // if (item != null)
217 { 217 // {
218 // Change the folder, stick it in root folder, all items flattened out here in this region cache 218 // // Change the folder, stick it in root folder, all items flattened out here in this region cache
219 item.Folder = rootFolder; 219 // item.Folder = rootFolder;
220 //userInfo.AddItem(item); don't use this, it calls back to the inventory server 220 // //userInfo.AddItem(item); don't use this, it calls back to the inventory server
221 lock (userInfo.RootFolder.Items) 221 // lock (userInfo.RootFolder.Items)
222 { 222 // {
223 userInfo.RootFolder.Items[item.ID] = item; 223 // userInfo.RootFolder.Items[item.ID] = item;
224 } 224 // }
225 225
226 } 226 // }
227 return item; 227 // return item;
228 } 228 //}
229 229
230 public void Post(UUID assetID, UUID ownerID) 230 public void Post(UUID assetID, UUID ownerID)
231 { 231 {
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
index cb6794e..1b93f46 100644
--- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs
@@ -117,25 +117,20 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid
117 117
118 if (fromTaskID.Equals(UUID.Zero)) 118 if (fromTaskID.Equals(UUID.Zero))
119 { 119 {
120 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 120 InventoryItemBase item = new InventoryItemBase(itemID);
121 if (userInfo != null) 121 item.Owner = remoteClient.AgentId;
122 item = InventoryService.QueryItem(item);
123 //if (item == null)
124 //{ // Fetch the item
125 // item = new InventoryItemBase();
126 // item.Owner = remoteClient.AgentId;
127 // item.ID = itemID;
128 // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
129 //}
130 if (item != null)
122 { 131 {
123 if (userInfo.RootFolder != null) 132 m_assMapper.Get(item.AssetID, remoteClient.AgentId);
124 { 133
125 InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
126 if (item == null)
127 { // Fetch the item
128 item = new InventoryItemBase();
129 item.Owner = remoteClient.AgentId;
130 item.ID = itemID;
131 item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo);
132 }
133 if (item != null)
134 {
135 m_assMapper.Get(item.AssetID, remoteClient.AgentId);
136
137 }
138 }
139 } 134 }
140 } 135 }
141 136
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 80f71b3..cd91e8c 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -558,24 +558,9 @@ namespace OpenSim.Region.Framework.Scenes
558 558
559 if (item == null) 559 if (item == null)
560 { 560 {
561 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); 561 item = InventoryService.QueryItem(new InventoryItemBase(oldItemID));
562 if (userInfo == null)
563 {
564 m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString());
565 return;
566 }
567
568 if (userInfo.RootFolder != null)
569 {
570 item = userInfo.RootFolder.FindItem(oldItemID);
571 562
572 if (item == null) 563 if (item == null)
573 {
574 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
575 return;
576 }
577 }
578 else
579 { 564 {
580 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); 565 m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString());
581 return; 566 return;
@@ -822,28 +807,15 @@ namespace OpenSim.Region.Framework.Scenes
822 /// <param name="folderID"></param> 807 /// <param name="folderID"></param>
823 private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) 808 private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID)
824 { 809 {
825 CachedUserInfo userInfo 810 // Unclear is this handler is ever called by the Linden client, but it might
826 = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
827
828 if (userInfo == null)
829 {
830 m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString());
831 return;
832 }
833 811
834 if (userInfo.RootFolder != null) 812 InventoryFolderBase folder = new InventoryFolderBase(folderID);
813 folder.Owner = remoteClient.AgentId;
814 InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder);
815 if (trash != null)
835 { 816 {
836 InventoryItemBase folder = userInfo.RootFolder.FindItem(folderID); 817 folder.ParentID = trash.ID;
837 818 InventoryService.MoveFolder(folder);
838 if (folder != null)
839 {
840 m_log.WarnFormat(
841 "[AGENT INVENTORY]: Remove folder not implemented in request by {0} {1} for {2}",
842 remoteClient.Name, remoteClient.AgentId, folderID);
843
844 // doesn't work just yet, commented out. will fix in next patch.
845 // userInfo.DeleteItem(folder);
846 }
847 } 819 }
848 } 820 }
849 821
@@ -1060,20 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes
1060 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); 1032 return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId);
1061 } 1033 }
1062 else 1034 else
1063 { 1035 {
1064 CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(avatarId);
1065 if (profile == null || profile.RootFolder == null)
1066 {
1067 m_log.ErrorFormat(
1068 "[PRIM INVENTORY]: " +
1069 "Avatar {0} cannot be found to add item",
1070 avatarId);
1071 return null;
1072 }
1073
1074 if (!profile.HasReceivedInventory)
1075 profile.FetchInventory();
1076
1077 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); 1036 InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId);
1078 1037
1079 if (agentItem == null) 1038 if (agentItem == null)
@@ -1265,39 +1224,33 @@ namespace OpenSim.Region.Framework.Scenes
1265 UUID copyID = UUID.Random(); 1224 UUID copyID = UUID.Random();
1266 if (itemID != UUID.Zero) 1225 if (itemID != UUID.Zero)
1267 { 1226 {
1268 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 1227 InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
1269 1228
1270 if (userInfo != null && userInfo.RootFolder != null) 1229 // Try library
1230 if (null == item)
1271 { 1231 {
1272 InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); 1232 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1273 1233 }
1274 // Try library
1275 // XXX clumsy, possibly should be one call
1276 if (null == item)
1277 {
1278 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1279 }
1280 1234
1281 if (item != null) 1235 if (item != null)
1282 { 1236 {
1283 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); 1237 part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID);
1284 m_log.InfoFormat( 1238 m_log.InfoFormat(
1285 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", 1239 "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}",
1286 item.Name, primLocalID, remoteClient.Name); 1240 item.Name, primLocalID, remoteClient.Name);
1287 part.GetProperties(remoteClient); 1241 part.GetProperties(remoteClient);
1288 if (!Permissions.BypassPermissions()) 1242 if (!Permissions.BypassPermissions())
1289 {
1290 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1291 RemoveInventoryItem(remoteClient, itemID);
1292 }
1293 }
1294 else
1295 { 1243 {
1296 m_log.ErrorFormat( 1244 if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
1297 "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", 1245 RemoveInventoryItem(remoteClient, itemID);
1298 itemID, remoteClient.Name);
1299 } 1246 }
1300 } 1247 }
1248 else
1249 {
1250 m_log.ErrorFormat(
1251 "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!",
1252 itemID, remoteClient.Name);
1253 }
1301 } 1254 }
1302 } 1255 }
1303 else // Updating existing item with new perms etc 1256 else // Updating existing item with new perms etc
@@ -1334,53 +1287,48 @@ namespace OpenSim.Region.Framework.Scenes
1334 1287
1335 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory 1288 if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
1336 { 1289 {
1337 CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 1290 InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
1338 1291
1339 if (userInfo != null && userInfo.RootFolder != null) 1292 // Try library
1293 // XXX clumsy, possibly should be one call
1294 if (null == item)
1340 { 1295 {
1341 InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); 1296 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1342 1297 }
1343 // Try library
1344 // XXX clumsy, possibly should be one call
1345 if (null == item)
1346 {
1347 item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
1348 }
1349 1298
1350 if (item != null) 1299 if (item != null)
1300 {
1301 SceneObjectPart part = GetSceneObjectPart(localID);
1302 if (part != null)
1351 { 1303 {
1352 SceneObjectPart part = GetSceneObjectPart(localID); 1304 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
1353 if (part != null) 1305 return;
1354 {
1355 if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
1356 return;
1357 1306
1358 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); 1307 part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
1359 // TODO: switch to posting on_rez here when scripts 1308 // TODO: switch to posting on_rez here when scripts
1360 // have state in inventory 1309 // have state in inventory
1361 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); 1310 part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
1362 1311
1363 // m_log.InfoFormat("[PRIMINVENTORY]: " + 1312 // m_log.InfoFormat("[PRIMINVENTORY]: " +
1364 // "Rezzed script {0} into prim local ID {1} for user {2}", 1313 // "Rezzed script {0} into prim local ID {1} for user {2}",
1365 // item.inventoryName, localID, remoteClient.Name); 1314 // item.inventoryName, localID, remoteClient.Name);
1366 part.GetProperties(remoteClient); 1315 part.GetProperties(remoteClient);
1367 }
1368 else
1369 {
1370 m_log.ErrorFormat(
1371 "[PRIM INVENTORY]: " +
1372 "Could not rez script {0} into prim local ID {1} for user {2}"
1373 + " because the prim could not be found in the region!",
1374 item.Name, localID, remoteClient.Name);
1375 }
1376 } 1316 }
1377 else 1317 else
1378 { 1318 {
1379 m_log.ErrorFormat( 1319 m_log.ErrorFormat(
1380 "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", 1320 "[PRIM INVENTORY]: " +
1381 itemID, remoteClient.Name); 1321 "Could not rez script {0} into prim local ID {1} for user {2}"
1322 + " because the prim could not be found in the region!",
1323 item.Name, localID, remoteClient.Name);
1382 } 1324 }
1383 } 1325 }
1326 else
1327 {
1328 m_log.ErrorFormat(
1329 "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
1330 itemID, remoteClient.Name);
1331 }
1384 } 1332 }
1385 else // script has been rezzed directly into a prim's inventory 1333 else // script has been rezzed directly into a prim's inventory
1386 { 1334 {
@@ -1670,26 +1618,6 @@ namespace OpenSim.Region.Framework.Scenes
1670 } 1618 }
1671 } 1619 }
1672 1620
1673 private bool WaitForInventory(CachedUserInfo info)
1674 {
1675 // 200 Seconds wait. This is called in the context of the
1676 // background delete thread, so we can afford to waste time
1677 // here.
1678 //
1679 int count = 200;
1680
1681 while (count > 0)
1682 {
1683 System.Threading.Thread.Sleep(100);
1684 count--;
1685 if (info.HasReceivedInventory)
1686 return true;
1687 }
1688 m_log.DebugFormat("Timed out waiting for inventory of user {0}",
1689 info.UserProfile.ID.ToString());
1690 return false;
1691 }
1692
1693 /// <summary> 1621 /// <summary>
1694 /// Delete a scene object from a scene and place in the given avatar's inventory. 1622 /// Delete a scene object from a scene and place in the given avatar's inventory.
1695 /// Returns the UUID of the newly created asset. 1623 /// Returns the UUID of the newly created asset.
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index ba858ed..e2debe5 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -382,31 +382,13 @@ namespace OpenSim.Region.Framework.Scenes
382 return; 382 return;
383 } 383 }
384 384
385 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); 385 InventoryItemBase item = InventoryService.QueryItem(new InventoryItemBase(itemID));
386 386
387 if (null == userProfile) 387 if (item != null)
388 { 388 {
389 m_log.ErrorFormat( 389 remoteClient.SendInventoryItemDetails(ownerID, item);
390 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
391 remoteClient.Name, remoteClient.AgentId);
392 return;
393 }
394
395 if (userProfile.HasReceivedInventory)
396 {
397 InventoryItemBase item = null;
398 if (userProfile.RootFolder == null)
399 m_log.ErrorFormat(
400 "[AGENT INVENTORY]: User {0} {1} does not have a root folder.",
401 remoteClient.Name, remoteClient.AgentId);
402 else
403 item = userProfile.RootFolder.FindItem(itemID);
404
405 if (item != null)
406 {
407 remoteClient.SendInventoryItemDetails(ownerID, item);
408 }
409 } 390 }
391 // else shouldn't we send an alert message?
410 } 392 }
411 393
412 /// <summary> 394 /// <summary>
@@ -442,6 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
442 /// Handle the caps inventory descendents fetch. 424 /// Handle the caps inventory descendents fetch.
443 /// 425 ///
444 /// Since the folder structure is sent to the client on login, I believe we only need to handle items. 426 /// Since the folder structure is sent to the client on login, I believe we only need to handle items.
427 /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime??
445 /// </summary> 428 /// </summary>
446 /// <param name="agentID"></param> 429 /// <param name="agentID"></param>
447 /// <param name="folderID"></param> 430 /// <param name="folderID"></param>
@@ -467,59 +450,10 @@ namespace OpenSim.Region.Framework.Scenes
467 { 450 {
468 return fold.RequestListOfItems(); 451 return fold.RequestListOfItems();
469 } 452 }
470
471 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID);
472
473 if (null == userProfile)
474 {
475 m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID);
476 return null;
477 }
478
479 // XXX: When a client crosses into a scene, their entire inventory is fetched
480 // asynchronously. If the client makes a request before the inventory is received, we need
481 // to give the inventory a chance to come in.
482 //
483 // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad
484 // in CAPS as doing this with the udp request, since here it won't hold up other packets.
485 // In fact, here we'll be generous and try for longer.
486 if (!userProfile.HasReceivedInventory)
487 {
488 int attempts = 0;
489 while (attempts++ < 30)
490 {
491 m_log.DebugFormat(
492 "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}",
493 attempts, folderID, agentID);
494 453
495 Thread.Sleep(2000); 454 InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID);
496 455 return contents.Items;
497 if (userProfile.HasReceivedInventory)
498 {
499 break;
500 }
501 }
502 }
503 456
504 if (userProfile.HasReceivedInventory)
505 {
506 if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null)
507 {
508 return fold.RequestListOfItems();
509 }
510 else
511 {
512 m_log.WarnFormat(
513 "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}",
514 folderID, agentID);
515 return null;
516 }
517 }
518 else
519 {
520 m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID);
521 return null;
522 }
523 } 457 }
524 458
525 /// <summary> 459 /// <summary>
@@ -579,34 +513,8 @@ namespace OpenSim.Region.Framework.Scenes
579 } 513 }
580 } 514 }
581 515
582 /// <summary>
583 /// Handle an inventory folder move request from the client.
584 /// </summary>
585 /// <param name="remoteClient"></param>
586 /// <param name="folderID"></param>
587 /// <param name="parentID"></param>
588 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) 516 public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID)
589 { 517 {
590 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
591
592 if (null == userProfile)
593 {
594 m_log.ErrorFormat(
595 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
596 remoteClient.Name, remoteClient.AgentId);
597 return;
598 }
599
600 if (!userProfile.MoveFolder(folderID, parentID))
601 {
602 m_log.ErrorFormat(
603 "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}",
604 folderID, parentID, remoteClient.Name);
605 }
606 }
607
608 public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID)
609 {
610 InventoryFolderBase folder = new InventoryFolderBase(folderID); 518 InventoryFolderBase folder = new InventoryFolderBase(folderID);
611 folder = InventoryService.QueryFolder(folder); 519 folder = InventoryService.QueryFolder(folder);
612 if (folder != null) 520 if (folder != null)
@@ -628,27 +536,8 @@ namespace OpenSim.Region.Framework.Scenes
628 /// </summary> 536 /// </summary>
629 /// <param name="remoteClient"></param> 537 /// <param name="remoteClient"></param>
630 /// <param name="folderID"></param> 538 /// <param name="folderID"></param>
631 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
632 {
633 CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
634
635 if (null == userProfile)
636 {
637 m_log.ErrorFormat(
638 "[AGENT INVENTORY]: Could not find user profile for {0} {1}",
639 remoteClient.Name, remoteClient.AgentId);
640 return;
641 }
642 539
643 if (!userProfile.PurgeFolder(folderID)) 540 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID)
644 {
645 m_log.ErrorFormat(
646 "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}",
647 remoteClient.Name, remoteClient.AgentId);
648 }
649 }
650
651 public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID)
652 { 541 {
653 InventoryFolderBase folder = new InventoryFolderBase(folderID); 542 InventoryFolderBase folder = new InventoryFolderBase(folderID);
654 543
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
index 0140faa..af2753c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs
@@ -1249,11 +1249,11 @@ namespace OpenSim.Region.Framework.Scenes
1249 } 1249 }
1250 else // Not successful 1250 else // Not successful
1251 { 1251 {
1252 CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); 1252 //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID);
1253 if (userInfo != null) 1253 //if (userInfo != null)
1254 { 1254 //{
1255 userInfo.FetchInventory(); 1255 // userInfo.FetchInventory();
1256 } 1256 //}
1257 agent.RestoreInCurrentScene(); 1257 agent.RestoreInCurrentScene();
1258 } 1258 }
1259 // In any case 1259 // In any case
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 4695df7..fc8b62e 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -833,11 +833,11 @@ namespace OpenSim.Region.Framework.Scenes
833 833
834 m_scene.SwapRootAgentCount(false); 834 m_scene.SwapRootAgentCount(false);
835 835
836 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); 836 //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
837 if (userInfo != null) 837 //if (userInfo != null)
838 userInfo.FetchInventory(); 838 // userInfo.FetchInventory();
839 else 839 //else
840 m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 840 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
841 841
842 // On the next prim update, all objects will be sent 842 // On the next prim update, all objects will be sent
843 // 843 //