diff options
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index f164208..46f50ad 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -56,6 +56,13 @@ namespace OpenSim.Region.Capabilities | |||
56 | 56 | ||
57 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, | 57 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, |
58 | bool fetchFolders, bool fetchItems, int sortOrder); | 58 | bool fetchFolders, bool fetchItems, int sortOrder); |
59 | |||
60 | /// <summary> | ||
61 | /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that | ||
62 | /// we can popup a message on the user's client if the inventory service has permanently failed). But I didn't want | ||
63 | /// to just pass the whole Scene into CAPS. | ||
64 | /// </summary> | ||
65 | public delegate IClientAPI GetClientDelegate(LLUUID agentID); | ||
59 | 66 | ||
60 | public class Caps | 67 | public class Caps |
61 | { | 68 | { |
@@ -99,8 +106,8 @@ namespace OpenSim.Region.Capabilities | |||
99 | public NewInventoryItem AddNewInventoryItem = null; | 106 | public NewInventoryItem AddNewInventoryItem = null; |
100 | public ItemUpdatedCallback ItemUpdatedCall = null; | 107 | public ItemUpdatedCallback ItemUpdatedCall = null; |
101 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | 108 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; |
102 | // | ||
103 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | 109 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; |
110 | public GetClientDelegate GetClient = null; | ||
104 | 111 | ||
105 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 112 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
106 | LLUUID agent, bool dumpAssetsToFile) | 113 | LLUUID agent, bool dumpAssetsToFile) |
@@ -240,7 +247,7 @@ namespace OpenSim.Region.Capabilities | |||
240 | 247 | ||
241 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); | 248 | LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents(); |
242 | LLSDHelpers.DeserialiseLLSDMap(inventoryhash, llsdRequest); | 249 | LLSDHelpers.DeserialiseLLSDMap(inventoryhash, llsdRequest); |
243 | LLSDInventoryDescendents reply = FetchInventory(llsdRequest); | 250 | LLSDInventoryDescendents reply = FetchInventoryReply(llsdRequest); |
244 | 251 | ||
245 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); | 252 | inventoryitemstr = LLSDHelpers.SerialiseLLSDReply(reply); |
246 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | 253 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); |
@@ -265,7 +272,7 @@ namespace OpenSim.Region.Capabilities | |||
265 | return response; | 272 | return response; |
266 | } | 273 | } |
267 | 274 | ||
268 | private LLSDInventoryDescendents FetchInventory(LLSDFetchInventoryDescendents invFetch) | 275 | private LLSDInventoryDescendents FetchInventoryReply(LLSDFetchInventoryDescendents invFetch) |
269 | { | 276 | { |
270 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | 277 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); |
271 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | 278 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); |
@@ -289,6 +296,7 @@ namespace OpenSim.Region.Capabilities | |||
289 | { | 296 | { |
290 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | 297 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); |
291 | } | 298 | } |
299 | |||
292 | if (itemList != null) | 300 | if (itemList != null) |
293 | { | 301 | { |
294 | foreach (InventoryItemBase invItem in itemList) | 302 | foreach (InventoryItemBase invItem in itemList) |
@@ -296,6 +304,27 @@ namespace OpenSim.Region.Capabilities | |||
296 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | 304 | contents.items.Array.Add(ConvertInventoryItem(invItem)); |
297 | } | 305 | } |
298 | } | 306 | } |
307 | else | ||
308 | { | ||
309 | IClientAPI client = GetClient(m_agentID); | ||
310 | |||
311 | // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. | ||
312 | // If we don't send back the response, | ||
313 | // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) | ||
314 | if (client != null) | ||
315 | { | ||
316 | client.SendAgentAlertMessage( | ||
317 | "AGIN0001E: The inventory service has either failed or is not responding. Your inventory will not function properly for the rest of this session. Please clear your cache and relog.", | ||
318 | true); | ||
319 | } | ||
320 | else | ||
321 | { | ||
322 | m_log.ErrorFormat( | ||
323 | "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure", | ||
324 | m_agentID); | ||
325 | } | ||
326 | } | ||
327 | |||
299 | contents.descendents = contents.items.Array.Count; | 328 | contents.descendents = contents.items.Array.Count; |
300 | return reply; | 329 | return reply; |
301 | } | 330 | } |