Part 1 of making inventory work again in the 1.19.1 (RC) client. Implemented the FetchInventoryDescendents CAPS handler. But currently returning empty folder details.
So this commit doesn't actually fix inventory in that client, it just stops the "loading" message being displayed forever next to a folder, and instead shows empty folders. Next part will be to fill in the details of the items in the folders.0.6.0-stable
parent
4746c26824
commit
70e55205a1
|
@ -66,6 +66,7 @@ namespace OpenSim.Region.Capabilities
|
||||||
//private string m_requestTexture = "0003/";
|
//private string m_requestTexture = "0003/";
|
||||||
private string m_notecardUpdatePath = "0004/";
|
private string m_notecardUpdatePath = "0004/";
|
||||||
private string m_notecardTaskUpdatePath = "0005/";
|
private string m_notecardTaskUpdatePath = "0005/";
|
||||||
|
private string m_fetchInventoryPath = "0006/";
|
||||||
|
|
||||||
//private string eventQueue = "0100/";
|
//private string eventQueue = "0100/";
|
||||||
private BaseHttpServer m_httpListener;
|
private BaseHttpServer m_httpListener;
|
||||||
|
@ -110,10 +111,17 @@ namespace OpenSim.Region.Capabilities
|
||||||
capsBase + m_newInventory,
|
capsBase + m_newInventory,
|
||||||
NewAgentInventoryRequest));
|
NewAgentInventoryRequest));
|
||||||
|
|
||||||
|
// m_httpListener.AddStreamHandler(
|
||||||
|
// new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
|
||||||
|
// capsBase + m_fetchInventory,
|
||||||
|
// FetchInventory));
|
||||||
|
|
||||||
|
|
||||||
AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest);
|
AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest);
|
||||||
//AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture);
|
//AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture);
|
||||||
AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory);
|
AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory);
|
||||||
AddLegacyCapsHandler(m_httpListener, m_notecardTaskUpdatePath, ScriptTaskInventory);
|
AddLegacyCapsHandler(m_httpListener, m_notecardTaskUpdatePath, ScriptTaskInventory);
|
||||||
|
AddLegacyCapsHandler(m_httpListener, m_fetchInventoryPath, FetchInventoryRequest);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -160,9 +168,37 @@ namespace OpenSim.Region.Capabilities
|
||||||
caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
|
caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
|
||||||
caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
|
caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
|
||||||
caps.UpdateScriptTaskInventory = capsBaseUrl + m_notecardTaskUpdatePath;
|
caps.UpdateScriptTaskInventory = capsBaseUrl + m_notecardTaskUpdatePath;
|
||||||
|
caps.FetchInventoryDescendents = capsBaseUrl + m_fetchInventoryPath;
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string FetchInventoryRequest(string request, string path, string param)
|
||||||
|
{
|
||||||
|
request = request.Replace("<llsd><map><key>folders</key><array>", "<llsd>");
|
||||||
|
request = request.Replace("</map></array></map>", "</map>");
|
||||||
|
|
||||||
|
//Console.WriteLine("inventory request " + request);
|
||||||
|
Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
|
||||||
|
LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
|
||||||
|
LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
|
||||||
|
LLSDInventoryDescendents reply = FetchInventory(llsdRequest);
|
||||||
|
string response = LLSDHelpers.SerialiseLLSDReply(reply);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LLSDInventoryDescendents FetchInventory(LLSDFetchInventoryDescendents invFetch)
|
||||||
|
{
|
||||||
|
LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
|
||||||
|
LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
|
||||||
|
contents.agent___id = m_agentID;
|
||||||
|
contents.owner___id = m_agentID;
|
||||||
|
contents.folder___id = invFetch.folder_id;
|
||||||
|
contents.version = 1;
|
||||||
|
contents.descendents = 0;
|
||||||
|
reply.folders.Array.Add(contents);
|
||||||
|
return reply;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -42,6 +42,7 @@ namespace OpenSim.Region.Capabilities
|
||||||
public string UpdateScriptAgentInventory = String.Empty;
|
public string UpdateScriptAgentInventory = String.Empty;
|
||||||
public string UpdateScriptTaskInventory = String.Empty;
|
public string UpdateScriptTaskInventory = String.Empty;
|
||||||
// public string ParcelVoiceInfoRequest = String.Empty;
|
// public string ParcelVoiceInfoRequest = String.Empty;
|
||||||
|
public string FetchInventoryDescendents = String.Empty;
|
||||||
|
|
||||||
public LLSDCapsDetails()
|
public LLSDCapsDetails()
|
||||||
{
|
{
|
||||||
|
|
|
@ -66,14 +66,18 @@ namespace OpenSim.Region.Capabilities
|
||||||
if (fieldAttributes.Length > 0)
|
if (fieldAttributes.Length > 0)
|
||||||
{
|
{
|
||||||
writer.WriteStartElement(String.Empty, "key", String.Empty);
|
writer.WriteStartElement(String.Empty, "key", String.Empty);
|
||||||
writer.WriteString(fields[i].Name);
|
string fieldName = fields[i].Name;
|
||||||
|
fieldName = fieldName.Replace("___", "-");
|
||||||
|
writer.WriteString(fieldName);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
SerializeLLSDType(writer, fieldValue);
|
SerializeLLSDType(writer, fieldValue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
writer.WriteStartElement(String.Empty, "key", String.Empty);
|
writer.WriteStartElement(String.Empty, "key", String.Empty);
|
||||||
writer.WriteString(fields[i].Name);
|
string fieldName = fields[i].Name;
|
||||||
|
fieldName = fieldName.Replace("___", "-");
|
||||||
|
writer.WriteString(fieldName);
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
LLSD.LLSDWriteOne(writer, fieldValue);
|
LLSD.LLSDWriteOne(writer, fieldValue);
|
||||||
// libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
|
// libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
|
||||||
|
@ -118,7 +122,9 @@ namespace OpenSim.Region.Capabilities
|
||||||
IDictionaryEnumerator enumerator = llsd.GetEnumerator();
|
IDictionaryEnumerator enumerator = llsd.GetEnumerator();
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
FieldInfo field = myType.GetField((string) enumerator.Key);
|
string keyName = (string)enumerator.Key;
|
||||||
|
keyName = keyName.Replace("-","_");
|
||||||
|
FieldInfo field = myType.GetField(keyName);
|
||||||
if (field != null)
|
if (field != null)
|
||||||
{
|
{
|
||||||
// if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
|
// if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using libsecondlife;
|
||||||
|
|
||||||
|
namespace OpenSim.Region.Capabilities
|
||||||
|
{
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDInventoryItem
|
||||||
|
{
|
||||||
|
public LLUUID parent_id;
|
||||||
|
|
||||||
|
public LLUUID asset_id;
|
||||||
|
public LLUUID item_id;
|
||||||
|
|
||||||
|
public string type;
|
||||||
|
public string inv_type;
|
||||||
|
public int flags;
|
||||||
|
|
||||||
|
public LLSDSaleInfo sale_info;
|
||||||
|
public string name;
|
||||||
|
public string desc;
|
||||||
|
public int created_at;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDPermissions
|
||||||
|
{
|
||||||
|
public LLUUID creator_id;
|
||||||
|
public LLUUID owner_id;
|
||||||
|
public LLUUID group_id;
|
||||||
|
public int base_mask;
|
||||||
|
public int owner_mask;
|
||||||
|
public int group_mask;
|
||||||
|
public int everyone_mask;
|
||||||
|
public int next_owner_mask;
|
||||||
|
public bool is_owner_group;
|
||||||
|
}
|
||||||
|
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDSaleInfo
|
||||||
|
{
|
||||||
|
public int sale_price;
|
||||||
|
public string sale_type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* [LLSDMap]
|
||||||
|
public class LLSDFolderItem
|
||||||
|
{
|
||||||
|
public LLUUID folder_id;
|
||||||
|
public LLUUID parent_id;
|
||||||
|
public int type;
|
||||||
|
public string name;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDInventoryDescendents
|
||||||
|
{
|
||||||
|
public LLSDArray folders= new LLSDArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDFetchInventoryDescendents
|
||||||
|
{
|
||||||
|
public LLUUID folder_id;
|
||||||
|
public LLUUID owner_id;
|
||||||
|
public int sort_order;
|
||||||
|
public bool fetch_folders;
|
||||||
|
public bool fetch_items;
|
||||||
|
}
|
||||||
|
|
||||||
|
[LLSDMap]
|
||||||
|
public class LLSDInventoryFolderContents
|
||||||
|
{
|
||||||
|
public LLUUID agent___id;
|
||||||
|
public int descendents;
|
||||||
|
public LLUUID folder___id; // the (three "_") "___" so the serialising knows to change this to a "-"
|
||||||
|
public LLSDArray items = new LLSDArray();
|
||||||
|
public LLUUID owner___id;
|
||||||
|
public int version;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue