diff options
Diffstat (limited to 'OpenSim/Capabilities')
13 files changed, 187 insertions, 109 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/FetchInventory2/FetchInventory2ServerConnector.cs b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs index 0ba8931..5bab52f 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory2/FetchInventory2ServerConnector.cs | |||
@@ -63,7 +63,8 @@ namespace OpenSim.Capabilities.Handlers | |||
63 | 63 | ||
64 | FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); | 64 | FetchInventory2Handler fiHandler = new FetchInventory2Handler(m_InventoryService); |
65 | IRequestHandler reqHandler | 65 | IRequestHandler reqHandler |
66 | = new RestStreamHandler("POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest); | 66 | = new RestStreamHandler( |
67 | "POST", "/CAPS/FetchInventory/", fiHandler.FetchInventoryRequest, "FetchInventory", null); | ||
67 | server.AddStreamHandler(reqHandler); | 68 | server.AddStreamHandler(reqHandler); |
68 | } | 69 | } |
69 | } | 70 | } |
diff --git a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs index 2ecfa3c..8a275f3 100644 --- a/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetMesh/GetMeshServerConnector.cs | |||
@@ -66,13 +66,14 @@ namespace OpenSim.Capabilities.Handlers | |||
66 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 66 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
67 | 67 | ||
68 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); | 68 | GetMeshHandler gmeshHandler = new GetMeshHandler(m_AssetService); |
69 | IRequestHandler reqHandler = new RestHTTPHandler("GET", "/CAPS/" + UUID.Random(), | 69 | IRequestHandler reqHandler |
70 | delegate(Hashtable m_dhttpMethod) | 70 | = new RestHTTPHandler( |
71 | { | 71 | "GET", |
72 | return gmeshHandler.ProcessGetMesh(m_dhttpMethod, UUID.Zero, null); | 72 | "/CAPS/" + UUID.Random(), |
73 | }); | 73 | httpMethod => gmeshHandler.ProcessGetMesh(httpMethod, UUID.Zero, null), |
74 | "GetMesh", | ||
75 | null); | ||
74 | server.AddStreamHandler(reqHandler); | 76 | server.AddStreamHandler(reqHandler); |
75 | } | 77 | } |
76 | |||
77 | } | 78 | } |
78 | } | 79 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs index 0797215..f040ff7 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs | |||
@@ -58,8 +58,8 @@ namespace OpenSim.Capabilities.Handlers | |||
58 | // TODO: Change this to a config option | 58 | // TODO: Change this to a config option |
59 | const string REDIRECT_URL = null; | 59 | const string REDIRECT_URL = null; |
60 | 60 | ||
61 | public GetTextureHandler(string path, IAssetService assService) : | 61 | public GetTextureHandler(string path, IAssetService assService, string name, string description) |
62 | base("GET", path) | 62 | : base("GET", path, name, description) |
63 | { | 63 | { |
64 | m_assetService = assService; | 64 | m_assetService = assService; |
65 | } | 65 | } |
@@ -77,7 +77,6 @@ namespace OpenSim.Capabilities.Handlers | |||
77 | { | 77 | { |
78 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); | 78 | m_log.Error("[GETTEXTURE]: Cannot fetch texture " + textureStr + " without an asset service"); |
79 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; | 79 | httpResponse.StatusCode = (int)System.Net.HttpStatusCode.NotFound; |
80 | return null; | ||
81 | } | 80 | } |
82 | 81 | ||
83 | UUID textureID; | 82 | UUID textureID; |
@@ -115,7 +114,6 @@ namespace OpenSim.Capabilities.Handlers | |||
115 | // "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}", | 114 | // "[GETTEXTURE]: For texture {0} sending back response {1}, data length {2}", |
116 | // textureID, httpResponse.StatusCode, httpResponse.ContentLength); | 115 | // textureID, httpResponse.StatusCode, httpResponse.ContentLength); |
117 | 116 | ||
118 | httpResponse.Send(); | ||
119 | return null; | 117 | return null; |
120 | } | 118 | } |
121 | 119 | ||
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs index 0d072f7..71cf033 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/GetTextureServerConnector.cs | |||
@@ -62,8 +62,8 @@ namespace OpenSim.Capabilities.Handlers | |||
62 | if (m_AssetService == null) | 62 | if (m_AssetService == null) |
63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); | 63 | throw new Exception(String.Format("Failed to load AssetService from {0}; config is {1}", assetService, m_ConfigName)); |
64 | 64 | ||
65 | server.AddStreamHandler(new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService)); | 65 | server.AddStreamHandler( |
66 | new GetTextureHandler("/CAPS/GetTexture/" /*+ UUID.Random() */, m_AssetService, "GetTexture", null)); | ||
66 | } | 67 | } |
67 | |||
68 | } | 68 | } |
69 | } | 69 | } \ No newline at end of file |
diff --git a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs index fd152c3..761e4e7 100644 --- a/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs +++ b/OpenSim/Capabilities/Handlers/GetTexture/Tests/GetTextureHandlerTests.cs | |||
@@ -50,9 +50,9 @@ namespace OpenSim.Capabilities.Handlers.GetTexture.Tests | |||
50 | TestHelpers.InMethod(); | 50 | TestHelpers.InMethod(); |
51 | 51 | ||
52 | // Overkill - we only really need the asset service, not a whole scene. | 52 | // Overkill - we only really need the asset service, not a whole scene. |
53 | Scene scene = SceneHelpers.SetupScene(); | 53 | Scene scene = new SceneHelpers().SetupScene(); |
54 | 54 | ||
55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService); | 55 | GetTextureHandler handler = new GetTextureHandler(null, scene.AssetService, "TestGetTexture", null); |
56 | TestOSHttpRequest req = new TestOSHttpRequest(); | 56 | TestOSHttpRequest req = new TestOSHttpRequest(); |
57 | TestOSHttpResponse resp = new TestOSHttpResponse(); | 57 | TestOSHttpResponse resp = new TestOSHttpResponse(); |
58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); | 58 | req.Url = new Uri("http://localhost/?texture_id=00000000-0000-1111-9999-000000000012"); |
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs index 594ce9d..8849a59 100644 --- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs +++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs | |||
@@ -85,8 +85,8 @@ namespace OpenSim.Capabilities.Handlers | |||
85 | uploader.OnUpLoad += BakedTextureUploaded; | 85 | uploader.OnUpLoad += BakedTextureUploaded; |
86 | 86 | ||
87 | m_HostCapsObj.HttpListener.AddStreamHandler( | 87 | m_HostCapsObj.HttpListener.AddStreamHandler( |
88 | new BinaryStreamHandler("POST", capsBase + uploaderPath, | 88 | new BinaryStreamHandler( |
89 | uploader.uploaderCaps)); | 89 | "POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null)); |
90 | 90 | ||
91 | string protocol = "http://"; | 91 | string protocol = "http://"; |
92 | 92 | ||
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescHandler.cs index d5c062b..9a6ca86 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,72 @@ 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 | if (linkedItem != null) | ||
305 | itemsToReturn.Insert(0, linkedItem); | ||
306 | } | ||
307 | } | ||
308 | } | ||
309 | } | ||
310 | } | ||
311 | |||
312 | // foreach (InventoryItemBase item in contents.Items) | ||
250 | // { | 313 | // { |
251 | // List<InventoryItemBase> linkedItemsToAdd = new List<InventoryItemBase>(); | 314 | // m_log.DebugFormat( |
252 | // | 315 | // "[WEB FETCH INV DESC HANDLER]: Returning item {0}, type {1}, parent {2} in {3} {4}", |
253 | // foreach (InventoryItemBase item in contents.Items) | 316 | // item.Name, (AssetType)item.AssetType, item.Folder, containingFolder.Name, containingFolder.ID); |
254 | // { | 317 | // } |
255 | // if (item.AssetType == (int)AssetType.Link) | 318 | |
256 | // { | 319 | // ===== |
257 | // InventoryItemBase linkedItem = m_InventoryService.GetItem(new InventoryItemBase(item.AssetID)); | 320 | |
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 | // | 321 | // |
268 | // foreach (InventoryItemBase linkedItem in linkedItemsToAdd) | 322 | // foreach (InventoryItemBase linkedItem in linkedItemsToAdd) |
269 | // { | 323 | // { |
@@ -340,12 +394,8 @@ namespace OpenSim.Capabilities.Handlers | |||
340 | llsdFolder.folder_id = invFolder.ID; | 394 | llsdFolder.folder_id = invFolder.ID; |
341 | llsdFolder.parent_id = invFolder.ParentID; | 395 | llsdFolder.parent_id = invFolder.ParentID; |
342 | llsdFolder.name = invFolder.Name; | 396 | llsdFolder.name = invFolder.Name; |
343 | 397 | llsdFolder.type = invFolder.Type; | |
344 | if (invFolder.Type == (short)AssetType.Unknown || !Enum.IsDefined(typeof(AssetType), (sbyte)invFolder.Type)) | 398 | llsdFolder.preferred_type = -1; |
345 | llsdFolder.type = "-1"; | ||
346 | else | ||
347 | llsdFolder.type = Utils.AssetTypeToString((AssetType)invFolder.Type); | ||
348 | llsdFolder.preferred_type = "-1"; | ||
349 | 399 | ||
350 | return llsdFolder; | 400 | return llsdFolder; |
351 | } | 401 | } |
@@ -365,18 +415,8 @@ namespace OpenSim.Capabilities.Handlers | |||
365 | llsdItem.item_id = invItem.ID; | 415 | llsdItem.item_id = invItem.ID; |
366 | llsdItem.name = invItem.Name; | 416 | llsdItem.name = invItem.Name; |
367 | llsdItem.parent_id = invItem.Folder; | 417 | llsdItem.parent_id = invItem.Folder; |
368 | 418 | llsdItem.type = invItem.AssetType; | |
369 | try | 419 | 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 | 420 | ||
381 | llsdItem.permissions = new LLSDPermissions(); | 421 | llsdItem.permissions = new LLSDPermissions(); |
382 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; | 422 | llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid; |
@@ -390,21 +430,7 @@ namespace OpenSim.Capabilities.Handlers | |||
390 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; | 430 | llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions; |
391 | llsdItem.sale_info = new LLSDSaleInfo(); | 431 | llsdItem.sale_info = new LLSDSaleInfo(); |
392 | llsdItem.sale_info.sale_price = invItem.SalePrice; | 432 | llsdItem.sale_info.sale_price = invItem.SalePrice; |
393 | switch (invItem.SaleType) | 433 | 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 | 434 | ||
409 | return llsdItem; | 435 | return llsdItem; |
410 | } | 436 | } |
diff --git a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs index 92eeb14..5d86557 100644 --- a/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs +++ b/OpenSim/Capabilities/Handlers/WebFetchInventoryDescendents/WebFetchInvDescServerConnector.cs | |||
@@ -68,7 +68,13 @@ namespace OpenSim.Capabilities.Handlers | |||
68 | ServerUtils.LoadPlugin<ILibraryService>(libService, args); | 68 | ServerUtils.LoadPlugin<ILibraryService>(libService, args); |
69 | 69 | ||
70 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); | 70 | WebFetchInvDescHandler webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); |
71 | IRequestHandler reqHandler = new RestStreamHandler("POST", "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, webFetchHandler.FetchInventoryDescendentsRequest); | 71 | IRequestHandler reqHandler |
72 | = new RestStreamHandler( | ||
73 | "POST", | ||
74 | "/CAPS/WebFetchInvDesc/" /*+ UUID.Random()*/, | ||
75 | webFetchHandler.FetchInventoryDescendentsRequest, | ||
76 | "WebFetchInvDesc", | ||
77 | null); | ||
72 | server.AddStreamHandler(reqHandler); | 78 | server.AddStreamHandler(reqHandler); |
73 | } | 79 | } |
74 | 80 | ||
diff --git a/OpenSim/Capabilities/LLSDEnvironmentSettings.cs b/OpenSim/Capabilities/LLSDEnvironmentSettings.cs new file mode 100644 index 0000000..39019af --- /dev/null +++ b/OpenSim/Capabilities/LLSDEnvironmentSettings.cs | |||
@@ -0,0 +1,68 @@ | |||
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 System; | ||
29 | using System.Collections.Generic; | ||
30 | using OpenMetaverse; | ||
31 | |||
32 | namespace OpenSim.Framework.Capabilities | ||
33 | { | ||
34 | [OSDMap] | ||
35 | public class LLSDEnvironmentRequest | ||
36 | { | ||
37 | public UUID messageID; | ||
38 | public UUID regionID; | ||
39 | } | ||
40 | |||
41 | [OSDMap] | ||
42 | public class LLSDEnvironmentSetResponse | ||
43 | { | ||
44 | public UUID regionID; | ||
45 | public UUID messageID; | ||
46 | public Boolean success; | ||
47 | public String fail_reason; | ||
48 | } | ||
49 | |||
50 | public class EnvironmentSettings | ||
51 | { | ||
52 | /// <summary> | ||
53 | /// generates a empty llsd settings response for viewer | ||
54 | /// </summary> | ||
55 | /// <param name="messageID">the message UUID</param> | ||
56 | /// <param name="regionID">the region UUID</param> | ||
57 | public static string EmptySettings(UUID messageID, UUID regionID) | ||
58 | { | ||
59 | OSDArray arr = new OSDArray(); | ||
60 | LLSDEnvironmentRequest msg = new LLSDEnvironmentRequest(); | ||
61 | msg.messageID = messageID; | ||
62 | msg.regionID = regionID; | ||
63 | arr.Array.Add(msg); | ||
64 | return LLSDHelpers.SerialiseLLSDReply(arr); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | } | ||
diff --git a/OpenSim/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Capabilities/LLSDInventoryFolder.cs index 3c216e9..d085430 100644 --- a/OpenSim/Capabilities/LLSDInventoryFolder.cs +++ b/OpenSim/Capabilities/LLSDInventoryFolder.cs | |||
@@ -35,7 +35,7 @@ namespace OpenSim.Framework.Capabilities | |||
35 | public UUID folder_id; | 35 | public UUID folder_id; |
36 | public UUID parent_id; | 36 | public UUID parent_id; |
37 | public string name; | 37 | public string name; |
38 | public string type; | 38 | public int type; |
39 | public string preferred_type; | 39 | public int preferred_type; |
40 | } | 40 | } |
41 | } | 41 | } |
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/Capabilities/LLSDStreamHandler.cs b/OpenSim/Capabilities/LLSDStreamHandler.cs index c7c1fc9..5df24b2 100644 --- a/OpenSim/Capabilities/LLSDStreamHandler.cs +++ b/OpenSim/Capabilities/LLSDStreamHandler.cs | |||
@@ -39,7 +39,11 @@ namespace OpenSim.Framework.Capabilities | |||
39 | private LLSDMethod<TRequest, TResponse> m_method; | 39 | private LLSDMethod<TRequest, TResponse> m_method; |
40 | 40 | ||
41 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) | 41 | public LLSDStreamhandler(string httpMethod, string path, LLSDMethod<TRequest, TResponse> method) |
42 | : base(httpMethod, path) | 42 | : this(httpMethod, path, method, null, null) {} |
43 | |||
44 | public LLSDStreamhandler( | ||
45 | string httpMethod, string path, LLSDMethod<TRequest, TResponse> method, string name, string description) | ||
46 | : base(httpMethod, path, name, description) | ||
43 | { | 47 | { |
44 | m_method = method; | 48 | m_method = method; |
45 | } | 49 | } |
@@ -62,9 +66,7 @@ namespace OpenSim.Framework.Capabilities | |||
62 | 66 | ||
63 | TResponse response = m_method(llsdRequest); | 67 | TResponse response = m_method(llsdRequest); |
64 | 68 | ||
65 | Encoding encoding = new UTF8Encoding(false); | 69 | return Util.UTF8NoBomEncoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); |
66 | |||
67 | return encoding.GetBytes(LLSDHelpers.SerialiseLLSDReply(response)); | ||
68 | } | 70 | } |
69 | } | 71 | } |
70 | } | 72 | } |