aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server/Handlers/Inventory
diff options
context:
space:
mode:
authorDiva Canto2010-02-06 19:06:08 -0800
committerDiva Canto2010-02-06 19:06:08 -0800
commit29e501d68834ca73e908ce43d8647de86391f7ff (patch)
tree5592f08f5ed46de70e142f70ce9ee1b887647b00 /OpenSim/Server/Handlers/Inventory
parentMerge branch 'presence-refactor' of ssh://opensimulator.org/var/git/opensim i... (diff)
downloadopensim-SC_OLD-29e501d68834ca73e908ce43d8647de86391f7ff.zip
opensim-SC_OLD-29e501d68834ca73e908ce43d8647de86391f7ff.tar.gz
opensim-SC_OLD-29e501d68834ca73e908ce43d8647de86391f7ff.tar.bz2
opensim-SC_OLD-29e501d68834ca73e908ce43d8647de86391f7ff.tar.xz
A little more beef on the xinventory in connector.
Diffstat (limited to 'OpenSim/Server/Handlers/Inventory')
-rw-r--r--OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs61
1 files changed, 61 insertions, 0 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
index c7d5ff1..ccaf5c4 100644
--- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
+++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs
@@ -231,6 +231,13 @@ namespace OpenSim.Server.Handlers.Asset
231 { 231 {
232 Dictionary<string,object> result = new Dictionary<string,object>(); 232 Dictionary<string,object> result = new Dictionary<string,object>();
233 233
234 UUID principal = UUID.Zero;
235 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
236 InventoryFolderBase rfolder = m_InventoryService.GetRootFolder(principal);
237 if (rfolder == null)
238 return FailureResult();
239
240 result[rfolder.ID.ToString()] = EncodeFolder(rfolder);
234 string xmlString = ServerUtils.BuildXmlResponse(result); 241 string xmlString = ServerUtils.BuildXmlResponse(result);
235 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 242 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
236 UTF8Encoding encoding = new UTF8Encoding(); 243 UTF8Encoding encoding = new UTF8Encoding();
@@ -240,7 +247,15 @@ namespace OpenSim.Server.Handlers.Asset
240 byte[] HandleGetFolderForType(Dictionary<string,object> request) 247 byte[] HandleGetFolderForType(Dictionary<string,object> request)
241 { 248 {
242 Dictionary<string,object> result = new Dictionary<string,object>(); 249 Dictionary<string,object> result = new Dictionary<string,object>();
250 UUID principal = UUID.Zero;
251 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
252 int type = 0;
253 Int32.TryParse(request["TYPE"].ToString(), out type);
254 InventoryFolderBase folder = m_InventoryService.GetFolderForType(principal, (AssetType)type);
255 if (folder == null)
256 return FailureResult();
243 257
258 result[folder.ID.ToString()] = EncodeFolder(folder);
244 string xmlString = ServerUtils.BuildXmlResponse(result); 259 string xmlString = ServerUtils.BuildXmlResponse(result);
245 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 260 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
246 UTF8Encoding encoding = new UTF8Encoding(); 261 UTF8Encoding encoding = new UTF8Encoding();
@@ -250,7 +265,25 @@ namespace OpenSim.Server.Handlers.Asset
250 byte[] HandleGetFolderContent(Dictionary<string,object> request) 265 byte[] HandleGetFolderContent(Dictionary<string,object> request)
251 { 266 {
252 Dictionary<string,object> result = new Dictionary<string,object>(); 267 Dictionary<string,object> result = new Dictionary<string,object>();
268 UUID principal = UUID.Zero;
269 UUID.TryParse(request["PRINCIPAL"].ToString(), out principal);
270 UUID folderID = UUID.Zero;
271 UUID.TryParse(request["FOLDER"].ToString(), out folderID);
253 272
273 InventoryCollection icoll = m_InventoryService.GetFolderContent(principal, folderID);
274 if (icoll == null)
275 return FailureResult();
276
277 Dictionary<string, object> folders = new Dictionary<string,object>();
278 foreach (InventoryFolderBase f in icoll.Folders)
279 folders[f.ID.ToString()] = EncodeFolder(f);
280 result["FOLDERS"] = folders;
281
282 Dictionary<string, object> items = new Dictionary<string, object>();
283 foreach (InventoryItemBase i in icoll.Items)
284 items[i.ID.ToString()] = EncodeItem(i);
285 result["ITEMS"] = folders;
286
254 string xmlString = ServerUtils.BuildXmlResponse(result); 287 string xmlString = ServerUtils.BuildXmlResponse(result);
255 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); 288 m_log.DebugFormat("[XXX]: resp string: {0}", xmlString);
256 UTF8Encoding encoding = new UTF8Encoding(); 289 UTF8Encoding encoding = new UTF8Encoding();
@@ -411,6 +444,34 @@ namespace OpenSim.Server.Handlers.Asset
411 return ret; 444 return ret;
412 } 445 }
413 446
447 private Dictionary<string, object> EncodeItem(InventoryItemBase item)
448 {
449 Dictionary<string, object> ret = new Dictionary<string, object>();
450
451 ret["AssetID"] = item.AssetID.ToString();
452 ret["AssetType"] = item.AssetType.ToString();
453 ret["BasePermissions"] = item.BasePermissions.ToString();
454 ret["CreationDate"] = item.CreationDate.ToString();
455 ret["CreatorId"] = item.CreatorId.ToString();
456 ret["CurrentPermissions"] = item.CurrentPermissions.ToString();
457 ret["Description"] = item.Description.ToString();
458 ret["EveryOnePermissions"] = item.EveryOnePermissions.ToString();
459 ret["Flags"] = item.Flags.ToString();
460 ret["Folder"] = item.Folder.ToString();
461 ret["GroupID"] = item.GroupID.ToString();
462 ret["GroupedOwned"] = item.GroupOwned.ToString();
463 ret["GroupPermissions"] = item.GroupPermissions.ToString();
464 ret["ID"] = item.ID.ToString();
465 ret["InvType"] = item.InvType.ToString();
466 ret["Name"] = item.Name.ToString();
467 ret["NextPermissions"] = item.NextPermissions.ToString();
468 ret["Owner"] = item.Owner.ToString();
469 ret["SalePrice"] = item.SalePrice.ToString();
470 ret["SaleType"] = item.SaleType.ToString();
471
472 return ret;
473 }
474
414 private InventoryFolderBase BuildFolder(Dictionary<string,object> data) 475 private InventoryFolderBase BuildFolder(Dictionary<string,object> data)
415 { 476 {
416 InventoryFolderBase folder = new InventoryFolderBase(); 477 InventoryFolderBase folder = new InventoryFolderBase();