diff --git a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs index b1c6bcf296..b5ae54a715 100644 --- a/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs +++ b/OpenSim/Server/Handlers/Presence/PresenceServerPostHandler.cs @@ -108,14 +108,14 @@ namespace OpenSim.Server.Handlers.Presence out info.RegionID)) return FailureResult(); - foreach (KeyValuePair kvp in request) + foreach (KeyValuePair kvp in request) { if (kvp.Key == "METHOD" || kvp.Key == "PrincipalID" || kvp.Key == "RegionID") continue; - info.Data[kvp.Key] = kvp.Value; + info.Data[kvp.Key] = kvp.Value.ToString(); } if (m_PresenceService.Report(info)) diff --git a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs index 6e1d65751a..aac1a83eae 100644 --- a/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/XInventoryConnector.cs @@ -96,19 +96,55 @@ namespace OpenSim.Services.Connectors return bool.Parse(ret["RESULT"].ToString()); } - public List GetInventorySkeleton(UUID userId) + public List GetInventorySkeleton(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETINVENTORYSKELETON", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + List folders = new List(); + + foreach (Object o in ret.Values) + folders.Add(BuildFolder((Dictionary)o)); + + return folders; } public InventoryFolderBase GetRootFolder(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETROOTFOLDER", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } public InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { - return null; + Dictionary ret = MakeRequest("GETFOLDERFORTYPE", + new Dictionary { + { "PRINCIPAL", principalID.ToString() }, + { "TYPE", ((int)type).ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } public InventoryCollection GetFolderContent(UUID principalID, UUID folderID) @@ -205,8 +241,28 @@ namespace OpenSim.Services.Connectors public bool AddItem(InventoryItemBase item) { - Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + Dictionary ret = MakeRequest("ADDITEM", new Dictionary { + { "AssetID", item.AssetID.ToString() }, + { "AssetType", item.AssetType.ToString() }, + { "Name", item.Name.ToString() }, + { "Owner", item.Owner.ToString() }, + { "ID", item.ID.ToString() }, + { "InvType", item.InvType.ToString() }, + { "Folder", item.Folder.ToString() }, + { "CreatorId", item.CreatorId.ToString() }, + { "Description", item.Description.ToString() }, + { "NextPermissions", item.NextPermissions.ToString() }, + { "CurrentPermissions", item.CurrentPermissions.ToString() }, + { "BasePermissions", item.BasePermissions.ToString() }, + { "EveryOnePermissions", item.EveryOnePermissions.ToString() }, + { "GroupPermissions", item.GroupPermissions.ToString() }, + { "GroupID", item.GroupID.ToString() }, + { "GroupOwned", item.GroupOwned.ToString() }, + { "SalePrice", item.SalePrice.ToString() }, + { "SaleType", item.SaleType.ToString() }, + { "Flags", item.Flags.ToString() }, + { "CreationDate", item.CreationDate.ToString() } }); if (ret == null) @@ -217,8 +273,28 @@ namespace OpenSim.Services.Connectors public bool UpdateItem(InventoryItemBase item) { - Dictionary ret = MakeRequest("CREATEUSERINVENTORY", + Dictionary ret = MakeRequest("UPDATEITEM", new Dictionary { + { "AssetID", item.AssetID.ToString() }, + { "AssetType", item.AssetType.ToString() }, + { "Name", item.Name.ToString() }, + { "Owner", item.Owner.ToString() }, + { "ID", item.ID.ToString() }, + { "InvType", item.InvType.ToString() }, + { "Folder", item.Folder.ToString() }, + { "CreatorId", item.CreatorId.ToString() }, + { "Description", item.Description.ToString() }, + { "NextPermissions", item.NextPermissions.ToString() }, + { "CurrentPermissions", item.CurrentPermissions.ToString() }, + { "BasePermissions", item.BasePermissions.ToString() }, + { "EveryOnePermissions", item.EveryOnePermissions.ToString() }, + { "GroupPermissions", item.GroupPermissions.ToString() }, + { "GroupID", item.GroupID.ToString() }, + { "GroupOwned", item.GroupOwned.ToString() }, + { "SalePrice", item.SalePrice.ToString() }, + { "SaleType", item.SaleType.ToString() }, + { "Flags", item.Flags.ToString() }, + { "CreationDate", item.CreationDate.ToString() } }); if (ret == null) @@ -227,9 +303,28 @@ namespace OpenSim.Services.Connectors return bool.Parse(ret["RESULT"].ToString()); } - public bool MoveItems(UUID ownerID, List items) + public bool MoveItems(UUID principalID, List items) { - return false; + List idlist = new List(); + List destlist = new List(); + + foreach (InventoryItemBase item in items) + { + idlist.Add(item.ID.ToString()); + destlist.Add(item.Folder.ToString()); + } + + Dictionary ret = MakeRequest("MOVEITEMS", + new Dictionary { + { "PrincipalID", principalID.ToString() }, + { "IDLIST", idlist }, + { "DESTLIST", destlist } + }); + + if (ret == null) + return false; + + return bool.Parse(ret["RESULT"].ToString()); } public bool DeleteItems(UUID principalID, List itemIDs) @@ -253,17 +348,52 @@ namespace OpenSim.Services.Connectors public InventoryItemBase GetItem(InventoryItemBase item) { - return null; + Dictionary ret = MakeRequest("GETITEM", + new Dictionary { + { "ID", item.ID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildItem(ret); } public InventoryFolderBase GetFolder(InventoryFolderBase folder) { - return null; + Dictionary ret = MakeRequest("GETFOLDER", + new Dictionary { + { "ID", folder.ID.ToString() } + }); + + if (ret == null) + return null; + + if (ret.Count == 0) + return null; + + return BuildFolder(ret); } - public List GetActiveGestures(UUID userId) + public List GetActiveGestures(UUID principalID) { - return null; + Dictionary ret = MakeRequest("GETACTIVEGESTURES", + new Dictionary { + { "PRINCIPAL", principalID.ToString() } + }); + + if (ret == null) + return null; + + List items = new List(); + + foreach (Object o in ret.Values) + items.Add(BuildItem((Dictionary)o)); + + return items; } public int GetAssetPermissions(UUID principalID, UUID assetID) @@ -275,7 +405,7 @@ namespace OpenSim.Services.Connectors }); if (ret == null) - return false; + return 0; return int.Parse(ret["RESULT"].ToString()); } @@ -313,5 +443,47 @@ namespace OpenSim.Services.Connectors return replyData; } + + InventoryFolderBase BuildFolder(Dictionary data) + { + InventoryFolderBase folder = new InventoryFolderBase(); + + folder.ParentID = new UUID(data["ParentID"].ToString()); + folder.Type = short.Parse(data["Type"].ToString()); + folder.Version = ushort.Parse(data["Version"].ToString()); + folder.Name = data["Name"].ToString(); + folder.Owner = new UUID(data["Owner"].ToString()); + folder.ID = new UUID(data["ID"].ToString()); + + return folder; + } + + InventoryItemBase BuildItem(Dictionary data) + { + InventoryItemBase item = new InventoryItemBase(); + + item.AssetID = new UUID(data["AssetID"].ToString()); + item.AssetType = int.Parse(data["AssetType"].ToString()); + item.Name = data["Name"].ToString(); + item.Owner = new UUID(data["Owner"].ToString()); + item.ID = new UUID(data["ID"].ToString()); + item.InvType = int.Parse(data["InvType"].ToString()); + item.Folder = new UUID(data["Folder"].ToString()); + item.CreatorId = data["CreatorId"].ToString(); + item.Description = data["Description"].ToString(); + item.NextPermissions = uint.Parse(data["NextPermissions"].ToString()); + item.CurrentPermissions = uint.Parse(data["CurrentPermissions"].ToString()); + item.BasePermissions = uint.Parse(data["BasePermissions"].ToString()); + item.EveryOnePermissions = uint.Parse(data["EveryOnePermissions"].ToString()); + item.GroupPermissions = uint.Parse(data["GroupPermissions"].ToString()); + item.GroupID = new UUID(data["GroupID"].ToString()); + item.GroupOwned = bool.Parse(data["GroupOwned"].ToString()); + item.SalePrice = int.Parse(data["SalePrice"].ToString()); + item.SaleType = byte.Parse(data["SaleType"].ToString()); + item.Flags = uint.Parse(data["Flags"].ToString()); + item.CreationDate = int.Parse(data["CreationDate"].ToString()); + + return item; + } } }