aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Communications
diff options
context:
space:
mode:
authorMW2008-03-15 12:53:03 +0000
committerMW2008-03-15 12:53:03 +0000
commitc04899b60ab15c7614108ac61fbf1f22fccab5a7 (patch)
tree7fa4880b501f52bf30da23859543206516bb6579 /OpenSim/Framework/Communications
parentPart 1 of making inventory work again in the 1.19.1 (RC) client. Implemented ... (diff)
downloadopensim-SC-c04899b60ab15c7614108ac61fbf1f22fccab5a7.zip
opensim-SC-c04899b60ab15c7614108ac61fbf1f22fccab5a7.tar.gz
opensim-SC-c04899b60ab15c7614108ac61fbf1f22fccab5a7.tar.bz2
opensim-SC-c04899b60ab15c7614108ac61fbf1f22fccab5a7.tar.xz
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')
-rw-r--r--OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs60
-rw-r--r--OpenSim/Framework/Communications/Capabilities/Caps.cs52
-rw-r--r--OpenSim/Framework/Communications/Capabilities/LLSDInventoryItem.cs30
3 files changed, 125 insertions, 17 deletions
diff --git a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
index 455f722..b066fdc 100644
--- a/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
+++ b/OpenSim/Framework/Communications/Cache/UserProfileCacheService.cs
@@ -254,6 +254,66 @@ namespace OpenSim.Framework.Communications.Cache
254 folderID, remoteClient.Name); 254 folderID, remoteClient.Name);
255 } 255 }
256 256
257 public List<InventoryItemBase> HandleFetchInventoryDescendentsCAPS(LLUUID agentID, LLUUID folderID, LLUUID ownerID,
258 bool fetchFolders, bool fetchItems, int sortOrder)
259 {
260 // XXX We're not handling sortOrder yet!
261 // with CAPS we are only return items in the folders at the moment
262 // need to find the format that sub folder details are sent in
263 // if (fetchItems)
264 // {
265 InventoryFolderImpl fold = null;
266 if (folderID == libraryRoot.folderID)
267 {
268 return libraryRoot.RequestListOfItems();
269 }
270
271 if ((fold = libraryRoot.HasSubFolder(folderID)) != null)
272 {
273 return fold.RequestListOfItems();
274 }
275
276 CachedUserInfo userProfile;
277 if (m_userProfiles.TryGetValue(agentID, out userProfile))
278 {
279 if (userProfile.RootFolder != null)
280 {
281 if (userProfile.RootFolder.folderID == folderID)
282 {
283 return userProfile.RootFolder.RequestListOfItems();
284 }
285 else
286 {
287 if ((fold = userProfile.RootFolder.HasSubFolder(folderID)) != null)
288 {
289 return fold.RequestListOfItems();
290 }
291 }
292 }
293 else
294 {
295 m_log.ErrorFormat("[INVENTORYCACHE]: Could not find root folder for user {0}", agentID.ToString());
296
297 return new List<InventoryItemBase>(); ;
298 }
299 }
300 else
301 {
302 m_log.ErrorFormat("[INVENTORYCACHE]: " +
303 "Could not find user profile for {0} for folder {1}",
304 agentID.ToString(), folderID);
305 return new List<InventoryItemBase>();
306 }
307
308 // If we've reached this point then we couldn't find the folder, even though the client thinks
309 // it exists
310 m_log.ErrorFormat("[INVENTORYCACHE]: " +
311 "Could not find folder {0} for user {1}",
312 folderID, agentID.ToString());
313 // }
314 return new List<InventoryItemBase>();
315 }
316
257 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID) 317 public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, LLUUID folderID)
258 { 318 {
259// m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}", 319// m_log.InfoFormat("[INVENTORYCACHE]: Purging folder {0} for {1} uuid {2}",
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;
4using libsecondlife; 4using libsecondlife;
5 5
6namespace OpenSim.Region.Capabilities 6namespace 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}