aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMW2008-03-15 11:48:27 +0000
committerMW2008-03-15 11:48:27 +0000
commit70e55205a19ca83aa2f63c2b2c5d2c300e2324f6 (patch)
tree947d7bff36771428f0e6eb8bb8405dc3db247be3
parent* Fix for Justincc's bug report #768 - Terrain looks rather phallic. (diff)
downloadopensim-SC_OLD-70e55205a19ca83aa2f63c2b2c5d2c300e2324f6.zip
opensim-SC_OLD-70e55205a19ca83aa2f63c2b2c5d2c300e2324f6.tar.gz
opensim-SC_OLD-70e55205a19ca83aa2f63c2b2c5d2c300e2324f6.tar.bz2
opensim-SC_OLD-70e55205a19ca83aa2f63c2b2c5d2c300e2324f6.tar.xz
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.
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs36
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs1
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs12
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs83
4 files changed, 129 insertions, 3 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs
index f9af7ea..53cb955 100644
--- a/OpenSim/Framework/Communications/Capabilities/Caps.cs
+++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs
@@ -66,6 +66,7 @@ namespace OpenSim.Region.Capabilities
66 //private string m_requestTexture = "0003/"; 66 //private string m_requestTexture = "0003/";
67 private string m_notecardUpdatePath = "0004/"; 67 private string m_notecardUpdatePath = "0004/";
68 private string m_notecardTaskUpdatePath = "0005/"; 68 private string m_notecardTaskUpdatePath = "0005/";
69 private string m_fetchInventoryPath = "0006/";
69 70
70 //private string eventQueue = "0100/"; 71 //private string eventQueue = "0100/";
71 private BaseHttpServer m_httpListener; 72 private BaseHttpServer m_httpListener;
@@ -110,10 +111,17 @@ namespace OpenSim.Region.Capabilities
110 capsBase + m_newInventory, 111 capsBase + m_newInventory,
111 NewAgentInventoryRequest)); 112 NewAgentInventoryRequest));
112 113
114 // m_httpListener.AddStreamHandler(
115 // new LLSDStreamhandler<LLSDFetchInventoryDescendents, LLSDInventoryDescendents>("POST",
116 // capsBase + m_fetchInventory,
117 // FetchInventory));
118
119
113 AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest); 120 AddLegacyCapsHandler(m_httpListener, m_requestPath, CapsRequest);
114 //AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture); 121 //AddLegacyCapsHandler(m_httpListener, m_requestTexture , RequestTexture);
115 AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory); 122 AddLegacyCapsHandler(m_httpListener, m_notecardUpdatePath, NoteCardAgentInventory);
116 AddLegacyCapsHandler(m_httpListener, m_notecardTaskUpdatePath, ScriptTaskInventory); 123 AddLegacyCapsHandler(m_httpListener, m_notecardTaskUpdatePath, ScriptTaskInventory);
124 AddLegacyCapsHandler(m_httpListener, m_fetchInventoryPath, FetchInventoryRequest);
117 } 125 }
118 catch (Exception e) 126 catch (Exception e)
119 { 127 {
@@ -160,9 +168,37 @@ namespace OpenSim.Region.Capabilities
160 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath; 168 caps.UpdateNotecardAgentInventory = capsBaseUrl + m_notecardUpdatePath;
161 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath; 169 caps.UpdateScriptAgentInventory = capsBaseUrl + m_notecardUpdatePath;
162 caps.UpdateScriptTaskInventory = capsBaseUrl + m_notecardTaskUpdatePath; 170 caps.UpdateScriptTaskInventory = capsBaseUrl + m_notecardTaskUpdatePath;
171 caps.FetchInventoryDescendents = capsBaseUrl + m_fetchInventoryPath;
163 return caps; 172 return caps;
164 } 173 }
165 174
175 public string FetchInventoryRequest(string request, string path, string param)
176 {
177 request = request.Replace("<llsd><map><key>folders</key><array>", "<llsd>");
178 request = request.Replace("</map></array></map>", "</map>");
179
180 //Console.WriteLine("inventory request " + request);
181 Hashtable hash = (Hashtable)LLSD.LLSDDeserialize(Helpers.StringToField(request));
182 LLSDFetchInventoryDescendents llsdRequest = new LLSDFetchInventoryDescendents();
183 LLSDHelpers.DeserialiseLLSDMap(hash, llsdRequest);
184 LLSDInventoryDescendents reply = FetchInventory(llsdRequest);
185 string response = LLSDHelpers.SerialiseLLSDReply(reply);
186 return response;
187 }
188
189 private LLSDInventoryDescendents FetchInventory(LLSDFetchInventoryDescendents invFetch)
190 {
191 LLSDInventoryDescendents reply = new LLSDInventoryDescendents();
192 LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents();
193 contents.agent___id = m_agentID;
194 contents.owner___id = m_agentID;
195 contents.folder___id = invFetch.folder_id;
196 contents.version = 1;
197 contents.descendents = 0;
198 reply.folders.Array.Add(contents);
199 return reply;
200 }
201
166 /// <summary> 202 /// <summary>
167 /// 203 ///
168 /// </summary> 204 /// </summary>
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
index 6bec162..dc866ba 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDCapsDetails.cs
@@ -42,6 +42,7 @@ namespace OpenSim.Region.Capabilities
42 public string UpdateScriptAgentInventory = String.Empty; 42 public string UpdateScriptAgentInventory = String.Empty;
43 public string UpdateScriptTaskInventory = String.Empty; 43 public string UpdateScriptTaskInventory = String.Empty;
44 // public string ParcelVoiceInfoRequest = String.Empty; 44 // public string ParcelVoiceInfoRequest = String.Empty;
45 public string FetchInventoryDescendents = String.Empty;
45 46
46 public LLSDCapsDetails() 47 public LLSDCapsDetails()
47 { 48 {
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
index 28f838d..193927d 100644
--- a/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDHelpers.cs
@@ -66,14 +66,18 @@ namespace OpenSim.Region.Capabilities
66 if (fieldAttributes.Length > 0) 66 if (fieldAttributes.Length > 0)
67 { 67 {
68 writer.WriteStartElement(String.Empty, "key", String.Empty); 68 writer.WriteStartElement(String.Empty, "key", String.Empty);
69 writer.WriteString(fields[i].Name); 69 string fieldName = fields[i].Name;
70 fieldName = fieldName.Replace("___", "-");
71 writer.WriteString(fieldName);
70 writer.WriteEndElement(); 72 writer.WriteEndElement();
71 SerializeLLSDType(writer, fieldValue); 73 SerializeLLSDType(writer, fieldValue);
72 } 74 }
73 else 75 else
74 { 76 {
75 writer.WriteStartElement(String.Empty, "key", String.Empty); 77 writer.WriteStartElement(String.Empty, "key", String.Empty);
76 writer.WriteString(fields[i].Name); 78 string fieldName = fields[i].Name;
79 fieldName = fieldName.Replace("___", "-");
80 writer.WriteString(fieldName);
77 writer.WriteEndElement(); 81 writer.WriteEndElement();
78 LLSD.LLSDWriteOne(writer, fieldValue); 82 LLSD.LLSDWriteOne(writer, fieldValue);
79 // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement( 83 // libsecondlife.StructuredData.LLSDParser.SerializeXmlElement(
@@ -118,7 +122,9 @@ namespace OpenSim.Region.Capabilities
118 IDictionaryEnumerator enumerator = llsd.GetEnumerator(); 122 IDictionaryEnumerator enumerator = llsd.GetEnumerator();
119 while (enumerator.MoveNext()) 123 while (enumerator.MoveNext())
120 { 124 {
121 FieldInfo field = myType.GetField((string) enumerator.Key); 125 string keyName = (string)enumerator.Key;
126 keyName = keyName.Replace("-","_");
127 FieldInfo field = myType.GetField(keyName);
122 if (field != null) 128 if (field != null)
123 { 129 {
124 // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap) 130 // if (enumerator.Value is libsecondlife.StructuredData.LLSDMap)
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs
new file mode 100644
index 0000000..2d1d441
--- /dev/null
+++ b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs
@@ -0,0 +1,83 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using libsecondlife;
5
6namespace OpenSim.Region.Capabilities
7{
8 [LLSDMap]
9 public class LLSDInventoryItem
10 {
11 public LLUUID parent_id;
12
13 public LLUUID asset_id;
14 public LLUUID item_id;
15
16 public string type;
17 public string inv_type;
18 public int flags;
19
20 public LLSDSaleInfo sale_info;
21 public string name;
22 public string desc;
23 public int created_at;
24
25 }
26
27 [LLSDMap]
28 public class LLSDPermissions
29 {
30 public LLUUID creator_id;
31 public LLUUID owner_id;
32 public LLUUID group_id;
33 public int base_mask;
34 public int owner_mask;
35 public int group_mask;
36 public int everyone_mask;
37 public int next_owner_mask;
38 public bool is_owner_group;
39 }
40
41 [LLSDMap]
42 public class LLSDSaleInfo
43 {
44 public int sale_price;
45 public string sale_type;
46 }
47
48 /* [LLSDMap]
49 public class LLSDFolderItem
50 {
51 public LLUUID folder_id;
52 public LLUUID parent_id;
53 public int type;
54 public string name;
55 }*/
56
57 [LLSDMap]
58 public class LLSDInventoryDescendents
59 {
60 public LLSDArray folders= new LLSDArray();
61 }
62
63 [LLSDMap]
64 public class LLSDFetchInventoryDescendents
65 {
66 public LLUUID folder_id;
67 public LLUUID owner_id;
68 public int sort_order;
69 public bool fetch_folders;
70 public bool fetch_items;
71 }
72
73 [LLSDMap]
74 public class LLSDInventoryFolderContents
75 {
76 public LLUUID agent___id;
77 public int descendents;
78 public LLUUID folder___id; // the (three "_") "___" so the serialising knows to change this to a "-"
79 public LLSDArray items = new LLSDArray();
80 public LLUUID owner___id;
81 public int version;
82 }
83}