diff options
Diffstat (limited to 'OpenSim/Capabilities')
-rw-r--r-- | OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | 98 |
1 files changed, 43 insertions, 55 deletions
diff --git a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs index e3a9a22..45eda57 100644 --- a/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs +++ b/OpenSim/Capabilities/Handlers/FetchInventory/FetchInvDescHandler.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Linq; | 31 | using System.Linq; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | ||
33 | using log4net; | 34 | using log4net; |
34 | using Nini.Config; | 35 | using Nini.Config; |
35 | using OpenMetaverse; | 36 | using OpenMetaverse; |
@@ -93,8 +94,8 @@ namespace OpenSim.Capabilities.Handlers | |||
93 | 94 | ||
94 | ArrayList foldersrequested = (ArrayList)hash["folders"]; | 95 | ArrayList foldersrequested = (ArrayList)hash["folders"]; |
95 | 96 | ||
96 | string response = ""; | 97 | StringBuilder tmpresponse = new StringBuilder(1024); |
97 | string bad_folders_response = ""; | 98 | StringBuilder tmpbadfolders = new StringBuilder(1024); |
98 | 99 | ||
99 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); | 100 | List<LLSDFetchInventoryDescendents> folders = new List<LLSDFetchInventoryDescendents>(); |
100 | for (int i = 0; i < foldersrequested.Count; i++) | 101 | for (int i = 0; i < foldersrequested.Count; i++) |
@@ -142,43 +143,38 @@ namespace OpenSim.Capabilities.Handlers | |||
142 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); | 143 | inventoryitemstr = inventoryitemstr.Replace("<llsd><map><key>folders</key><array>", ""); |
143 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | 144 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); |
144 | 145 | ||
145 | response += inventoryitemstr; | 146 | tmpresponse.Append(inventoryitemstr); |
146 | } | 147 | } |
147 | 148 | ||
148 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); | 149 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Bad folders {0}", string.Join(", ", bad_folders)); |
149 | foreach (UUID bad in bad_folders) | 150 | foreach (UUID bad in bad_folders) |
150 | bad_folders_response += "<uuid>" + bad + "</uuid>"; | 151 | { |
152 | tmpbadfolders.Append("<map><key>folder_id</key><uuid>"); | ||
153 | tmpbadfolders.Append(bad.ToString()); | ||
154 | tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>"); | ||
155 | } | ||
151 | } | 156 | } |
152 | 157 | ||
153 | if (response.Length == 0) | 158 | StringBuilder lastresponse = new StringBuilder(1024); |
159 | lastresponse.Append("<llsd>"); | ||
160 | if(tmpresponse.Length > 0) | ||
154 | { | 161 | { |
155 | /* Viewers expect a bad_folders array when not available */ | 162 | lastresponse.Append("<map><key>folders</key><array>"); |
156 | if (bad_folders_response.Length != 0) | 163 | lastresponse.Append(tmpresponse.ToString()); |
157 | { | 164 | lastresponse.Append("</array></map>"); |
158 | response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
163 | } | ||
164 | } | 165 | } |
165 | else | 166 | else |
167 | lastresponse.Append("<map><key>folders</key><array /></map>"); | ||
168 | |||
169 | if(tmpbadfolders.Length > 0) | ||
166 | { | 170 | { |
167 | if (bad_folders_response.Length != 0) | 171 | lastresponse.Append("<map><key>bad_folders</key><array>"); |
168 | { | 172 | lastresponse.Append(tmpbadfolders.ToString()); |
169 | response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; | 173 | lastresponse.Append("</array></map>"); |
170 | } | ||
171 | else | ||
172 | { | ||
173 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
174 | } | ||
175 | } | 174 | } |
175 | lastresponse.Append("</llsd>"); | ||
176 | 176 | ||
177 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request for {0} folders. Item count {1}", folders.Count, item_count); | 177 | return lastresponse.ToString(); |
178 | //m_log.Debug("[WEB FETCH INV DESC HANDLER] " + response); | ||
179 | |||
180 | return response; | ||
181 | |||
182 | } | 178 | } |
183 | 179 | ||
184 | /// <summary> | 180 | /// <summary> |
@@ -285,8 +281,8 @@ namespace OpenSim.Capabilities.Handlers | |||
285 | { | 281 | { |
286 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count); | 282 | //m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Received request for {0} folders", foldersrequested.Count); |
287 | 283 | ||
288 | string response = ""; | 284 | StringBuilder tmpresponse = new StringBuilder(1024); |
289 | string bad_folders_response = ""; | 285 | StringBuilder tmpbadfolders = new StringBuilder(1024); |
290 | 286 | ||
291 | for (int i = 0; i < foldersrequested.Count; i++) | 287 | for (int i = 0; i < foldersrequested.Count; i++) |
292 | { | 288 | { |
@@ -308,7 +304,9 @@ namespace OpenSim.Capabilities.Handlers | |||
308 | 304 | ||
309 | if (null == reply) | 305 | if (null == reply) |
310 | { | 306 | { |
311 | bad_folders_response += "<uuid>" + llsdRequest.folder_id.ToString() + "</uuid>"; | 307 | tmpbadfolders.Append("<map><key>folder_id</key><uuid>"); |
308 | tmpbadfolders.Append(llsdRequest.folder_id.ToString()); | ||
309 | tmpbadfolders.Append("</uuid><key>error</key><string>Unknown</string></map>"); | ||
312 | } | 310 | } |
313 | else | 311 | else |
314 | { | 312 | { |
@@ -317,39 +315,29 @@ namespace OpenSim.Capabilities.Handlers | |||
317 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); | 315 | inventoryitemstr = inventoryitemstr.Replace("</array></map></llsd>", ""); |
318 | } | 316 | } |
319 | 317 | ||
320 | response += inventoryitemstr; | 318 | tmpresponse.Append(inventoryitemstr); |
321 | } | 319 | } |
322 | 320 | ||
323 | if (response.Length == 0) | 321 | StringBuilder lastresponse = new StringBuilder(1024); |
322 | lastresponse.Append("<llsd>"); | ||
323 | if(tmpresponse.Length > 0) | ||
324 | { | 324 | { |
325 | /* Viewers expect a bad_folders array when not available */ | 325 | lastresponse.Append("<map><key>folders</key><array>"); |
326 | if (bad_folders_response.Length != 0) | 326 | lastresponse.Append(tmpresponse.ToString()); |
327 | { | 327 | lastresponse.Append("</array></map>"); |
328 | response = "<llsd><map><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; | ||
329 | } | ||
330 | else | ||
331 | { | ||
332 | response = "<llsd><map><key>folders</key><array /></map></llsd>"; | ||
333 | } | ||
334 | } | 328 | } |
335 | else | 329 | else |
330 | lastresponse.Append("<map><key>folders</key><array /></map>"); | ||
331 | |||
332 | if(tmpbadfolders.Length > 0) | ||
336 | { | 333 | { |
337 | if (bad_folders_response.Length != 0) | 334 | lastresponse.Append("<map><key>bad_folders</key><array>"); |
338 | { | 335 | lastresponse.Append(tmpbadfolders.ToString()); |
339 | response = "<llsd><map><key>folders</key><array>" + response + "</array><key>bad_folders</key><array>" + bad_folders_response + "</array></map></llsd>"; | 336 | lastresponse.Append("</array></map>"); |
340 | } | ||
341 | else | ||
342 | { | ||
343 | response = "<llsd><map><key>folders</key><array>" + response + "</array></map></llsd>"; | ||
344 | } | ||
345 | } | 337 | } |
338 | lastresponse.Append("</llsd>"); | ||
346 | 339 | ||
347 | // m_log.DebugFormat("[WEB FETCH INV DESC HANDLER]: Replying to CAPS fetch inventory request"); | 340 | return lastresponse.ToString(); |
348 | //m_log.Debug("[WEB FETCH INV DESC HANDLER] "+response); | ||
349 | |||
350 | return response; | ||
351 | |||
352 | // } | ||
353 | } | 341 | } |
354 | 342 | ||
355 | /// <summary> | 343 | /// <summary> |