From d649194be310bf267675ac3cd9f9fce302cc3798 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 28 Aug 2009 12:52:40 +0100
Subject: minor: formatting and comments
---
OpenSim/Framework/Communications/Services/LoginService.cs | 13 ++++++++++++-
OpenSim/Framework/InventoryFolderBase.cs | 2 +-
2 files changed, 13 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Communications/Services/LoginService.cs b/OpenSim/Framework/Communications/Services/LoginService.cs
index cac6616..bf59f8e 100644
--- a/OpenSim/Framework/Communications/Services/LoginService.cs
+++ b/OpenSim/Framework/Communications/Services/LoginService.cs
@@ -1063,7 +1063,18 @@ namespace OpenSim.Framework.Communications.Services
protected abstract RegionInfo RequestClosestRegion(string region);
protected abstract RegionInfo GetRegionInfo(ulong homeRegionHandle);
protected abstract RegionInfo GetRegionInfo(UUID homeRegionId);
- protected abstract bool PrepareLoginToRegion(RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client);
+
+ ///
+ /// Prepare a login to the given region. This involves both telling the region to expect a connection
+ /// and appropriately customising the response to the user.
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the region was successfully contacted, false otherwise
+ protected abstract bool PrepareLoginToRegion(
+ RegionInfo regionInfo, UserProfileData user, LoginResponse response, IPEndPoint client);
///
/// Add active gestures of the user to the login response.
diff --git a/OpenSim/Framework/InventoryFolderBase.cs b/OpenSim/Framework/InventoryFolderBase.cs
index 1869d48..0edb2c6 100644
--- a/OpenSim/Framework/InventoryFolderBase.cs
+++ b/OpenSim/Framework/InventoryFolderBase.cs
@@ -30,7 +30,7 @@ using OpenMetaverse;
namespace OpenSim.Framework
{
///
- /// A Class for folders which contain users inventory
+ /// User inventory folder
///
public class InventoryFolderBase : InventoryNodeBase
{
--
cgit v1.1
From 22a0dff22624984080bebc03ff63025fc213eeff Mon Sep 17 00:00:00 2001
From: Melanie
Date: Fri, 28 Aug 2009 23:28:32 +0100
Subject: Modify CAPS inventory code. Currently this is not executed
---
OpenSim/Framework/Capabilities/Caps.cs | 81 +++++++++++++---------
.../Framework/Capabilities/LLSDInventoryFolder.cs | 41 +++++++++++
.../Framework/Capabilities/LLSDInventoryItem.cs | 1 +
3 files changed, 92 insertions(+), 31 deletions(-)
create mode 100644 OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index df29c4e..5ae33d6 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Capabilities
public delegate void TaskScriptUpdatedCallback(UUID userID, UUID itemID, UUID primID,
bool isScriptRunning, byte[] data);
- public delegate List FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
+ public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
bool fetchFolders, bool fetchItems, int sortOrder);
///
@@ -460,47 +460,52 @@ namespace OpenSim.Framework.Capabilities
contents.descendents = 0;
reply.folders.Array.Add(contents);
- List itemList = null;
+ InventoryCollection inv = new InventoryCollection();
+ inv.Folders = new List();
+ inv.Items = new List();
if (CAPSFetchInventoryDescendents != null)
{
- itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order);
+ inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order);
}
- if (itemList != null)
+ if (inv.Folders != null)
{
- foreach (InventoryItemBase invItem in itemList)
+ foreach (InventoryFolderBase invFolder in inv.Folders)
{
- contents.items.Array.Add(ConvertInventoryItem(invItem));
+ contents.categories.Array.Add(ConvertInventoryFolder(invFolder));
}
}
- /* The following block is removed as it ALWAYS sends the error to the client because the RC 1.22.9 client tries to
- find items that have become dissasociated with a paret folder and have parent of 00000000-0000-00000....
- else
- {
- IClientAPI client = GetClient(m_agentID);
- // We're going to both notify the client of inventory service failure and send back a 'no folder contents' response.
- // If we don't send back the response,
- // the client becomes unhappy (see Teravus' comment in FetchInventoryRequest())
- if (client != null)
- {
- client.SendAgentAlertMessage(
- "AGIN0001E: The inventory service has either failed or is not responding. Your inventory will not function properly for the rest of this session. Please clear your cache and relog.",
- true);
- }
- else
+ if (inv.Items != null)
+ {
+ foreach (InventoryItemBase invItem in inv.Items)
{
- m_log.ErrorFormat(
- "[AGENT INVENTORY]: Could not lookup controlling client for {0} in order to notify them of the inventory service failure",
- m_agentID);
+ contents.items.Array.Add(ConvertInventoryItem(invItem));
}
- }*/
+ }
contents.descendents = contents.items.Array.Count;
return reply;
}
///
+ /// Convert an internal inventory folder object into an LLSD object.
+ ///
+ ///
+ ///
+ private LLSDInventoryFolder ConvertInventoryFolder(InventoryFolderBase invFolder)
+ {
+ LLSDInventoryFolder llsdFolder = new LLSDInventoryFolder();
+ llsdFolder.folder_id = invFolder.ID;
+ llsdFolder.parent_id = invFolder.ParentID;
+ llsdFolder.name = invFolder.Name;
+ llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type];
+ llsdFolder.preferred_type = "-1";
+
+ return llsdFolder;
+ }
+
+ ///
/// Convert an internal inventory item object into an LLSD object.
///
///
@@ -529,15 +534,29 @@ namespace OpenSim.Framework.Capabilities
llsdItem.permissions.creator_id = invItem.CreatorIdAsUuid;
llsdItem.permissions.base_mask = (int)invItem.CurrentPermissions;
llsdItem.permissions.everyone_mask = (int)invItem.EveryOnePermissions;
- llsdItem.permissions.group_id = UUID.Zero;
- llsdItem.permissions.group_mask = 0;
- llsdItem.permissions.is_owner_group = false;
+ llsdItem.permissions.group_id = invItem.GroupID;
+ llsdItem.permissions.group_mask = (int)invItem.GroupPermissions;
+ llsdItem.permissions.is_owner_group = invItem.GroupOwned;
llsdItem.permissions.next_owner_mask = (int)invItem.NextPermissions;
- llsdItem.permissions.owner_id = m_agentID; // FixMe
+ llsdItem.permissions.owner_id = m_agentID;
llsdItem.permissions.owner_mask = (int)invItem.CurrentPermissions;
llsdItem.sale_info = new LLSDSaleInfo();
- llsdItem.sale_info.sale_price = 10;
- llsdItem.sale_info.sale_type = "not";
+ llsdItem.sale_info.sale_price = invItem.SalePrice;
+ switch (invItem.SaleType)
+ {
+ default:
+ llsdItem.sale_info.sale_type = "not";
+ break;
+ case 1:
+ llsdItem.sale_info.sale_type = "original";
+ break;
+ case 2:
+ llsdItem.sale_info.sale_type = "copy";
+ break;
+ case 3:
+ llsdItem.sale_info.sale_type = "contents";
+ break;
+ }
return llsdItem;
}
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs
new file mode 100644
index 0000000..3c216e9
--- /dev/null
+++ b/OpenSim/Framework/Capabilities/LLSDInventoryFolder.cs
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) Contributors, http://opensimulator.org/
+ * See CONTRIBUTORS.TXT for a full list of copyright holders.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the OpenSimulator Project nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+using OpenMetaverse;
+
+namespace OpenSim.Framework.Capabilities
+{
+ [OSDMap]
+ public class LLSDInventoryFolder
+ {
+ public UUID folder_id;
+ public UUID parent_id;
+ public string name;
+ public string type;
+ public string preferred_type;
+ }
+}
diff --git a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
index d0498f6..cce18d7 100644
--- a/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
+++ b/OpenSim/Framework/Capabilities/LLSDInventoryItem.cs
@@ -90,6 +90,7 @@ namespace OpenSim.Framework.Capabilities
public UUID agent_id;
public int descendents;
public UUID folder_id;
+ public OSDArray categories = new OSDArray();
public OSDArray items = new OSDArray();
public UUID owner_id;
public int version;
--
cgit v1.1
From 976cf4284bdbef14553c2e164cb67d25bd2b9076 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 29 Aug 2009 03:26:44 +0100
Subject: Fix up WebFetchInventoryDescendents to really return all data needed,
especially the folder version and the subfolders. Fixes inventory search hang
and folders not loading.
---
OpenSim/Framework/Capabilities/Caps.cs | 28 ++++++++++------------
.../Servers/HttpServer/RestSessionService.cs | 2 +-
2 files changed, 13 insertions(+), 17 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs
index 5ae33d6..c5560b8 100644
--- a/OpenSim/Framework/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Capabilities/Caps.cs
@@ -58,7 +58,7 @@ namespace OpenSim.Framework.Capabilities
bool isScriptRunning, byte[] data);
public delegate InventoryCollection FetchInventoryDescendentsCAPS(UUID agentID, UUID folderID, UUID ownerID,
- bool fetchFolders, bool fetchItems, int sortOrder);
+ bool fetchFolders, bool fetchItems, int sortOrder, out int version);
///
/// XXX Probably not a particularly nice way of allow us to get the scene presence from the scene (chiefly so that
@@ -89,7 +89,7 @@ namespace OpenSim.Framework.Capabilities
//private static readonly string m_requestTexture = "0003/";
private static readonly string m_notecardUpdatePath = "0004/";
private static readonly string m_notecardTaskUpdatePath = "0005/";
- // private static readonly string m_fetchInventoryPath = "0006/";
+ private static readonly string m_fetchInventoryPath = "0006/";
// The following entries are in a module, however, they are also here so that we don't re-assign
// the path to another cap by mistake.
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Capabilities
// As of RC 1.22.9 of the Linden client this is
// supported
- // m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
+ m_capsHandlers["WebFetchInventoryDescendents"] =new RestStreamHandler("POST", capsBase + m_fetchInventoryPath, FetchInventoryDescendentsRequest);
// justincc: I've disabled the CAPS service for now to fix problems with selecting textures, and
// subsequent inventory breakage, in the edit object pane (such as mantis 1085). This requires
@@ -449,23 +449,14 @@ namespace OpenSim.Framework.Capabilities
contents.owner_id = invFetch.owner_id;
contents.folder_id = invFetch.folder_id;
- // The version number being sent back was originally 1.
- // Unfortunately, on 1.19.1.4, this means that we see a problem where on subsequent logins
- // without clearing client cache, objects in the root folder disappear until the cache is cleared,
- // at which point they reappear.
- //
- // Seeing the version to something other than 0 may be the right thing to do, but there is
- // a greater subtlety of the second life protocol that needs to be understood first.
- contents.version = 0;
-
- contents.descendents = 0;
reply.folders.Array.Add(contents);
InventoryCollection inv = new InventoryCollection();
inv.Folders = new List();
inv.Items = new List();
+ int version = 0;
if (CAPSFetchInventoryDescendents != null)
{
- inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order);
+ inv = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order, out version);
}
if (inv.Folders != null)
@@ -484,7 +475,9 @@ namespace OpenSim.Framework.Capabilities
}
}
- contents.descendents = contents.items.Array.Count;
+ contents.descendents = contents.items.Array.Count + contents.categories.Array.Count;
+ contents.version = version;
+
return reply;
}
@@ -499,7 +492,10 @@ namespace OpenSim.Framework.Capabilities
llsdFolder.folder_id = invFolder.ID;
llsdFolder.parent_id = invFolder.ParentID;
llsdFolder.name = invFolder.Name;
- llsdFolder.type = TaskInventoryItem.InvTypes[invFolder.Type];
+ if (invFolder.Type == -1)
+ llsdFolder.type = "-1";
+ else
+ llsdFolder.type = TaskInventoryItem.Types[invFolder.Type];
llsdFolder.preferred_type = "-1";
return llsdFolder;
diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
index 2ef4a36..3f72c31 100644
--- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
+++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs
@@ -94,6 +94,7 @@ namespace OpenSim.Framework.Servers.HttpServer
Stream requestStream = request.GetRequestStream();
requestStream.Write(buffer.ToArray(), 0, length);
+ requestStream.Close();
TResponse deserial = default(TResponse);
using (WebResponse resp = request.GetResponse())
{
@@ -101,7 +102,6 @@ namespace OpenSim.Framework.Servers.HttpServer
deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
resp.Close();
}
- requestStream.Close();
return deserial;
}
}
--
cgit v1.1