diff options
author | Melanie | 2010-01-08 22:51:37 +0000 |
---|---|---|
committer | Melanie | 2010-01-08 22:51:37 +0000 |
commit | bc68390b14ec582093dc322c2f45c32491924406 (patch) | |
tree | df0c8c7909e40fc88be22dcee7d1d8156acd4bc2 | |
parent | Adds IClientAPI voids for GroupProposals. (diff) | |
download | opensim-SC-bc68390b14ec582093dc322c2f45c32491924406.zip opensim-SC-bc68390b14ec582093dc322c2f45c32491924406.tar.gz opensim-SC-bc68390b14ec582093dc322c2f45c32491924406.tar.bz2 opensim-SC-bc68390b14ec582093dc322c2f45c32491924406.tar.xz |
The first 2 handlers for the XInventory system.
-rw-r--r-- | OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | 74 | ||||
-rw-r--r-- | OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | 4 |
2 files changed, 76 insertions, 2 deletions
diff --git a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs index b48e30e..c7d5ff1 100644 --- a/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs +++ b/OpenSim/Server/Handlers/Inventory/XInventoryInConnector.cs | |||
@@ -38,6 +38,7 @@ using OpenSim.Services.Interfaces; | |||
38 | using OpenSim.Framework.Servers.HttpServer; | 38 | using OpenSim.Framework.Servers.HttpServer; |
39 | using OpenSim.Server.Handlers.Base; | 39 | using OpenSim.Server.Handlers.Base; |
40 | using log4net; | 40 | using log4net; |
41 | using OpenMetaverse; | ||
41 | 42 | ||
42 | namespace OpenSim.Server.Handlers.Asset | 43 | namespace OpenSim.Server.Handlers.Asset |
43 | { | 44 | { |
@@ -193,6 +194,14 @@ namespace OpenSim.Server.Handlers.Asset | |||
193 | { | 194 | { |
194 | Dictionary<string,object> result = new Dictionary<string,object>(); | 195 | Dictionary<string,object> result = new Dictionary<string,object>(); |
195 | 196 | ||
197 | if (!request.ContainsKey("PRINCIPAL")) | ||
198 | return FailureResult(); | ||
199 | |||
200 | if(m_InventoryService.CreateUserInventory(new UUID(request["PRINCIPAL"].ToString()))) | ||
201 | result["RESULT"] = "True"; | ||
202 | else | ||
203 | result["RESULT"] = "False"; | ||
204 | |||
196 | string xmlString = ServerUtils.BuildXmlResponse(result); | 205 | string xmlString = ServerUtils.BuildXmlResponse(result); |
197 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 206 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
198 | UTF8Encoding encoding = new UTF8Encoding(); | 207 | UTF8Encoding encoding = new UTF8Encoding(); |
@@ -203,6 +212,15 @@ namespace OpenSim.Server.Handlers.Asset | |||
203 | { | 212 | { |
204 | Dictionary<string,object> result = new Dictionary<string,object>(); | 213 | Dictionary<string,object> result = new Dictionary<string,object>(); |
205 | 214 | ||
215 | if (!request.ContainsKey("PRINCIPAL")) | ||
216 | return FailureResult(); | ||
217 | |||
218 | |||
219 | List<InventoryFolderBase> folders = m_InventoryService.GetInventorySkeleton(new UUID(request["PRINCIPAL"].ToString())); | ||
220 | |||
221 | foreach (InventoryFolderBase f in folders) | ||
222 | result[f.ID.ToString()] = EncodeFolder(f); | ||
223 | |||
206 | string xmlString = ServerUtils.BuildXmlResponse(result); | 224 | string xmlString = ServerUtils.BuildXmlResponse(result); |
207 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); | 225 | m_log.DebugFormat("[XXX]: resp string: {0}", xmlString); |
208 | UTF8Encoding encoding = new UTF8Encoding(); | 226 | UTF8Encoding encoding = new UTF8Encoding(); |
@@ -378,5 +396,61 @@ namespace OpenSim.Server.Handlers.Asset | |||
378 | UTF8Encoding encoding = new UTF8Encoding(); | 396 | UTF8Encoding encoding = new UTF8Encoding(); |
379 | return encoding.GetBytes(xmlString); | 397 | return encoding.GetBytes(xmlString); |
380 | } | 398 | } |
399 | |||
400 | private Dictionary<string, object> EncodeFolder(InventoryFolderBase f) | ||
401 | { | ||
402 | Dictionary<string, object> ret = new Dictionary<string, object>(); | ||
403 | |||
404 | ret["ParentID"] = f.ParentID.ToString(); | ||
405 | ret["Type"] = f.Type.ToString(); | ||
406 | ret["Version"] = f.Version.ToString(); | ||
407 | ret["Name"] = f.Name; | ||
408 | ret["Owner"] = f.Owner.ToString(); | ||
409 | ret["ID"] = f.ID.ToString(); | ||
410 | |||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | private InventoryFolderBase BuildFolder(Dictionary<string,object> data) | ||
415 | { | ||
416 | InventoryFolderBase folder = new InventoryFolderBase(); | ||
417 | |||
418 | folder.ParentID = new UUID(data["ParentID"].ToString()); | ||
419 | folder.Type = short.Parse(data["Type"].ToString()); | ||
420 | folder.Version = ushort.Parse(data["Version"].ToString()); | ||
421 | folder.Name = data["Name"].ToString(); | ||
422 | folder.Owner = new UUID(data["Owner"].ToString()); | ||
423 | folder.ID = new UUID(data["ID"].ToString()); | ||
424 | |||
425 | return folder; | ||
426 | } | ||
427 | |||
428 | private InventoryItemBase BuildItem(Dictionary<string,object> data) | ||
429 | { | ||
430 | InventoryItemBase item = new InventoryItemBase(); | ||
431 | |||
432 | item.AssetID = new UUID(data["AssetID"].ToString()); | ||
433 | item.AssetType = int.Parse(data["AssetType"].ToString()); | ||
434 | item.Name = data["Name"].ToString(); | ||
435 | item.Owner = new UUID(data["Owner"].ToString()); | ||
436 | item.ID = new UUID(data["ID"].ToString()); | ||
437 | item.InvType = int.Parse(data["InvType"].ToString()); | ||
438 | item.Folder = new UUID(data["Folder"].ToString()); | ||
439 | item.CreatorId = data["CreatorId"].ToString(); | ||
440 | item.Description = data["Description"].ToString(); | ||
441 | item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); | ||
442 | item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); | ||
443 | item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); | ||
444 | item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); | ||
445 | item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); | ||
446 | item.GroupID = new UUID(data["GroupID"].ToString()); | ||
447 | item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); | ||
448 | item.SalePrice = int.Parse(data["SalePrice"].ToString()); | ||
449 | item.SaleType = byte.Parse(data["SaleType"].ToString()); | ||
450 | item.Flags = uint.Parse(data["Flags"].ToString()); | ||
451 | item.CreationDate = int.Parse(data["CreationDate"].ToString()); | ||
452 | |||
453 | return item; | ||
454 | } | ||
381 | } | 455 | } |
382 | } | 456 | } |
diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 40acd6d..b9ccd7e 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs | |||
@@ -490,7 +490,7 @@ namespace OpenSim.Services.Connectors | |||
490 | return replyData; | 490 | return replyData; |
491 | } | 491 | } |
492 | 492 | ||
493 | InventoryFolderBase BuildFolder(Dictionary<string,object> data) | 493 | private InventoryFolderBase BuildFolder(Dictionary<string,object> data) |
494 | { | 494 | { |
495 | InventoryFolderBase folder = new InventoryFolderBase(); | 495 | InventoryFolderBase folder = new InventoryFolderBase(); |
496 | 496 | ||
@@ -504,7 +504,7 @@ namespace OpenSim.Services.Connectors | |||
504 | return folder; | 504 | return folder; |
505 | } | 505 | } |
506 | 506 | ||
507 | InventoryItemBase BuildItem(Dictionary<string,object> data) | 507 | private InventoryItemBase BuildItem(Dictionary<string,object> data) |
508 | { | 508 | { |
509 | InventoryItemBase item = new InventoryItemBase(); | 509 | InventoryItemBase item = new InventoryItemBase(); |
510 | 510 | ||