diff options
Part 2 of fixing inventory for client 1.19.1 (RC), inventory items should now show up.
Most likely still some problems and most like needs some more work (and still a couple of things to finish off).
Diffstat (limited to 'OpenSim/Framework/Communications/Capabilities')
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/Caps.cs | 52 | ||||
-rw-r--r-- | OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs | 30 |
2 files changed, 65 insertions, 17 deletions
diff --git a/OpenSim/Framework/Communications/Capabilities/Caps.cs b/OpenSim/Framework/Communications/Capabilities/Caps.cs index 53cb955..d38af7c 100644 --- a/OpenSim/Framework/Communications/Capabilities/Caps.cs +++ b/OpenSim/Framework/Communications/Capabilities/Caps.cs | |||
@@ -52,6 +52,9 @@ namespace OpenSim.Region.Capabilities | |||
52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, | 52 | public delegate void TaskScriptUpdatedCallback(LLUUID userID, LLUUID itemID, LLUUID primID, |
53 | bool isScriptRunning, byte[] data); | 53 | bool isScriptRunning, byte[] data); |
54 | 54 | ||
55 | public delegate List<InventoryItemBase> FetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID, | ||
56 | bool fetchFolders, bool fetchItems, int sortOrder); | ||
57 | |||
55 | public class Caps | 58 | public class Caps |
56 | { | 59 | { |
57 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 60 | private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
@@ -81,6 +84,9 @@ namespace OpenSim.Region.Capabilities | |||
81 | public NewInventoryItem AddNewInventoryItem = null; | 84 | public NewInventoryItem AddNewInventoryItem = null; |
82 | public ItemUpdatedCallback ItemUpdatedCall = null; | 85 | public ItemUpdatedCallback ItemUpdatedCall = null; |
83 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; | 86 | public TaskScriptUpdatedCallback TaskScriptUpdatedCall = null; |
87 | // | ||
88 | public FetchInventoryDescendentsCAPS CAPSFetchInventoryDescendents = null; | ||
89 | |||
84 | 90 | ||
85 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, | 91 | public Caps(AssetCache assetCache, BaseHttpServer httpServer, string httpListen, uint httpPort, string capsPath, |
86 | LLUUID agent, bool dumpAssetsToFile) | 92 | LLUUID agent, bool dumpAssetsToFile) |
@@ -191,14 +197,56 @@ namespace OpenSim.Region.Capabilities | |||
191 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); | 197 | LLSDInventoryDescendents reply = new LLSDInventoryDescendents(); |
192 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); | 198 | LLSDInventoryFolderContents contents = new LLSDInventoryFolderContents(); |
193 | contents.agent___id = m_agentID; | 199 | contents.agent___id = m_agentID; |
194 | contents.owner___id = m_agentID; | 200 | contents.owner___id = invFetch.owner_id; |
195 | contents.folder___id = invFetch.folder_id; | 201 | contents.folder___id = invFetch.folder_id; |
196 | contents.version = 1; | 202 | contents.version = 1; //FixMe |
197 | contents.descendents = 0; | 203 | contents.descendents = 0; |
198 | reply.folders.Array.Add(contents); | 204 | reply.folders.Array.Add(contents); |
205 | List<InventoryItemBase> itemList = null; | ||
206 | if (CAPSFetchInventoryDescendents != null) | ||
207 | { | ||
208 | itemList = CAPSFetchInventoryDescendents(m_agentID, invFetch.folder_id, invFetch.owner_id, invFetch.fetch_folders, invFetch.fetch_items, invFetch.sort_order); | ||
209 | } | ||
210 | if (itemList != null) | ||
211 | { | ||
212 | foreach (InventoryItemBase invItem in itemList) | ||
213 | { | ||
214 | contents.items.Array.Add(ConvertInventoryItem(invItem)); | ||
215 | } | ||
216 | } | ||
217 | contents.descendents = contents.items.Array.Count; | ||
199 | return reply; | 218 | return reply; |
200 | } | 219 | } |
201 | 220 | ||
221 | private LLSDInventoryItem ConvertInventoryItem(InventoryItemBase invItem) | ||
222 | { | ||
223 | LLSDInventoryItem llsdItem = new LLSDInventoryItem(); | ||
224 | llsdItem.asset_id = invItem.assetID; | ||
225 | llsdItem.created_at = 1000; | ||
226 | llsdItem.desc = invItem.inventoryDescription; | ||
227 | llsdItem.flags = 0; | ||
228 | llsdItem.item_id = invItem.inventoryID; | ||
229 | llsdItem.name = invItem.inventoryName; | ||
230 | llsdItem.parent_id = invItem.parentFolderID; | ||
231 | llsdItem.type = Enum.GetName(typeof(AssetType), invItem.assetType).ToLower(); | ||
232 | llsdItem.inv_type = Enum.GetName(typeof(InventoryType), invItem.invType).ToLower(); | ||
233 | llsdItem.permissions = new LLSDPermissions(); | ||
234 | llsdItem.permissions.creator_id = invItem.creatorsID; | ||
235 | llsdItem.permissions.base_mask = (int)invItem.inventoryBasePermissions; | ||
236 | llsdItem.permissions.everyone_mask = (int)invItem.inventoryEveryOnePermissions; | ||
237 | llsdItem.permissions.group_id = LLUUID.Zero; | ||
238 | llsdItem.permissions.group_mask = 0; | ||
239 | llsdItem.permissions.is_owner_group = false; | ||
240 | llsdItem.permissions.next_owner_mask = (int)invItem.inventoryNextPermissions; | ||
241 | llsdItem.permissions.owner_id = m_agentID; // FixMe | ||
242 | llsdItem.permissions.owner_mask = (int)invItem.inventoryCurrentPermissions; | ||
243 | llsdItem.sale_info = new LLSDSaleInfo(); | ||
244 | llsdItem.sale_info.sale_price = 10; | ||
245 | llsdItem.sale_info.sale_type = "not"; | ||
246 | |||
247 | return llsdItem; | ||
248 | } | ||
249 | |||
202 | /// <summary> | 250 | /// <summary> |
203 | /// | 251 | /// |
204 | /// </summary> | 252 | /// </summary> |
diff --git a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs index 2d1d441..784b41c 100644 --- a/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs +++ b/OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs | |||
@@ -4,15 +4,15 @@ using System.Text; | |||
4 | using libsecondlife; | 4 | using libsecondlife; |
5 | 5 | ||
6 | namespace OpenSim.Region.Capabilities | 6 | namespace OpenSim.Region.Capabilities |
7 | { | 7 | { |
8 | [LLSDMap] | 8 | [LLSDMap] |
9 | public class LLSDInventoryItem | 9 | public class LLSDInventoryItem |
10 | { | 10 | { |
11 | public LLUUID parent_id; | 11 | public LLUUID parent_id; |
12 | 12 | ||
13 | public LLUUID asset_id; | 13 | public LLUUID asset_id; |
14 | public LLUUID item_id; | 14 | public LLUUID item_id; |
15 | 15 | public LLSDPermissions permissions; | |
16 | public string type; | 16 | public string type; |
17 | public string inv_type; | 17 | public string inv_type; |
18 | public int flags; | 18 | public int flags; |
@@ -45,19 +45,19 @@ namespace OpenSim.Region.Capabilities | |||
45 | public string sale_type; | 45 | public string sale_type; |
46 | } | 46 | } |
47 | 47 | ||
48 | /* [LLSDMap] | 48 | /* [LLSDMap] |
49 | public class LLSDFolderItem | 49 | public class LLSDFolderItem |
50 | { | 50 | { |
51 | public LLUUID folder_id; | 51 | public LLUUID folder_id; |
52 | public LLUUID parent_id; | 52 | public LLUUID parent_id; |
53 | public int type; | 53 | public int type; |
54 | public string name; | 54 | public string name; |
55 | }*/ | 55 | }*/ |
56 | 56 | ||
57 | [LLSDMap] | 57 | [LLSDMap] |
58 | public class LLSDInventoryDescendents | 58 | public class LLSDInventoryDescendents |
59 | { | 59 | { |
60 | public LLSDArray folders= new LLSDArray(); | 60 | public LLSDArray folders = new LLSDArray(); |
61 | } | 61 | } |
62 | 62 | ||
63 | [LLSDMap] | 63 | [LLSDMap] |
@@ -73,11 +73,11 @@ namespace OpenSim.Region.Capabilities | |||
73 | [LLSDMap] | 73 | [LLSDMap] |
74 | public class LLSDInventoryFolderContents | 74 | public class LLSDInventoryFolderContents |
75 | { | 75 | { |
76 | public LLUUID agent___id; | 76 | public LLUUID agent___id; // the (three "_") "___" so the serialising knows to change this to a "-" |
77 | public int descendents; | 77 | public int descendents; |
78 | public LLUUID folder___id; // the (three "_") "___" so the serialising knows to change this to a "-" | 78 | public LLUUID folder___id; //as LL can't decide if they are going to use "_" or "-" to separate words in the field names |
79 | public LLSDArray items = new LLSDArray(); | 79 | public LLSDArray items = new LLSDArray(); |
80 | public LLUUID owner___id; | 80 | public LLUUID owner___id; // and of course we can't have field names with "-" in |
81 | public int version; | 81 | public int version; |
82 | } | 82 | } |
83 | } | 83 | } |