diff options
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | 42 | ||||
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs | 45 |
2 files changed, 8 insertions, 79 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs index 66b46a6..0d7766c 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInventory2Handler.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Capabilities.Handlers | |||
90 | items[i++] = m_inventoryService.GetItem(UUID.Zero, id); | 90 | items[i++] = m_inventoryService.GetItem(UUID.Zero, id); |
91 | } | 91 | } |
92 | 92 | ||
93 | StringBuilder lsl = LLSDxmlEncode.Start(2048); | 93 | StringBuilder lsl = LLSDxmlEncode.Start(4096); |
94 | LLSDxmlEncode.AddMap(lsl); | 94 | LLSDxmlEncode.AddMap(lsl); |
95 | 95 | ||
96 | if(m_agentID == UUID.Zero && items.Length > 0) | 96 | if(m_agentID == UUID.Zero && items.Length > 0) |
@@ -100,49 +100,15 @@ namespace OpenSim.Capabilities.Handlers | |||
100 | 100 | ||
101 | if(items == null || items.Length == 0) | 101 | if(items == null || items.Length == 0) |
102 | { | 102 | { |
103 | LLSDxmlEncode.AddEmptyArray("items",lsl); | 103 | LLSDxmlEncode.AddEmptyArray("items", lsl); |
104 | } | 104 | } |
105 | else | 105 | else |
106 | { | 106 | { |
107 | LLSDxmlEncode.AddArray("items",lsl); | 107 | LLSDxmlEncode.AddArray("items", lsl); |
108 | foreach (InventoryItemBase item in items) | 108 | foreach (InventoryItemBase item in items) |
109 | { | 109 | { |
110 | if (item != null) | 110 | if (item != null) |
111 | { | 111 | item.ToLLSDxml(lsl); |
112 | // this is as FecthLib, possible to move to a shared location later | ||
113 | LLSDxmlEncode.AddMap(lsl); | ||
114 | LLSDxmlEncode.AddElem("parent_id", item.Folder, lsl); | ||
115 | LLSDxmlEncode.AddElem("asset_id", item.AssetID, lsl); | ||
116 | LLSDxmlEncode.AddElem("item_id", item.ID, lsl); | ||
117 | |||
118 | LLSDxmlEncode.AddMap("permissions",lsl); | ||
119 | LLSDxmlEncode.AddElem("creator_id", item.CreatorIdAsUuid, lsl); | ||
120 | LLSDxmlEncode.AddElem("owner_id", item.Owner, lsl); | ||
121 | LLSDxmlEncode.AddElem("group_id", item.GroupID, lsl); | ||
122 | LLSDxmlEncode.AddElem("base_mask", (int)item.CurrentPermissions, lsl); | ||
123 | LLSDxmlEncode.AddElem("owner_mask", (int)item.CurrentPermissions, lsl); | ||
124 | LLSDxmlEncode.AddElem("group_mask", (int)item.GroupPermissions, lsl); | ||
125 | LLSDxmlEncode.AddElem("everyone_mask", (int)item.EveryOnePermissions, lsl); | ||
126 | LLSDxmlEncode.AddElem("next_owner_mask", (int)item.NextPermissions, lsl); | ||
127 | LLSDxmlEncode.AddElem("is_owner_group", item.GroupOwned, lsl); | ||
128 | LLSDxmlEncode.AddEndMap(lsl); | ||
129 | |||
130 | LLSDxmlEncode.AddElem("type", item.AssetType, lsl); | ||
131 | LLSDxmlEncode.AddElem("inv_type", item.InvType, lsl); | ||
132 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
133 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
134 | |||
135 | LLSDxmlEncode.AddMap("sale_info",lsl); | ||
136 | LLSDxmlEncode.AddElem("sale_price", item.SalePrice, lsl); | ||
137 | LLSDxmlEncode.AddElem("sale_type", item.SaleType, lsl); | ||
138 | LLSDxmlEncode.AddEndMap(lsl); | ||
139 | |||
140 | LLSDxmlEncode.AddElem("name", item.Name, lsl); | ||
141 | LLSDxmlEncode.AddElem("desc", item.Description, lsl); | ||
142 | LLSDxmlEncode.AddElem("created_at", item.CreationDate, lsl); | ||
143 | |||
144 | LLSDxmlEncode.AddEndMap(lsl); | ||
145 | } | ||
146 | } | 112 | } |
147 | LLSDxmlEncode.AddEndArray(lsl); | 113 | LLSDxmlEncode.AddEndArray(lsl); |
148 | } | 114 | } |
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs index a43158b..264c41d 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchLib2Handler.cs | |||
@@ -50,7 +50,6 @@ namespace OpenSim.Capabilities.Handlers | |||
50 | private UUID libOwner; | 50 | private UUID libOwner; |
51 | 51 | ||
52 | public FetchLib2Handler(IInventoryService invService, ILibraryService libraryService, UUID agentId) | 52 | public FetchLib2Handler(IInventoryService invService, ILibraryService libraryService, UUID agentId) |
53 | |||
54 | { | 53 | { |
55 | m_inventoryService = invService; | 54 | m_inventoryService = invService; |
56 | m_agentID = agentId; | 55 | m_agentID = agentId; |
@@ -63,15 +62,12 @@ namespace OpenSim.Capabilities.Handlers | |||
63 | { | 62 | { |
64 | //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request); | 63 | //m_log.DebugFormat("[FETCH INVENTORY HANDLER]: Received FetchInventory capability request {0}", request); |
65 | 64 | ||
66 | if (m_LibraryService == null) | 65 | if (m_LibraryService == null || m_agentID == UUID.Zero) |
67 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; | 66 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; |
68 | 67 | ||
69 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); | 68 | OSDMap requestmap = (OSDMap)OSDParser.DeserializeLLSDXml(Utils.StringToBytes(request)); |
70 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; | 69 | OSDArray itemsRequested = (OSDArray)requestmap["items"]; |
71 | 70 | ||
72 | if (m_agentID == UUID.Zero) | ||
73 | return "<llsd><map><key><agent_id></key><uuid /><key>items</key><array /></map></llsd>"; | ||
74 | |||
75 | UUID[] itemIDs = new UUID[itemsRequested.Count]; | 71 | UUID[] itemIDs = new UUID[itemsRequested.Count]; |
76 | int i = 0; | 72 | int i = 0; |
77 | 73 | ||
@@ -88,48 +84,15 @@ namespace OpenSim.Capabilities.Handlers | |||
88 | LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl); | 84 | LLSDxmlEncode.AddElem("agent_id", m_agentID, lsl); |
89 | if(items == null || items.Length == 0) | 85 | if(items == null || items.Length == 0) |
90 | { | 86 | { |
91 | LLSDxmlEncode.AddEmptyArray("items",lsl); | 87 | LLSDxmlEncode.AddEmptyArray("items", lsl); |
92 | } | 88 | } |
93 | else | 89 | else |
94 | { | 90 | { |
95 | LLSDxmlEncode.AddArray("items",lsl); | 91 | LLSDxmlEncode.AddArray("items", lsl); |
96 | foreach (InventoryItemBase item in items) | 92 | foreach (InventoryItemBase item in items) |
97 | { | 93 | { |
98 | if (item != null) | 94 | if (item != null) |
99 | { | 95 | item.ToLLSDxml(lsl); |
100 | LLSDxmlEncode.AddMap(lsl); | ||
101 | LLSDxmlEncode.AddElem("parent_id", item.Folder, lsl); | ||
102 | LLSDxmlEncode.AddElem("asset_id", item.AssetID, lsl); | ||
103 | LLSDxmlEncode.AddElem("item_id", item.ID, lsl); | ||
104 | |||
105 | LLSDxmlEncode.AddMap("permissions",lsl); | ||
106 | LLSDxmlEncode.AddElem("creator_id", item.CreatorIdAsUuid, lsl); | ||
107 | LLSDxmlEncode.AddElem("owner_id", item.Owner, lsl); | ||
108 | LLSDxmlEncode.AddElem("group_id", item.GroupID, lsl); | ||
109 | LLSDxmlEncode.AddElem("base_mask", (int)item.CurrentPermissions, lsl); | ||
110 | LLSDxmlEncode.AddElem("owner_mask", (int)item.CurrentPermissions, lsl); | ||
111 | LLSDxmlEncode.AddElem("group_mask", (int)item.GroupPermissions, lsl); | ||
112 | LLSDxmlEncode.AddElem("everyone_mask", (int)item.EveryOnePermissions, lsl); | ||
113 | LLSDxmlEncode.AddElem("next_owner_mask", (int)item.NextPermissions, lsl); | ||
114 | LLSDxmlEncode.AddElem("is_owner_group", item.GroupOwned, lsl); | ||
115 | LLSDxmlEncode.AddEndMap(lsl); | ||
116 | |||
117 | LLSDxmlEncode.AddElem("type", item.AssetType, lsl); | ||
118 | LLSDxmlEncode.AddElem("inv_type", item.InvType, lsl); | ||
119 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
120 | LLSDxmlEncode.AddElem("flags", ((int)item.Flags) & 0xff, lsl); | ||
121 | |||
122 | LLSDxmlEncode.AddMap("sale_info",lsl); | ||
123 | LLSDxmlEncode.AddElem("sale_price", item.SalePrice, lsl); | ||
124 | LLSDxmlEncode.AddElem("sale_type", item.SaleType, lsl); | ||
125 | LLSDxmlEncode.AddEndMap(lsl); | ||
126 | |||
127 | LLSDxmlEncode.AddElem("name", item.Name, lsl); | ||
128 | LLSDxmlEncode.AddElem("desc", item.Description, lsl); | ||
129 | LLSDxmlEncode.AddElem("created_at", item.CreationDate, lsl); | ||
130 | |||
131 | LLSDxmlEncode.AddEndMap(lsl); | ||
132 | } | ||
133 | } | 96 | } |
134 | LLSDxmlEncode.AddEndArray(lsl); | 97 | LLSDxmlEncode.AddEndArray(lsl); |
135 | } | 98 | } |