aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorDiva Canto2012-04-06 11:38:47 -0700
committerDiva Canto2012-04-06 11:38:47 -0700
commit6eaff18961668ba6141a7dd26a3df873489f64b5 (patch)
treec15b51f2cd2703bfc7eff686c7ea0ffe893b47a1 /OpenSim/Server
parentPacking of folder in SendBulkUpdateInventory always set the folder type to -1... (diff)
downloadopensim-SC-6eaff18961668ba6141a7dd26a3df873489f64b5.zip
opensim-SC-6eaff18961668ba6141a7dd26a3df873489f64b5.tar.gz
opensim-SC-6eaff18961668ba6141a7dd26a3df873489f64b5.tar.bz2
opensim-SC-6eaff18961668ba6141a7dd26a3df873489f64b5.tar.xz
Finish the implementation of GetUserInventory, even though it's still not used.
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs72
1 files changed, 59 insertions, 13 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index 040c840..cb9b65d 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -114,6 +114,8 @@ namespace OpenSim.Server.Handlers.Asset
114 return HandleCreateUserInventory(request); 114 return HandleCreateUserInventory(request);
115 case "GETINVENTORYSKELETON": 115 case "GETINVENTORYSKELETON":
116 return HandleGetInventorySkeleton(request); 116 return HandleGetInventorySkeleton(request);
117 case "GETUSERINVENTORY":
118 return HandleGetUserInventory(request);
117 case "GETROOTFOLDER": 119 case "GETROOTFOLDER":
118 return HandleGetRootFolder(request); 120 return HandleGetRootFolder(request);
119 case "GETFOLDERFORTYPE": 121 case "GETFOLDERFORTYPE":
@@ -153,7 +155,7 @@ namespace OpenSim.Server.Handlers.Asset
153 } 155 }
154 catch (Exception e) 156 catch (Exception e)
155 { 157 {
156 m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e); 158 m_log.DebugFormat("[XINVENTORY HANDLER]: Exception {0}", e.StackTrace);
157 } 159 }
158 160
159 return FailureResult(); 161 return FailureResult();
@@ -248,6 +250,45 @@ namespace OpenSim.Server.Handlers.Asset
248 return encoding.GetBytes(xmlString); 250 return encoding.GetBytes(xmlString);
249 } 251 }
250 252
253 byte[] HandleGetUserInventory(Dictionary<string, object> request)
254 {
255 Dictionary<string, object> result = new Dictionary<string, object>();
256 UUID principal = UUID.Zero;
257 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
258
259 InventoryCollection icoll = m_InventoryService.GetUserInventory(principal);
260 if (icoll != null)
261 {
262 Dictionary<string, object> folders = new Dictionary<string, object>();
263 int i = 0;
264 if (icoll.Folders != null)
265 {
266 foreach (InventoryFolderBase f in icoll.Folders)
267 {
268 folders["folder_" + i.ToString()] = EncodeFolder(f);
269 i++;
270 }
271 result["FOLDERS"] = folders;
272 }
273 if (icoll.Items != null)
274 {
275 i = 0;
276 Dictionary<string, object> items = new Dictionary<string, object>();
277 foreach (InventoryItemBase it in icoll.Items)
278 {
279 items["item_" + i.ToString()] = EncodeItem(it);
280 i++;
281 }
282 result["ITEMS"] = items;
283 }
284 }
285
286 string xmlString = ServerUtils.BuildXmlResponse(result);
287 //m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
288 UTF8Encoding encoding = new UTF8Encoding();
289 return encoding.GetBytes(xmlString);
290 }
291
251 byte[] HandleGetRootFolder(Dictionary<string,object> request) 292 byte[] HandleGetRootFolder(Dictionary<string,object> request)
252 { 293 {
253 Dictionary<string,object> result = new Dictionary<string,object>(); 294 Dictionary<string,object> result = new Dictionary<string,object>();
@@ -293,22 +334,27 @@ namespace OpenSim.Server.Handlers.Asset
293 if (icoll != null) 334 if (icoll != null)
294 { 335 {
295 Dictionary<string, object> folders = new Dictionary<string, object>(); 336 Dictionary<string, object> folders = new Dictionary<string, object>();
296 int i = 0; 337 int i = 0;
297 foreach (InventoryFolderBase f in icoll.Folders) 338 if (icoll.Folders != null)
298 { 339 {
299 folders["folder_" + i.ToString()] = EncodeFolder(f); 340 foreach (InventoryFolderBase f in icoll.Folders)
300 i++; 341 {
342 folders["folder_" + i.ToString()] = EncodeFolder(f);
343 i++;
344 }
345 result["FOLDERS"] = folders;
301 } 346 }
302 result["FOLDERS"] = folders; 347 if (icoll.Items != null)
303
304 i = 0;
305 Dictionary<string, object> items = new Dictionary<string, object>();
306 foreach (InventoryItemBase it in icoll.Items)
307 { 348 {
308 items["item_" + i.ToString()] = EncodeItem(it); 349 i = 0;
309 i++; 350 Dictionary<string, object> items = new Dictionary<string, object>();
351 foreach (InventoryItemBase it in icoll.Items)
352 {
353 items["item_" + i.ToString()] = EncodeItem(it);
354 i++;
355 }
356 result["ITEMS"] = items;
310 } 357 }
311 result["ITEMS"] = items;
312 } 358 }
313 359
314 string xmlString = ServerUtils.BuildXmlResponse(result); 360 string xmlString = ServerUtils.BuildXmlResponse(result);