diff options
author | Jeff Ames | 2008-05-16 01:22:11 +0000 |
---|---|---|
committer | Jeff Ames | 2008-05-16 01:22:11 +0000 |
commit | 65c5efe43b68700bad94076d4cd421160203c5de (patch) | |
tree | 589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |
parent | Thank you very much, mjm for : (diff) | |
download | opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.zip opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2 opensim-SC_OLD-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz |
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Communications/Cache/CachedUserInfo.cs')
-rw-r--r-- | OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs index 218fd5a..f40f078 100644 --- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs +++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs | |||
@@ -36,55 +36,55 @@ using log4net; | |||
36 | namespace OpenSim.Framework.Communications.Cache | 36 | namespace OpenSim.Framework.Communications.Cache |
37 | { | 37 | { |
38 | internal delegate void AddItemDelegate(InventoryItemBase itemInfo); | 38 | internal delegate void AddItemDelegate(InventoryItemBase itemInfo); |
39 | internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); | 39 | internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); |
40 | internal delegate void DeleteItemDelegate(LLUUID itemID); | 40 | internal delegate void DeleteItemDelegate(LLUUID itemID); |
41 | 41 | ||
42 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); | 42 | internal delegate void CreateFolderDelegate(string folderName, LLUUID folderID, ushort folderType, LLUUID parentID); |
43 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); | 43 | internal delegate void MoveFolderDelegate(LLUUID folderID, LLUUID parentID); |
44 | internal delegate void PurgeFolderDelegate(LLUUID folderID); | 44 | internal delegate void PurgeFolderDelegate(LLUUID folderID); |
45 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); | 45 | internal delegate void UpdateFolderDelegate(string name, LLUUID folderID, ushort type, LLUUID parentID); |
46 | 46 | ||
47 | internal delegate void SendInventoryDescendentsDelegate( | 47 | internal delegate void SendInventoryDescendentsDelegate( |
48 | IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems); | 48 | IClientAPI client, LLUUID folderID, bool fetchFolders, bool fetchItems); |
49 | 49 | ||
50 | /// <summary> | 50 | /// <summary> |
51 | /// Stores user profile and inventory data received from backend services for a particular user. | 51 | /// Stores user profile and inventory data received from backend services for a particular user. |
52 | /// </summary> | 52 | /// </summary> |
53 | public class CachedUserInfo | 53 | public class CachedUserInfo |
54 | { | 54 | { |
55 | private static readonly ILog m_log | 55 | private static readonly ILog m_log |
56 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 56 | = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
57 | 57 | ||
58 | /// <summary> | 58 | /// <summary> |
59 | /// The comms manager holds references to services (user, grid, inventory, etc.) | 59 | /// The comms manager holds references to services (user, grid, inventory, etc.) |
60 | /// </summary> | 60 | /// </summary> |
61 | private readonly CommunicationsManager m_commsManager; | 61 | private readonly CommunicationsManager m_commsManager; |
62 | 62 | ||
63 | public UserProfileData UserProfile { get { return m_userProfile; } } | 63 | public UserProfileData UserProfile { get { return m_userProfile; } } |
64 | private readonly UserProfileData m_userProfile; | 64 | private readonly UserProfileData m_userProfile; |
65 | 65 | ||
66 | /// <summary> | 66 | /// <summary> |
67 | /// Has we received the user's inventory from the inventory service? | 67 | /// Has we received the user's inventory from the inventory service? |
68 | /// </summary> | 68 | /// </summary> |
69 | private bool m_hasInventory; | 69 | private bool m_hasInventory; |
70 | 70 | ||
71 | /// <summary> | 71 | /// <summary> |
72 | /// Inventory requests waiting for receipt of this user's inventory from the inventory service. | 72 | /// Inventory requests waiting for receipt of this user's inventory from the inventory service. |
73 | /// </summary> | 73 | /// </summary> |
74 | private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>(); | 74 | private readonly IList<IInventoryRequest> m_pendingRequests = new List<IInventoryRequest>(); |
75 | 75 | ||
76 | /// <summary> | 76 | /// <summary> |
77 | /// Has this user info object yet received its inventory information from the invetnroy service? | 77 | /// Has this user info object yet received its inventory information from the invetnroy service? |
78 | /// </summary> | 78 | /// </summary> |
79 | public bool HasInventory { get { return m_hasInventory; } } | 79 | public bool HasInventory { get { return m_hasInventory; } } |
80 | 80 | ||
81 | private InventoryFolderImpl m_rootFolder; | 81 | private InventoryFolderImpl m_rootFolder; |
82 | public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } | 82 | public InventoryFolderImpl RootFolder { get { return m_rootFolder; } } |
83 | 83 | ||
84 | /// <summary> | 84 | /// <summary> |
85 | /// FIXME: This could be contained within a local variable - it doesn't need to be a field | 85 | /// FIXME: This could be contained within a local variable - it doesn't need to be a field |
86 | /// </summary> | 86 | /// </summary> |
87 | private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders | 87 | private IDictionary<LLUUID, IList<InventoryFolderImpl>> pendingCategorizationFolders |
88 | = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); | 88 | = new Dictionary<LLUUID, IList<InventoryFolderImpl>>(); |
89 | 89 | ||
90 | /// <summary> | 90 | /// <summary> |
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
97 | m_commsManager = commsManager; | 97 | m_commsManager = commsManager; |
98 | m_userProfile = userProfile; | 98 | m_userProfile = userProfile; |
99 | } | 99 | } |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// This allows a request to be added to be processed once we receive a user's inventory | 102 | /// This allows a request to be added to be processed once we receive a user's inventory |
103 | /// from the inventory service. If we already have the inventory, the request | 103 | /// from the inventory service. If we already have the inventory, the request |
@@ -118,7 +118,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | /// <summary> | 122 | /// <summary> |
123 | /// Store a folder pending arrival of its parent | 123 | /// Store a folder pending arrival of its parent |
124 | /// </summary> | 124 | /// </summary> |
@@ -126,7 +126,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
126 | private void AddPendingFolder(InventoryFolderImpl folder) | 126 | private void AddPendingFolder(InventoryFolderImpl folder) |
127 | { | 127 | { |
128 | LLUUID parentFolderId = folder.ParentID; | 128 | LLUUID parentFolderId = folder.ParentID; |
129 | 129 | ||
130 | if (pendingCategorizationFolders.ContainsKey(parentFolderId)) | 130 | if (pendingCategorizationFolders.ContainsKey(parentFolderId)) |
131 | { | 131 | { |
132 | pendingCategorizationFolders[parentFolderId].Add(folder); | 132 | pendingCategorizationFolders[parentFolderId].Add(folder); |
@@ -135,11 +135,11 @@ namespace OpenSim.Framework.Communications.Cache | |||
135 | { | 135 | { |
136 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); | 136 | IList<InventoryFolderImpl> folders = new List<InventoryFolderImpl>(); |
137 | folders.Add(folder); | 137 | folders.Add(folder); |
138 | 138 | ||
139 | pendingCategorizationFolders[parentFolderId] = folders; | 139 | pendingCategorizationFolders[parentFolderId] = folders; |
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | /// <summary> | 143 | /// <summary> |
144 | /// Add any pending folders which were received before the given folder | 144 | /// Add any pending folders which were received before the given folder |
145 | /// </summary> | 145 | /// </summary> |
@@ -155,18 +155,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
155 | // m_log.DebugFormat( | 155 | // m_log.DebugFormat( |
156 | // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", | 156 | // "[INVENTORY CACHE]: Resolving pending received folder {0} {1} into {2} {3}", |
157 | // folder.name, folder.folderID, parent.name, parent.folderID); | 157 | // folder.name, folder.folderID, parent.name, parent.folderID); |
158 | 158 | ||
159 | lock (newFolder.SubFolders) | 159 | lock (newFolder.SubFolders) |
160 | { | 160 | { |
161 | if (!newFolder.SubFolders.ContainsKey(folder.ID)) | 161 | if (!newFolder.SubFolders.ContainsKey(folder.ID)) |
162 | { | 162 | { |
163 | newFolder.SubFolders.Add(folder.ID, folder); | 163 | newFolder.SubFolders.Add(folder.ID, folder); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | } | 168 | } |
169 | 169 | ||
170 | /// <summary> | 170 | /// <summary> |
171 | /// Callback invoked when the inventory is received from an async request to the inventory service | 171 | /// Callback invoked when the inventory is received from an async request to the inventory service |
172 | /// </summary> | 172 | /// </summary> |
@@ -177,12 +177,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
177 | // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these | 177 | // FIXME: Exceptions thrown upwards never appear on the console. Could fix further up if these |
178 | // are simply being swallowed | 178 | // are simply being swallowed |
179 | try | 179 | try |
180 | { | 180 | { |
181 | foreach (InventoryFolderImpl folder in folders) | 181 | foreach (InventoryFolderImpl folder in folders) |
182 | { | 182 | { |
183 | FolderReceive(folder); | 183 | FolderReceive(folder); |
184 | } | 184 | } |
185 | 185 | ||
186 | foreach (InventoryItemBase item in items) | 186 | foreach (InventoryItemBase item in items) |
187 | { | 187 | { |
188 | ItemReceive(item); | 188 | ItemReceive(item); |
@@ -191,15 +191,15 @@ namespace OpenSim.Framework.Communications.Cache | |||
191 | catch (Exception e) | 191 | catch (Exception e) |
192 | { | 192 | { |
193 | m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e); | 193 | m_log.ErrorFormat("[INVENTORY CACHE]: Error processing inventory received from inventory service, {0}", e); |
194 | } | 194 | } |
195 | 195 | ||
196 | // Deal with pending requests | 196 | // Deal with pending requests |
197 | lock (m_pendingRequests) | 197 | lock (m_pendingRequests) |
198 | { | 198 | { |
199 | // We're going to change inventory status within the lock to avoid a race condition | 199 | // We're going to change inventory status within the lock to avoid a race condition |
200 | // where requests are processed after the AddRequest() method has been called. | 200 | // where requests are processed after the AddRequest() method has been called. |
201 | m_hasInventory = true; | 201 | m_hasInventory = true; |
202 | 202 | ||
203 | foreach (IInventoryRequest request in m_pendingRequests) | 203 | foreach (IInventoryRequest request in m_pendingRequests) |
204 | { | 204 | { |
205 | request.Execute(); | 205 | request.Execute(); |
@@ -215,7 +215,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
215 | private void FolderReceive(InventoryFolderImpl newFolder) | 215 | private void FolderReceive(InventoryFolderImpl newFolder) |
216 | { | 216 | { |
217 | // m_log.DebugFormat( | 217 | // m_log.DebugFormat( |
218 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", | 218 | // "[INVENTORY CACHE]: Received folder {0} {1} for user {2}", |
219 | // folderInfo.Name, folderInfo.ID, userID); | 219 | // folderInfo.Name, folderInfo.ID, userID); |
220 | 220 | ||
221 | if (RootFolder == null) | 221 | if (RootFolder == null) |
@@ -232,7 +232,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
232 | else | 232 | else |
233 | { | 233 | { |
234 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID); | 234 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(newFolder.ParentID); |
235 | 235 | ||
236 | if (parentFolder != null) | 236 | if (parentFolder != null) |
237 | { | 237 | { |
238 | lock (parentFolder.SubFolders) | 238 | lock (parentFolder.SubFolders) |
@@ -252,44 +252,44 @@ namespace OpenSim.Framework.Communications.Cache | |||
252 | else | 252 | else |
253 | { | 253 | { |
254 | AddPendingFolder(newFolder); | 254 | AddPendingFolder(newFolder); |
255 | } | 255 | } |
256 | } | 256 | } |
257 | 257 | ||
258 | ResolvePendingFolders(newFolder); | 258 | ResolvePendingFolders(newFolder); |
259 | } | 259 | } |
260 | 260 | ||
261 | /// <summary> | 261 | /// <summary> |
262 | /// Callback invoked when an item is received from an async request to the inventory service. | 262 | /// Callback invoked when an item is received from an async request to the inventory service. |
263 | /// | 263 | /// |
264 | /// We're assuming here that items are always received after all the folders | 264 | /// We're assuming here that items are always received after all the folders |
265 | /// received. | 265 | /// received. |
266 | /// </summary> | 266 | /// </summary> |
267 | /// <param name="folderInfo"></param> | 267 | /// <param name="folderInfo"></param> |
268 | private void ItemReceive(InventoryItemBase itemInfo) | 268 | private void ItemReceive(InventoryItemBase itemInfo) |
269 | { | 269 | { |
270 | // m_log.DebugFormat( | 270 | // m_log.DebugFormat( |
271 | // "[INVENTORY CACHE]: Received item {0} {1} for user {2}", | 271 | // "[INVENTORY CACHE]: Received item {0} {1} for user {2}", |
272 | // itemInfo.Name, itemInfo.ID, userID); | 272 | // itemInfo.Name, itemInfo.ID, userID); |
273 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); | 273 | InventoryFolderImpl folder = RootFolder.FindFolder(itemInfo.Folder); |
274 | 274 | ||
275 | if (null == folder) | 275 | if (null == folder) |
276 | { | 276 | { |
277 | m_log.WarnFormat( | 277 | m_log.WarnFormat( |
278 | "Received item {0} {1} but its folder {2} does not exist", | 278 | "Received item {0} {1} but its folder {2} does not exist", |
279 | itemInfo.Name, itemInfo.ID, itemInfo.Folder); | 279 | itemInfo.Name, itemInfo.ID, itemInfo.Folder); |
280 | 280 | ||
281 | return; | 281 | return; |
282 | } | 282 | } |
283 | 283 | ||
284 | lock (folder.Items) | 284 | lock (folder.Items) |
285 | { | 285 | { |
286 | folder.Items[itemInfo.ID] = itemInfo; | 286 | folder.Items[itemInfo.ID] = itemInfo; |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | /// <summary> | 290 | /// <summary> |
291 | /// Create a folder in this agent's inventory. | 291 | /// Create a folder in this agent's inventory. |
292 | /// | 292 | /// |
293 | /// If the inventory service has not yet delievered the inventory | 293 | /// If the inventory service has not yet delievered the inventory |
294 | /// for this user then the request will be queued. | 294 | /// for this user then the request will be queued. |
295 | /// </summary> | 295 | /// </summary> |
@@ -299,20 +299,20 @@ namespace OpenSim.Framework.Communications.Cache | |||
299 | { | 299 | { |
300 | // m_log.DebugFormat( | 300 | // m_log.DebugFormat( |
301 | // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId); | 301 | // "[AGENT INVENTORY]: Creating inventory folder {0} {1} for {2} {3}", folderID, folderName, remoteClient.Name, remoteClient.AgentId); |
302 | 302 | ||
303 | if (HasInventory) | 303 | if (HasInventory) |
304 | { | 304 | { |
305 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); | 305 | InventoryFolderImpl parentFolder = RootFolder.FindFolder(parentID); |
306 | 306 | ||
307 | if (null == parentFolder) | 307 | if (null == parentFolder) |
308 | { | 308 | { |
309 | m_log.WarnFormat( | 309 | m_log.WarnFormat( |
310 | "[AGENT INVENTORY]: Tried to create folder {0} {1} but the parent {2} does not exist", | 310 | "[AGENT INVENTORY]: Tried to create folder {0} {1} but the parent {2} does not exist", |
311 | folderName, folderID, parentID); | 311 | folderName, folderID, parentID); |
312 | 312 | ||
313 | return false; | 313 | return false; |
314 | } | 314 | } |
315 | 315 | ||
316 | InventoryFolderImpl createdFolder = parentFolder.CreateChildFolder(folderID, folderName, folderType); | 316 | InventoryFolderImpl createdFolder = parentFolder.CreateChildFolder(folderID, folderName, folderType); |
317 | 317 | ||
318 | if (createdFolder != null) | 318 | if (createdFolder != null) |
@@ -324,17 +324,17 @@ namespace OpenSim.Framework.Communications.Cache | |||
324 | createdBaseFolder.ParentID = createdFolder.ParentID; | 324 | createdBaseFolder.ParentID = createdFolder.ParentID; |
325 | createdBaseFolder.Type = createdFolder.Type; | 325 | createdBaseFolder.Type = createdFolder.Type; |
326 | createdBaseFolder.Version = createdFolder.Version; | 326 | createdBaseFolder.Version = createdFolder.Version; |
327 | 327 | ||
328 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); | 328 | m_commsManager.InventoryService.AddFolder(createdBaseFolder); |
329 | 329 | ||
330 | return true; | 330 | return true; |
331 | } | 331 | } |
332 | else | 332 | else |
333 | { | 333 | { |
334 | m_log.WarnFormat( | 334 | m_log.WarnFormat( |
335 | "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists", | 335 | "[AGENT INVENTORY]: Tried to create folder {0} {1} but the folder already exists", |
336 | folderName, folderID); | 336 | folderName, folderID); |
337 | 337 | ||
338 | return false; | 338 | return false; |
339 | } | 339 | } |
340 | } | 340 | } |
@@ -344,22 +344,22 @@ namespace OpenSim.Framework.Communications.Cache | |||
344 | new InventoryRequest( | 344 | new InventoryRequest( |
345 | Delegate.CreateDelegate(typeof(CreateFolderDelegate), this, "CreateFolder"), | 345 | Delegate.CreateDelegate(typeof(CreateFolderDelegate), this, "CreateFolder"), |
346 | new object[] { folderName, folderID, folderType, parentID })); | 346 | new object[] { folderName, folderID, folderType, parentID })); |
347 | 347 | ||
348 | return true; | 348 | return true; |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | /// <summary> | 352 | /// <summary> |
353 | /// Handle a client request to update the inventory folder | 353 | /// Handle a client request to update the inventory folder |
354 | /// | 354 | /// |
355 | /// If the inventory service has not yet delievered the inventory | 355 | /// If the inventory service has not yet delievered the inventory |
356 | /// for this user then the request will be queued. | 356 | /// for this user then the request will be queued. |
357 | /// | 357 | /// |
358 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE | 358 | /// FIXME: We call add new inventory folder because in the data layer, we happen to use an SQL REPLACE |
359 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, | 359 | /// so this will work to rename an existing folder. Needless to say, to rely on this is very confusing, |
360 | /// and needs to be changed. | 360 | /// and needs to be changed. |
361 | /// </summary> | 361 | /// </summary> |
362 | /// | 362 | /// |
363 | /// <param name="folderID"></param> | 363 | /// <param name="folderID"></param> |
364 | /// <param name="type"></param> | 364 | /// <param name="type"></param> |
365 | /// <param name="name"></param> | 365 | /// <param name="name"></param> |
@@ -367,7 +367,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
367 | public bool UpdateFolder(string name, LLUUID folderID, ushort type, LLUUID parentID) | 367 | public bool UpdateFolder(string name, LLUUID folderID, ushort type, LLUUID parentID) |
368 | { | 368 | { |
369 | // m_log.DebugFormat( | 369 | // m_log.DebugFormat( |
370 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | 370 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); |
371 | 371 | ||
372 | if (HasInventory) | 372 | if (HasInventory) |
373 | { | 373 | { |
@@ -378,7 +378,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
378 | baseFolder.ParentID = parentID; | 378 | baseFolder.ParentID = parentID; |
379 | baseFolder.Type = (short) type; | 379 | baseFolder.Type = (short) type; |
380 | baseFolder.Version = RootFolder.Version; | 380 | baseFolder.Version = RootFolder.Version; |
381 | 381 | ||
382 | m_commsManager.InventoryService.AddFolder(baseFolder); | 382 | m_commsManager.InventoryService.AddFolder(baseFolder); |
383 | } | 383 | } |
384 | else | 384 | else |
@@ -387,18 +387,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
387 | new InventoryRequest( | 387 | new InventoryRequest( |
388 | Delegate.CreateDelegate(typeof(UpdateFolderDelegate), this, "UpdateFolder"), | 388 | Delegate.CreateDelegate(typeof(UpdateFolderDelegate), this, "UpdateFolder"), |
389 | new object[] { name, folderID, type, parentID })); | 389 | new object[] { name, folderID, type, parentID })); |
390 | } | 390 | } |
391 | 391 | ||
392 | return true; | 392 | return true; |
393 | } | 393 | } |
394 | 394 | ||
395 | /// <summary> | 395 | /// <summary> |
396 | /// Handle an inventory folder move request from the client. | 396 | /// Handle an inventory folder move request from the client. |
397 | /// | 397 | /// |
398 | /// If the inventory service has not yet delievered the inventory | 398 | /// If the inventory service has not yet delievered the inventory |
399 | /// for this user then the request will be queued. | 399 | /// for this user then the request will be queued. |
400 | /// </summary> | 400 | /// </summary> |
401 | /// | 401 | /// |
402 | /// <param name="folderID"></param> | 402 | /// <param name="folderID"></param> |
403 | /// <param name="parentID"></param> | 403 | /// <param name="parentID"></param> |
404 | public bool MoveFolder(LLUUID folderID, LLUUID parentID) | 404 | public bool MoveFolder(LLUUID folderID, LLUUID parentID) |
@@ -413,9 +413,9 @@ namespace OpenSim.Framework.Communications.Cache | |||
413 | baseFolder.Owner = m_userProfile.ID; | 413 | baseFolder.Owner = m_userProfile.ID; |
414 | baseFolder.ID = folderID; | 414 | baseFolder.ID = folderID; |
415 | baseFolder.ParentID = parentID; | 415 | baseFolder.ParentID = parentID; |
416 | 416 | ||
417 | m_commsManager.InventoryService.MoveFolder(baseFolder); | 417 | m_commsManager.InventoryService.MoveFolder(baseFolder); |
418 | 418 | ||
419 | return true; | 419 | return true; |
420 | } | 420 | } |
421 | else | 421 | else |
@@ -424,30 +424,30 @@ namespace OpenSim.Framework.Communications.Cache | |||
424 | new InventoryRequest( | 424 | new InventoryRequest( |
425 | Delegate.CreateDelegate(typeof(MoveFolderDelegate), this, "MoveFolder"), | 425 | Delegate.CreateDelegate(typeof(MoveFolderDelegate), this, "MoveFolder"), |
426 | new object[] { folderID, parentID })); | 426 | new object[] { folderID, parentID })); |
427 | 427 | ||
428 | return true; | 428 | return true; |
429 | } | 429 | } |
430 | } | 430 | } |
431 | 431 | ||
432 | /// <summary> | 432 | /// <summary> |
433 | /// This method will delete all the items and folders in the given folder. | 433 | /// This method will delete all the items and folders in the given folder. |
434 | /// | 434 | /// |
435 | /// If the inventory service has not yet delievered the inventory | 435 | /// If the inventory service has not yet delievered the inventory |
436 | /// for this user then the request will be queued. | 436 | /// for this user then the request will be queued. |
437 | /// </summary> | 437 | /// </summary> |
438 | /// | 438 | /// |
439 | /// <param name="folderID"></param> | 439 | /// <param name="folderID"></param> |
440 | public bool PurgeFolder(LLUUID folderID) | 440 | public bool PurgeFolder(LLUUID folderID) |
441 | { | 441 | { |
442 | // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}", | 442 | // m_log.InfoFormat("[AGENT INVENTORY]: Purging folder {0} for {1} uuid {2}", |
443 | // folderID, remoteClient.Name, remoteClient.AgentId); | 443 | // folderID, remoteClient.Name, remoteClient.AgentId); |
444 | 444 | ||
445 | if (HasInventory) | 445 | if (HasInventory) |
446 | { | 446 | { |
447 | InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID); | 447 | InventoryFolderImpl purgedFolder = RootFolder.FindFolder(folderID); |
448 | 448 | ||
449 | if (purgedFolder != null) | 449 | if (purgedFolder != null) |
450 | { | 450 | { |
451 | // XXX Nasty - have to create a new object to hold details we already have | 451 | // XXX Nasty - have to create a new object to hold details we already have |
452 | InventoryFolderBase purgedBaseFolder = new InventoryFolderBase(); | 452 | InventoryFolderBase purgedBaseFolder = new InventoryFolderBase(); |
453 | purgedBaseFolder.Owner = purgedFolder.Owner; | 453 | purgedBaseFolder.Owner = purgedFolder.Owner; |
@@ -455,12 +455,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
455 | purgedBaseFolder.Name = purgedFolder.Name; | 455 | purgedBaseFolder.Name = purgedFolder.Name; |
456 | purgedBaseFolder.ParentID = purgedFolder.ParentID; | 456 | purgedBaseFolder.ParentID = purgedFolder.ParentID; |
457 | purgedBaseFolder.Type = purgedFolder.Type; | 457 | purgedBaseFolder.Type = purgedFolder.Type; |
458 | purgedBaseFolder.Version = purgedFolder.Version; | 458 | purgedBaseFolder.Version = purgedFolder.Version; |
459 | 459 | ||
460 | m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); | 460 | m_commsManager.InventoryService.PurgeFolder(purgedBaseFolder); |
461 | 461 | ||
462 | purgedFolder.Purge(); | 462 | purgedFolder.Purge(); |
463 | 463 | ||
464 | return true; | 464 | return true; |
465 | } | 465 | } |
466 | } | 466 | } |
@@ -470,12 +470,12 @@ namespace OpenSim.Framework.Communications.Cache | |||
470 | new InventoryRequest( | 470 | new InventoryRequest( |
471 | Delegate.CreateDelegate(typeof(PurgeFolderDelegate), this, "PurgeFolder"), | 471 | Delegate.CreateDelegate(typeof(PurgeFolderDelegate), this, "PurgeFolder"), |
472 | new object[] { folderID })); | 472 | new object[] { folderID })); |
473 | 473 | ||
474 | return true; | 474 | return true; |
475 | } | 475 | } |
476 | 476 | ||
477 | return false; | 477 | return false; |
478 | } | 478 | } |
479 | 479 | ||
480 | /// <summary> | 480 | /// <summary> |
481 | /// Add an item to the user's inventory | 481 | /// Add an item to the user's inventory |
@@ -494,7 +494,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
494 | new InventoryRequest( | 494 | new InventoryRequest( |
495 | Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"), | 495 | Delegate.CreateDelegate(typeof(AddItemDelegate), this, "AddItem"), |
496 | new object[] { item })); | 496 | new object[] { item })); |
497 | } | 497 | } |
498 | } | 498 | } |
499 | 499 | ||
500 | /// <summary> | 500 | /// <summary> |
@@ -514,18 +514,18 @@ namespace OpenSim.Framework.Communications.Cache | |||
514 | new InventoryRequest( | 514 | new InventoryRequest( |
515 | Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"), | 515 | Delegate.CreateDelegate(typeof(UpdateItemDelegate), this, "UpdateItem"), |
516 | new object[] { item })); | 516 | new object[] { item })); |
517 | } | 517 | } |
518 | } | 518 | } |
519 | 519 | ||
520 | /// <summary> | 520 | /// <summary> |
521 | /// Delete an item from the user's inventory | 521 | /// Delete an item from the user's inventory |
522 | /// | 522 | /// |
523 | /// If the inventory service has not yet delievered the inventory | 523 | /// If the inventory service has not yet delievered the inventory |
524 | /// for this user then the request will be queued. | 524 | /// for this user then the request will be queued. |
525 | /// </summary> | 525 | /// </summary> |
526 | /// <param name="itemID"></param> | 526 | /// <param name="itemID"></param> |
527 | /// <returns> | 527 | /// <returns> |
528 | /// true on a successful delete or a if the request is queued. | 528 | /// true on a successful delete or a if the request is queued. |
529 | /// Returns false on an immediate failure | 529 | /// Returns false on an immediate failure |
530 | /// </returns> | 530 | /// </returns> |
531 | public bool DeleteItem(LLUUID itemID) | 531 | public bool DeleteItem(LLUUID itemID) |
@@ -535,14 +535,14 @@ namespace OpenSim.Framework.Communications.Cache | |||
535 | // XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though | 535 | // XXX For historical reasons (grid comms), we need to retrieve the whole item in order to delete, even though |
536 | // really only the item id is required. | 536 | // really only the item id is required. |
537 | InventoryItemBase item = RootFolder.FindItem(itemID); | 537 | InventoryItemBase item = RootFolder.FindItem(itemID); |
538 | 538 | ||
539 | if (null == item) | 539 | if (null == item) |
540 | { | 540 | { |
541 | m_log.WarnFormat("[AGENT INVENTORY]: Tried to delete item {0} which does not exist", itemID); | 541 | m_log.WarnFormat("[AGENT INVENTORY]: Tried to delete item {0} which does not exist", itemID); |
542 | 542 | ||
543 | return false; | 543 | return false; |
544 | } | 544 | } |
545 | 545 | ||
546 | if (RootFolder.DeleteItem(item.ID)) | 546 | if (RootFolder.DeleteItem(item.ID)) |
547 | { | 547 | { |
548 | return m_commsManager.InventoryService.DeleteItem(item); | 548 | return m_commsManager.InventoryService.DeleteItem(item); |
@@ -554,13 +554,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
554 | new InventoryRequest( | 554 | new InventoryRequest( |
555 | Delegate.CreateDelegate(typeof(DeleteItemDelegate), this, "DeleteItem"), | 555 | Delegate.CreateDelegate(typeof(DeleteItemDelegate), this, "DeleteItem"), |
556 | new object[] { itemID })); | 556 | new object[] { itemID })); |
557 | 557 | ||
558 | return true; | 558 | return true; |
559 | } | 559 | } |
560 | 560 | ||
561 | return false; | 561 | return false; |
562 | } | 562 | } |
563 | 563 | ||
564 | /// <summary> | 564 | /// <summary> |
565 | /// Send details of the inventory items and/or folders in a given folder to the client. | 565 | /// Send details of the inventory items and/or folders in a given folder to the client. |
566 | /// </summary> | 566 | /// </summary> |
@@ -574,13 +574,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
574 | if (HasInventory) | 574 | if (HasInventory) |
575 | { | 575 | { |
576 | InventoryFolderImpl folder; | 576 | InventoryFolderImpl folder; |
577 | 577 | ||
578 | if ((folder = RootFolder.FindFolder(folderID)) != null) | 578 | if ((folder = RootFolder.FindFolder(folderID)) != null) |
579 | { | 579 | { |
580 | // m_log.DebugFormat( | 580 | // m_log.DebugFormat( |
581 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", | 581 | // "[AGENT INVENTORY]: Found folder {0} for client {1}", |
582 | // folderID, remoteClient.AgentId); | 582 | // folderID, remoteClient.AgentId); |
583 | 583 | ||
584 | client.SendInventoryFolderDetails( | 584 | client.SendInventoryFolderDetails( |
585 | client.AgentId, folderID, folder.RequestListOfItems(), | 585 | client.AgentId, folderID, folder.RequestListOfItems(), |
586 | folder.RequestListOfFolders(), fetchFolders, fetchItems); | 586 | folder.RequestListOfFolders(), fetchFolders, fetchItems); |
@@ -592,7 +592,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
592 | m_log.WarnFormat( | 592 | m_log.WarnFormat( |
593 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", | 593 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1} {2}", |
594 | folderID, client.Name, client.AgentId); | 594 | folderID, client.Name, client.AgentId); |
595 | 595 | ||
596 | return false; | 596 | return false; |
597 | } | 597 | } |
598 | } | 598 | } |
@@ -604,13 +604,13 @@ namespace OpenSim.Framework.Communications.Cache | |||
604 | new object[] { client, folderID, fetchFolders, fetchItems })); | 604 | new object[] { client, folderID, fetchFolders, fetchItems })); |
605 | 605 | ||
606 | return true; | 606 | return true; |
607 | } | 607 | } |
608 | } | 608 | } |
609 | } | 609 | } |
610 | 610 | ||
611 | /// <summary> | 611 | /// <summary> |
612 | /// Should be implemented by callers which require a callback when the user's inventory is received | 612 | /// Should be implemented by callers which require a callback when the user's inventory is received |
613 | /// </summary> | 613 | /// </summary> |
614 | public interface IInventoryRequest | 614 | public interface IInventoryRequest |
615 | { | 615 | { |
616 | /// <summary> | 616 | /// <summary> |
@@ -618,7 +618,7 @@ namespace OpenSim.Framework.Communications.Cache | |||
618 | /// </summary> | 618 | /// </summary> |
619 | void Execute(); | 619 | void Execute(); |
620 | } | 620 | } |
621 | 621 | ||
622 | /// <summary> | 622 | /// <summary> |
623 | /// Generic inventory request | 623 | /// Generic inventory request |
624 | /// </summary> | 624 | /// </summary> |
@@ -626,16 +626,16 @@ namespace OpenSim.Framework.Communications.Cache | |||
626 | { | 626 | { |
627 | private Delegate m_delegate; | 627 | private Delegate m_delegate; |
628 | private Object[] m_args; | 628 | private Object[] m_args; |
629 | 629 | ||
630 | internal InventoryRequest(Delegate delegat, Object[] args) | 630 | internal InventoryRequest(Delegate delegat, Object[] args) |
631 | { | 631 | { |
632 | m_delegate = delegat; | 632 | m_delegate = delegat; |
633 | m_args = args; | 633 | m_args = args; |
634 | } | 634 | } |
635 | 635 | ||
636 | public void Execute() | 636 | public void Execute() |
637 | { | 637 | { |
638 | m_delegate.DynamicInvoke(m_args); | 638 | m_delegate.DynamicInvoke(m_args); |
639 | } | 639 | } |
640 | } | 640 | } |
641 | } | 641 | } |