aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Capabilities/Caps.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Capabilities/Caps.cs')
-rw-r--r--OpenSim/Framework/Capabilities/Caps.cs105
1 files changed, 60 insertions, 45 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index df29c4e..c5560b8 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -57,8 +57,8 @@ namespace OpenSim.Framework.Capabilities
57 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID, 57 public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
58 bool isScriptRunning, byte[] data); 58 bool isScriptRunning, byte[] data);
59 59
60 public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, 60 public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
61 bool fetchFolders, bool fetchItems, int sortOrder); 61 bool fetchFolders, bool fetchItems, int sortOrder, out int version);
62 62
63 /// <summary> 63 /// <summary>
64 /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that 64 /// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities
89 //private static readonly string m_requestTexture = "0003/"; 89 //private static readonly string m_requestTexture = "0003/";
90 private static readonly string m_notecardUpdatePath = "0004/"; 90 private static readonly string m_notecardUpdatePath = "0004/";
91 private static readonly string m_notecardTaskUpdatePath = "0005/"; 91 private static readonly string m_notecardTaskUpdatePath = "0005/";
92 // private static readonly string m_fetchInventoryPath = "0006/"; 92 private static readonly string m_fetchInventoryPath = "0006/";
93 93
94 // The following entries are in a module, however, they are also here so that we don't re-assign 94 // The following entries are in a module, however, they are also here so that we don't re-assign
95 // the path to another cap by mistake. 95 // the path to another cap by mistake.
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Capabilities
207 // As of RC 1.22.9 of the Linden client this is 207 // As of RC 1.22.9 of the Linden client this is
208 // supported 208 // supported
209 209
210 // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest); 210 m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
211 211
212 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and 212 // justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
213 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires 213 // subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
@@ -449,58 +449,59 @@ namespace OpenSim.Framework.Capabilities
449 contents.owner_id = invFetch.owner_id; 449 contents.owner_id = invFetch.owner_id;
450 contents.folder_id = invFetch.folder_id; 450 contents.folder_id = invFetch.folder_id;
451 451
452 // The version number being sent back was originally 1.
453 // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins
454 // without clearing client cache, objects in the root folder disappear until the cache is cleared,
455 // at which point they reappear.
456 //
457 // Seeing the version to something other than 0 may be the right thing to do, but there is
458 // a greater subtlety of the second life protocol that needs to be understood first.
459 contents.version = 0;
460
461 contents.descendents = 0;
462 reply.folders.Array.Add(contents); 452 reply.folders.Array.Add(contents);
463 List<InventoryItemBase> itemList = null; 453 InventoryCollection inv = new InventoryCollection();
454 inv.Folders = new List<InventoryFolderBase>();
455 inv.Items = new List<InventoryItemBase>();
456 int version = 0;
464 if (CAPSFetchInventoryDescendents != null) 457 if (CAPSFetchInventoryDescendents != null)
465 { 458 {
466 itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); 459 inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
467 } 460 }
468 461
469 if (itemList != null) 462 if (inv.Folders != null)
470 { 463 {
471 foreach (InventoryItemBase invItem in itemList) 464 foreach (InventoryFolderBase invFolder in inv.Folders)
472 { 465 {
473 contents.items.Array.Add(ConvertInventoryItem(invItem)); 466 contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
474 } 467 }
475 } 468 }
476 /* The following block is removed as it ALWAYS sends the error to the client because the RC 1.22.9 client tries to
477 find items that have become dissasociated with a paret folder and have parent of 00000000-0000-00000....
478 else
479 {
480 IClientAPI client = GetClient(m_agentID);
481 469
482 // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. 470 if (inv.Items != null)
483 // If we don't send back the response, 471 {
484 // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) 472 foreach (InventoryItemBase invItem in inv.Items)
485 if (client != null)
486 {
487 client.SendAgentAlertMessage(
488 "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.",
489 true);
490 }
491 else
492 { 473 {
493 m_log.ErrorFormat( 474 contents.items.Array.Add(ConvertInventoryItem(invItem));
494 "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure",
495 m_agentID);
496 } 475 }
497 }*/ 476 }
477
478 contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
479 contents.version = version;
498 480
499 contents.descendents = contents.items.Array.Count;
500 return reply; 481 return reply;
501 } 482 }
502 483
503 /// <summary> 484 /// <summary>
485 /// Convert an internal inventory folder object into an LLSD object.
486 /// </summary>
487 /// <param name="invFolder"></param>
488 /// <returns></returns>
489 private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
490 {
491 LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
492 llsdFolder.folder_id = invFolder.ID;
493 llsdFolder.parent_id = invFolder.ParentID;
494 llsdFolder.name = invFolder.Name;
495 if (invFolder.Type == -1)
496 llsdFolder.type = "-1";
497 else
498 llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
499 llsdFolder.preferred_type = "-1";
500
501 return llsdFolder;
502 }
503
504 /// <summary>
504 /// Convert an internal inventory item object into an LLSD object. 505 /// Convert an internal inventory item object into an LLSD object.
505 /// </summary> 506 /// </summary>
506 /// <param name="invItem"></param> 507 /// <param name="invItem"></param>
@@ -529,15 +530,29 @@ namespace OpenSim.Framework.Capabilities
529 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; 530 llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
530 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; 531 llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
531 llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; 532 llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
532 llsdItem.permissions.group_id = UUID.Zero; 533 llsdItem.permissions.group_id = invItem.GroupID;
533 llsdItem.permissions.group_mask = 0; 534 llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
534 llsdItem.permissions.is_owner_group = false; 535 llsdItem.permissions.is_owner_group = invItem.GroupOwned;
535 llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; 536 llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
536 llsdItem.permissions.owner_id = m_agentID; // FixMe 537 llsdItem.permissions.owner_id = m_agentID;
537 llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; 538 llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
538 llsdItem.sale_info = new LLSDSaleInfo(); 539 llsdItem.sale_info = new LLSDSaleInfo();
539 llsdItem.sale_info.sale_price = 10; 540 llsdItem.sale_info.sale_price = invItem.SalePrice;
540 llsdItem.sale_info.sale_type = "not"; 541 switch (invItem.SaleType)
542 {
543 default:
544 llsdItem.sale_info.sale_type = "not";
545 break;
546 case 1:
547 llsdItem.sale_info.sale_type = "original";
548 break;
549 case 2:
550 llsdItem.sale_info.sale_type = "copy";
551 break;
552 case 3:
553 llsdItem.sale_info.sale_type = "contents";
554 break;
555 }
541 556
542 return llsdItem; 557 return llsdItem;
543 } 558 }