diff options
author | Melanie | 2009-08-28 23:28:32 +0100 |
---|---|---|
committer | Melanie | 2009-08-28 23:28:32 +0100 |
commit | 22a0dff22624984080bebc03ff63025fc213eeff (patch) | |
tree | f106ca76fca4500198cb697180c5d87afae05292 /OpenSim | |
parent | Implements osDrawPolygon, similar to already implemented osDrawFilledPolygon (diff) | |
download | opensim-SC-22a0dff22624984080bebc03ff63025fc213eeff.zip opensim-SC-22a0dff22624984080bebc03ff63025fc213eeff.tar.gz opensim-SC-22a0dff22624984080bebc03ff63025fc213eeff.tar.bz2 opensim-SC-22a0dff22624984080bebc03ff63025fc213eeff.tar.xz |
Modify CAPS inventory code. Currently this is not executed
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Capabilities/Caps.cs | 81 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs | 41 | ||||
-rw-r--r-- | OpenSim/Framework/Capabilities/LLSDInventoryItem.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 10 |
4 files changed, 99 insertions, 34 deletions
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index df29c4e..5ae33d6 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs | |||
@@ -57,7 +57,7 @@ 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); |
62 | 62 | ||
63 | /// <summary> | 63 | /// <summary> |
@@ -460,47 +460,52 @@ namespace OpenSim.Framework.Capabilities | |||
460 | 460 | ||
461 | contents.descendents = 0; | 461 | contents.descendents = 0; |
462 | reply.folders.Array.Add(contents); | 462 | reply.folders.Array.Add(contents); |
463 | List<InventoryItemBase> itemList = null; | 463 | InventoryCollection inv = new InventoryCollection(); |
464 | inv.Folders = new List<InventoryFolderBase>(); | ||
465 | inv.Items = new List<InventoryItemBase>(); | ||
464 | if (CAPSFetchInventoryDescendents != null) | 466 | if (CAPSFetchInventoryDescendents != null) |
465 | { | 467 | { |
466 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | 468 | inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); |
467 | } | 469 | } |
468 | 470 | ||
469 | if (itemList != null) | 471 | if (inv.Folders != null) |
470 | { | 472 | { |
471 | foreach (InventoryItemBase invItem in itemList) | 473 | foreach (InventoryFolderBase invFolder in inv.Folders) |
472 | { | 474 | { |
473 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | 475 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); |
474 | } | 476 | } |
475 | } | 477 | } |
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 | 478 | ||
482 | // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response. | 479 | if (inv.Items != null) |
483 | // If we don't send back the response, | 480 | { |
484 | // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest()) | 481 | 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 | { | 482 | { |
493 | m_log.ErrorFormat( | 483 | 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 | } | 484 | } |
497 | }*/ | 485 | } |
498 | 486 | ||
499 | contents.descendents = contents.items.Array.Count; | 487 | contents.descendents = contents.items.Array.Count; |
500 | return reply; | 488 | return reply; |
501 | } | 489 | } |
502 | 490 | ||
503 | /// <summary> | 491 | /// <summary> |
492 | /// Convert an internal inventory folder object into an LLSD object. | ||
493 | /// </summary> | ||
494 | /// <param name="invFolder"></param> | ||
495 | /// <returns></returns> | ||
496 | private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder) | ||
497 | { | ||
498 | LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder(); | ||
499 | llsdFolder.folder_id = invFolder.ID; | ||
500 | llsdFolder.parent_id = invFolder.ParentID; | ||
501 | llsdFolder.name = invFolder.Name; | ||
502 | llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type]; | ||
503 | llsdFolder.preferred_type = "-1"; | ||
504 | |||
505 | return llsdFolder; | ||
506 | } | ||
507 | |||
508 | /// <summary> | ||
504 | /// Convert an internal inventory item object into an LLSD object. | 509 | /// Convert an internal inventory item object into an LLSD object. |
505 | /// </summary> | 510 | /// </summary> |
506 | /// <param name="invItem"></param> | 511 | /// <param name="invItem"></param> |
@@ -529,15 +534,29 @@ namespace OpenSim.Framework.Capabilities | |||
529 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | 534 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; |
530 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; | 535 | llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions; |
531 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; | 536 | llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions; |
532 | llsdItem.permissions.group_id = UUID.Zero; | 537 | llsdItem.permissions.group_id = invItem.GroupID; |
533 | llsdItem.permissions.group_mask = 0; | 538 | llsdItem.permissions.group_mask = (int)invItem.GroupPermissions; |
534 | llsdItem.permissions.is_owner_group = false; | 539 | llsdItem.permissions.is_owner_group = invItem.GroupOwned; |
535 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; | 540 | llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions; |
536 | llsdItem.permissions.owner_id = m_agentID; // FixMe | 541 | llsdItem.permissions.owner_id = m_agentID; |
537 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | 542 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
538 | llsdItem.sale_info = new LLSDSaleInfo(); | 543 | llsdItem.sale_info = new LLSDSaleInfo(); |
539 | llsdItem.sale_info.sale_price = 10; | 544 | llsdItem.sale_info.sale_price = invItem.SalePrice; |
540 | llsdItem.sale_info.sale_type = "not"; | 545 | switch (invItem.SaleType) |
546 | { | ||
547 | default: | ||
548 | llsdItem.sale_info.sale_type = "not"; | ||
549 | break; | ||
550 | case 1: | ||
551 | llsdItem.sale_info.sale_type = "original"; | ||
552 | break; | ||
553 | case 2: | ||
554 | llsdItem.sale_info.sale_type = "copy"; | ||
555 | break; | ||
556 | case 3: | ||
557 | llsdItem.sale_info.sale_type = "contents"; | ||
558 | break; | ||
559 | } | ||
541 | 560 | ||
542 | return llsdItem; | 561 | return llsdItem; |
543 | } | 562 | } |
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs new file mode 100644 index 0000000..3c216e9 --- /dev/null +++ b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs | |||
@@ -0,0 +1,41 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Framework.Capabilities | ||
31 | { | ||
32 | [OSDMap] | ||
33 | public class LLSDInventoryFolder | ||
34 | { | ||
35 | public UUID folder_id; | ||
36 | public UUID parent_id; | ||
37 | public string name; | ||
38 | public string type; | ||
39 | public string preferred_type; | ||
40 | } | ||
41 | } | ||
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs index d0498f6..cce18d7 100644 --- a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs +++ b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs | |||
@@ -90,6 +90,7 @@ namespace OpenSim.Framework.Capabilities | |||
90 | public UUID agent_id; | 90 | public UUID agent_id; |
91 | public int descendents; | 91 | public int descendents; |
92 | public UUID folder_id; | 92 | public UUID folder_id; |
93 | public OSDArray categories = new OSDArray(); | ||
93 | public OSDArray items = new OSDArray(); | 94 | public OSDArray items = new OSDArray(); |
94 | public UUID owner_id; | 95 | public UUID owner_id; |
95 | public int version; | 96 | public int version; |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index d3e414f..c816790 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -472,7 +472,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
472 | /// <param name="fetchItems"></param> | 472 | /// <param name="fetchItems"></param> |
473 | /// <param name="sortOrder"></param> | 473 | /// <param name="sortOrder"></param> |
474 | /// <returns>null if the inventory look up failed</returns> | 474 | /// <returns>null if the inventory look up failed</returns> |
475 | public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, | 475 | public InventoryCollection HandleFetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID, |
476 | bool fetchFolders, bool fetchItems, int sortOrder) | 476 | bool fetchFolders, bool fetchItems, int sortOrder) |
477 | { | 477 | { |
478 | // m_log.DebugFormat( | 478 | // m_log.DebugFormat( |
@@ -487,11 +487,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
487 | InventoryFolderImpl fold; | 487 | InventoryFolderImpl fold; |
488 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) | 488 | if ((fold = CommsManager.UserProfileCacheService.LibraryRoot.FindFolder(folderID)) != null) |
489 | { | 489 | { |
490 | return fold.RequestListOfItems(); | 490 | InventoryCollection ret = new InventoryCollection(); |
491 | ret.Folders = new List<InventoryFolderBase>(); | ||
492 | ret.Items = fold.RequestListOfItems(); | ||
493 | |||
494 | return ret; | ||
491 | } | 495 | } |
492 | 496 | ||
493 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); | 497 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
494 | return contents.Items; | 498 | return contents; |
495 | 499 | ||
496 | } | 500 | } |
497 | 501 | ||