diff options
author | Melanie | 2012-06-03 02:36:28 +0100 |
---|---|---|
committer | Melanie | 2012-06-03 02:36:28 +0100 |
commit | 728249ba49bd64cb9d5540fa3ed9bca06652d7d4 (patch) | |
tree | 96f680719edca41e8703b714e17b1e755b0ff104 /OpenSim | |
parent | Merge branch 'avination' into careminster (diff) | |
parent | Fix build break whree accidentally did inv.Folders rather than inv.Folders.Co... (diff) | |
download | opensim-SC-728249ba49bd64cb9d5540fa3ed9bca06652d7d4.zip opensim-SC-728249ba49bd64cb9d5540fa3ed9bca06652d7d4.tar.gz opensim-SC-728249ba49bd64cb9d5540fa3ed9bca06652d7d4.tar.bz2 opensim-SC-728249ba49bd64cb9d5540fa3ed9bca06652d7d4.tar.xz |
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim')
4 files changed, 83 insertions, 78 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs index 717a097..c0ca1e1 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2Handler.cs | |||
@@ -101,18 +101,8 @@ namespace OpenSim.Capabilities.Handlers | |||
101 | llsdItem.item_id = invItem.ID; | 101 | llsdItem.item_id = invItem.ID; |
102 | llsdItem.name = invItem.Name; | 102 | llsdItem.name = invItem.Name; |
103 | llsdItem.parent_id = invItem.Folder; | 103 | llsdItem.parent_id = invItem.Folder; |
104 | 104 | llsdItem.type = invItem.AssetType; | |
105 | try | 105 | llsdItem.inv_type = invItem.InvType; |
106 | { | ||
107 | llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType); | ||
108 | llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType); | ||
109 | } | ||
110 | catch (Exception e) | ||
111 | { | ||
112 | m_log.ErrorFormat( | ||
113 | "[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", | ||
114 | invItem.AssetType, invItem.InvType, invItem.Name, e.Message); | ||
115 | } | ||
116 | 106 | ||
117 | llsdItem.permissions = new LLSDPermissions(); | 107 | llsdItem.permissions = new LLSDPermissions(); |
118 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | 108 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; |
@@ -126,21 +116,7 @@ namespace OpenSim.Capabilities.Handlers | |||
126 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | 116 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
127 | llsdItem.sale_info = new LLSDSaleInfo(); | 117 | llsdItem.sale_info = new LLSDSaleInfo(); |
128 | llsdItem.sale_info.sale_price = invItem.SalePrice; | 118 | llsdItem.sale_info.sale_price = invItem.SalePrice; |
129 | switch (invItem.SaleType) | 119 | llsdItem.sale_info.sale_type = invItem.SaleType; |
130 | { | ||
131 | default: | ||
132 | llsdItem.sale_info.sale_type = "not"; | ||
133 | break; | ||
134 | case 1: | ||
135 | llsdItem.sale_info.sale_type = "original"; | ||
136 | break; | ||
137 | case 2: | ||
138 | llsdItem.sale_info.sale_type = "copy"; | ||
139 | break; | ||
140 | case 3: | ||
141 | llsdItem.sale_info.sale_type = "contents"; | ||
142 | break; | ||
143 | } | ||
144 | 120 | ||
145 | return llsdItem; | 121 | return llsdItem; |
146 | } | 122 | } |
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index d5c062b..849cad2 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs | |||
@@ -156,11 +156,12 @@ namespace OpenSim.Capabilities.Handlers | |||
156 | inv.Folders = new List<InventoryFolderBase>(); | 156 | inv.Folders = new List<InventoryFolderBase>(); |
157 | inv.Items = new List<InventoryItemBase>(); | 157 | inv.Items = new List<InventoryItemBase>(); |
158 | int version = 0; | 158 | int version = 0; |
159 | int descendents = 0; | ||
159 | 160 | ||
160 | inv | 161 | inv |
161 | = Fetch( | 162 | = Fetch( |
162 | invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, | 163 | invFetch.owner_id, invFetch.folder_id, invFetch.owner_id, |
163 | invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version); | 164 | invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version, out descendents); |
164 | 165 | ||
165 | if (inv != null && inv.Folders != null) | 166 | if (inv != null && inv.Folders != null) |
166 | { | 167 | { |
@@ -168,6 +169,8 @@ namespace OpenSim.Capabilities.Handlers | |||
168 | { | 169 | { |
169 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); | 170 | contents.categories.Array.Add(ConvertInventoryFolder(invFolder)); |
170 | } | 171 | } |
172 | |||
173 | descendents += inv.Folders.Count; | ||
171 | } | 174 | } |
172 | 175 | ||
173 | if (inv != null && inv.Items != null) | 176 | if (inv != null && inv.Items != null) |
@@ -178,7 +181,7 @@ namespace OpenSim.Capabilities.Handlers | |||
178 | } | 181 | } |
179 | } | 182 | } |
180 | 183 | ||
181 | contents.descendents = contents.items.Array.Count + contents.categories.Array.Count; | 184 | contents.descendents = descendents; |
182 | contents.version = version; | 185 | contents.version = version; |
183 | 186 | ||
184 | // m_log.DebugFormat( | 187 | // m_log.DebugFormat( |
@@ -206,7 +209,7 @@ namespace OpenSim.Capabilities.Handlers | |||
206 | /// <returns>An empty InventoryCollection if the inventory look up failed</returns> | 209 | /// <returns>An empty InventoryCollection if the inventory look up failed</returns> |
207 | private InventoryCollection Fetch( | 210 | private InventoryCollection Fetch( |
208 | UUID agentID, UUID folderID, UUID ownerID, | 211 | UUID agentID, UUID folderID, UUID ownerID, |
209 | bool fetchFolders, bool fetchItems, int sortOrder, out int version) | 212 | bool fetchFolders, bool fetchItems, int sortOrder, out int version, out int descendents) |
210 | { | 213 | { |
211 | // m_log.DebugFormat( | 214 | // m_log.DebugFormat( |
212 | // "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", | 215 | // "[WEB FETCH INV DESC HANDLER]: Fetching folders ({0}), items ({1}) from {2} for agent {3}", |
@@ -215,6 +218,8 @@ namespace OpenSim.Capabilities.Handlers | |||
215 | // FIXME MAYBE: We're not handling sortOrder! | 218 | // FIXME MAYBE: We're not handling sortOrder! |
216 | 219 | ||
217 | version = 0; | 220 | version = 0; |
221 | descendents = 0; | ||
222 | |||
218 | InventoryFolderImpl fold; | 223 | InventoryFolderImpl fold; |
219 | if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) | 224 | if (m_LibraryService != null && m_LibraryService.LibraryRootFolder != null && agentID == m_LibraryService.LibraryRootFolder.Owner) |
220 | { | 225 | { |
@@ -223,6 +228,7 @@ namespace OpenSim.Capabilities.Handlers | |||
223 | InventoryCollection ret = new InventoryCollection(); | 228 | InventoryCollection ret = new InventoryCollection(); |
224 | ret.Folders = new List<InventoryFolderBase>(); | 229 | ret.Folders = new List<InventoryFolderBase>(); |
225 | ret.Items = fold.RequestListOfItems(); | 230 | ret.Items = fold.RequestListOfItems(); |
231 | descendents = ret.Folders.Count + ret.Items.Count; | ||
226 | 232 | ||
227 | return ret; | 233 | return ret; |
228 | } | 234 | } |
@@ -246,24 +252,71 @@ namespace OpenSim.Capabilities.Handlers | |||
246 | 252 | ||
247 | version = containingFolder.Version; | 253 | version = containingFolder.Version; |
248 | 254 | ||
249 | // if (fetchItems) | 255 | if (fetchItems) |
256 | { | ||
257 | List<InventoryItemBase> itemsToReturn = contents.Items; | ||
258 | List<InventoryItemBase> originalItems = new List<InventoryItemBase>(itemsToReturn); | ||
259 | |||
260 | // descendents must only include the links, not the linked items we add | ||
261 | descendents = originalItems.Count; | ||
262 | |||
263 | // Add target items for links in this folder before the links themselves. | ||
264 | foreach (InventoryItemBase item in originalItems) | ||
265 | { | ||
266 | if (item.AssetType == (int)AssetType.Link) | ||
267 | { | ||
268 | InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); | ||
269 | |||
270 | // Take care of genuinely broken links where the target doesn't exist | ||
271 | // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, | ||
272 | // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles | ||
273 | // rather than having to keep track of every folder requested in the recursion. | ||
274 | if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) | ||
275 | itemsToReturn.Insert(0, linkedItem); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | // Now scan for folder links and insert the items they target and those links at the head of the return data | ||
280 | foreach (InventoryItemBase item in originalItems) | ||
281 | { | ||
282 | if (item.AssetType == (int)AssetType.LinkFolder) | ||
283 | { | ||
284 | InventoryCollection linkedFolderContents = m_InventoryService.GetFolderContent(ownerID, item.AssetID); | ||
285 | List<InventoryItemBase> links = linkedFolderContents.Items; | ||
286 | |||
287 | itemsToReturn.InsertRange(0, links); | ||
288 | |||
289 | foreach (InventoryItemBase link in linkedFolderContents.Items) | ||
290 | { | ||
291 | // Take care of genuinely broken links where the target doesn't exist | ||
292 | // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, | ||
293 | // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles | ||
294 | // rather than having to keep track of every folder requested in the recursion. | ||
295 | if (link != null) | ||
296 | { | ||
297 | // m_log.DebugFormat( | ||
298 | // "[WEB FETCH INV DESC HANDLER]: Adding item {0} {1} from folder {2} linked from {3}", | ||
299 | // link.Name, (AssetType)link.AssetType, item.AssetID, containingFolder.Name); | ||
300 | |||
301 | InventoryItemBase linkedItem | ||
302 | = m_InventoryService.GetItem(new InventoryItemBase(link.AssetID)); | ||
303 | |||
304 | itemsToReturn.Insert(0, linkedItem); | ||
305 | } | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | |||
311 | // foreach (InventoryItemBase item in contents.Items) | ||
250 | // { | 312 | // { |
251 | // List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>(); | 313 | // m_log.DebugFormat( |
252 | // | 314 | // "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}", |
253 | // foreach (InventoryItemBase item in contents.Items) | 315 | // item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID); |
254 | // { | 316 | // } |
255 | // if (item.AssetType == (int)AssetType.Link) | 317 | |
256 | // { | 318 | // ===== |
257 | // InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); | 319 | |
258 | // | ||
259 | // // Take care of genuinely broken links where the target doesn't exist | ||
260 | // // HACK: Also, don't follow up links that just point to other links. In theory this is legitimate, | ||
261 | // // but no viewer has been observed to set these up and this is the lazy way of avoiding cycles | ||
262 | // // rather than having to keep track of every folder requested in the recursion. | ||
263 | // if (linkedItem != null && linkedItem.AssetType != (int)AssetType.Link) | ||
264 | // linkedItemsToAdd.Insert(0, linkedItem); | ||
265 | // } | ||
266 | // } | ||
267 | // | 320 | // |
268 | // foreach (InventoryItemBase linkedItem in linkedItemsToAdd) | 321 | // foreach (InventoryItemBase linkedItem in linkedItemsToAdd) |
269 | // { | 322 | // { |
@@ -365,18 +418,8 @@ namespace OpenSim.Capabilities.Handlers | |||
365 | llsdItem.item_id = invItem.ID; | 418 | llsdItem.item_id = invItem.ID; |
366 | llsdItem.name = invItem.Name; | 419 | llsdItem.name = invItem.Name; |
367 | llsdItem.parent_id = invItem.Folder; | 420 | llsdItem.parent_id = invItem.Folder; |
368 | 421 | llsdItem.type = invItem.AssetType; | |
369 | try | 422 | llsdItem.inv_type = invItem.InvType; |
370 | { | ||
371 | llsdItem.type = Utils.AssetTypeToString((AssetType)invItem.AssetType); | ||
372 | llsdItem.inv_type = Utils.InventoryTypeToString((InventoryType)invItem.InvType); | ||
373 | } | ||
374 | catch (Exception e) | ||
375 | { | ||
376 | m_log.ErrorFormat( | ||
377 | "[WEB FETCH INV DESC HANDLER]: Problem setting asset {0} inventory {1} types while converting inventory item {2}: {3}", | ||
378 | invItem.AssetType, invItem.InvType, invItem.Name, e.Message); | ||
379 | } | ||
380 | 423 | ||
381 | llsdItem.permissions = new LLSDPermissions(); | 424 | llsdItem.permissions = new LLSDPermissions(); |
382 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | 425 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; |
@@ -390,21 +433,7 @@ namespace OpenSim.Capabilities.Handlers | |||
390 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | 433 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
391 | llsdItem.sale_info = new LLSDSaleInfo(); | 434 | llsdItem.sale_info = new LLSDSaleInfo(); |
392 | llsdItem.sale_info.sale_price = invItem.SalePrice; | 435 | llsdItem.sale_info.sale_price = invItem.SalePrice; |
393 | switch (invItem.SaleType) | 436 | llsdItem.sale_info.sale_type = invItem.SaleType; |
394 | { | ||
395 | default: | ||
396 | llsdItem.sale_info.sale_type = "not"; | ||
397 | break; | ||
398 | case 1: | ||
399 | llsdItem.sale_info.sale_type = "original"; | ||
400 | break; | ||
401 | case 2: | ||
402 | llsdItem.sale_info.sale_type = "copy"; | ||
403 | break; | ||
404 | case 3: | ||
405 | llsdItem.sale_info.sale_type = "contents"; | ||
406 | break; | ||
407 | } | ||
408 | 437 | ||
409 | return llsdItem; | 438 | return llsdItem; |
410 | } | 439 | } |
diff --git a/OpenSim/Capabilities/LLSDInventoryItem.cs b/OpenSim/Capabilities/LLSDInventoryItem.cs index 426a6cb..958e807 100644 --- a/OpenSim/Capabilities/LLSDInventoryItem.cs +++ b/OpenSim/Capabilities/LLSDInventoryItem.cs | |||
@@ -37,8 +37,8 @@ namespace OpenSim.Framework.Capabilities | |||
37 | public UUID asset_id; | 37 | public UUID asset_id; |
38 | public UUID item_id; | 38 | public UUID item_id; |
39 | public LLSDPermissions permissions; | 39 | public LLSDPermissions permissions; |
40 | public string type; | 40 | public int type; |
41 | public string inv_type; | 41 | public int inv_type; |
42 | public int flags; | 42 | public int flags; |
43 | 43 | ||
44 | public LLSDSaleInfo sale_info; | 44 | public LLSDSaleInfo sale_info; |
@@ -65,7 +65,7 @@ namespace OpenSim.Framework.Capabilities | |||
65 | public class LLSDSaleInfo | 65 | public class LLSDSaleInfo |
66 | { | 66 | { |
67 | public int sale_price; | 67 | public int sale_price; |
68 | public string sale_type; | 68 | public int sale_type; |
69 | } | 69 | } |
70 | 70 | ||
71 | [OSDMap] | 71 | [OSDMap] |
diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 3355428..7518b86 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs | |||
@@ -436,7 +436,7 @@ namespace OpenSim.Services.InventoryService | |||
436 | public virtual bool AddItem(InventoryItemBase item) | 436 | public virtual bool AddItem(InventoryItemBase item) |
437 | { | 437 | { |
438 | // m_log.DebugFormat( | 438 | // m_log.DebugFormat( |
439 | // "[XINVENTORY SERVICE]: Adding item {0} to folder {1} for {2}", item.ID, item.Folder, item.Owner); | 439 | // "[XINVENTORY SERVICE]: Adding item {0} {1} to folder {2} for {3}", item.Name, item.ID, item.Folder, item.Owner); |
440 | 440 | ||
441 | return m_Database.StoreItem(ConvertFromOpenSim(item)); | 441 | return m_Database.StoreItem(ConvertFromOpenSim(item)); |
442 | } | 442 | } |