aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2009-03-23 00:11:34 +0000
committerMelanie Thielker2009-03-23 00:11:34 +0000
commit412112acbafa6e1f111b12007fd3a81728d0b2f5 (patch)
treee7c8b2d89c8c01d95049c3b57b925d9f31cb61e8 /OpenSim
parentSend proper creation date on item gives, so objects will appear at the top of (diff)
downloadopensim-SC-412112acbafa6e1f111b12007fd3a81728d0b2f5.zip
opensim-SC-412112acbafa6e1f111b12007fd3a81728d0b2f5.tar.gz
opensim-SC-412112acbafa6e1f111b12007fd3a81728d0b2f5.tar.bz2
opensim-SC-412112acbafa6e1f111b12007fd3a81728d0b2f5.tar.xz
Committing partial work on passing folders across instances. This may crash.
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/IInventoryData.cs6
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs5
-rw-r--r--OpenSim/Data/MySQL/MySQLInventoryData.cs5
-rw-r--r--OpenSim/Data/NHibernate/NHibernateInventoryData.cs5
-rw-r--r--OpenSim/Data/SQLite/SQLiteInventoryStore.cs5
-rw-r--r--OpenSim/Framework/Communications/Cache/CachedUserInfo.cs51
-rw-r--r--OpenSim/Framework/Communications/IInventoryServices.cs8
-rw-r--r--OpenSim/Framework/Communications/ISecureInventoryService.cs2
-rw-r--r--OpenSim/Framework/Communications/InventoryServiceBase.cs14
-rw-r--r--OpenSim/Grid/InventoryServer/Main.cs4
-rw-r--r--OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs23
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs16
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs16
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs33
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs7
-rw-r--r--OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs5
16 files changed, 203 insertions, 2 deletions
diff --git a/OpenSim/Data/IInventoryData.cs b/OpenSim/Data/IInventoryData.cs
index 84a857c..5724d91 100644
--- a/OpenSim/Data/IInventoryData.cs
+++ b/OpenSim/Data/IInventoryData.cs
@@ -115,6 +115,12 @@ namespace OpenSim.Data
115 InventoryItemBase queryInventoryItem(UUID item); 115 InventoryItemBase queryInventoryItem(UUID item);
116 116
117 /// <summary> 117 /// <summary>
118 ///
119 /// </summary>
120 /// <param name="item"></param>
121 InventoryFolderBase queryInventoryFolder(UUID folder);
122
123 /// <summary>
118 /// Adds a new folder specified by folder 124 /// Adds a new folder specified by folder
119 /// </summary> 125 /// </summary>
120 /// <param name="folder">The inventory folder</param> 126 /// <param name="folder">The inventory folder</param>
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 3d25ed0..1349f29 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -535,6 +535,11 @@ namespace OpenSim.Data.MSSQL
535 return null; 535 return null;
536 } 536 }
537 537
538 public InventoryFolderBase queryInventoryFolder(UUID folderID)
539 {
540 return null;
541 }
542
538 /// <summary> 543 /// <summary>
539 /// Returns all activated gesture-items in the inventory of the specified avatar. 544 /// Returns all activated gesture-items in the inventory of the specified avatar.
540 /// </summary> 545 /// </summary>
diff --git a/OpenSim/Data/MySQL/MySQLInventoryData.cs b/OpenSim/Data/MySQL/MySQLInventoryData.cs
index 2f26cdf..a5312b5 100644
--- a/OpenSim/Data/MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLInventoryData.cs
@@ -553,6 +553,11 @@ namespace OpenSim.Data.MySQL
553 return getInventoryItem(itemID); 553 return getInventoryItem(itemID);
554 } 554 }
555 555
556 public InventoryFolderBase queryInventoryFolder(UUID folderID)
557 {
558 return getInventoryFolder(folderID);
559 }
560
556 /// <summary> 561 /// <summary>
557 /// Creates a new inventory folder 562 /// Creates a new inventory folder
558 /// </summary> 563 /// </summary>
diff --git a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
index 74f6eae..fd32f97 100644
--- a/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateInventoryData.cs
@@ -182,6 +182,11 @@ namespace OpenSim.Data.NHibernate
182 return null; 182 return null;
183 } 183 }
184 184
185 public InventoryFolderBase queryInventoryFolder(UUID folderID)
186 {
187 return null;
188 }
189
185 /// <summary> 190 /// <summary>
186 /// Returns an inventory folder by its UUID 191 /// Returns an inventory folder by its UUID
187 /// </summary> 192 /// </summary>
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
index 34a6364..bd18c11 100644
--- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs
@@ -631,6 +631,11 @@ namespace OpenSim.Data.SQLite
631 return null; 631 return null;
632 } 632 }
633 633
634 public InventoryFolderBase queryInventoryFolder(UUID folderID)
635 {
636 return null;
637 }
638
634 /// <summary> 639 /// <summary>
635 /// Delete all items in the specified folder 640 /// Delete all items in the specified folder
636 /// </summary> 641 /// </summary>
diff --git a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
index e590b9d..8d36623 100644
--- a/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
+++ b/OpenSim/Framework/Communications/Cache/CachedUserInfo.cs
@@ -37,6 +37,7 @@ namespace OpenSim.Framework.Communications.Cache
37 internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo); 37 internal delegate void UpdateItemDelegate(InventoryItemBase itemInfo);
38 internal delegate void DeleteItemDelegate(UUID itemID); 38 internal delegate void DeleteItemDelegate(UUID itemID);
39 internal delegate void QueryItemDelegate(UUID itemID); 39 internal delegate void QueryItemDelegate(UUID itemID);
40 internal delegate void QueryFolderDelegate(UUID folderID);
40 41
41 internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID); 42 internal delegate void CreateFolderDelegate(string folderName, UUID folderID, ushort folderType, UUID parentID);
42 internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID); 43 internal delegate void MoveFolderDelegate(UUID folderID, UUID parentID);
@@ -819,6 +820,56 @@ namespace OpenSim.Framework.Communications.Cache
819 return false; 820 return false;
820 } 821 }
821 822
823 public bool QueryFolder(InventoryFolderBase folder)
824 {
825 if (m_hasReceivedInventory)
826 {
827 InventoryFolderBase invFolder = RootFolder.FindFolder(folder.ID);
828
829 if (invFolder != null)
830 {
831 // Folder is in local cache, just update client
832 //
833 return true;
834 }
835
836 InventoryFolderBase folderInfo = null;
837
838 if (m_commsManager.SecureInventoryService != null)
839 {
840 folderInfo = m_commsManager.SecureInventoryService.QueryFolder(folder, m_session_id);
841 }
842 else
843 {
844 folderInfo = m_commsManager.InventoryService.QueryFolder(folder);
845 }
846
847 if (folderInfo != null)
848 {
849 InventoryFolderImpl createdFolder = RootFolder.CreateChildFolder(folderInfo.ID, folderInfo.Name, (ushort)folderInfo.Type);
850
851 createdFolder.Version = folderInfo.Version;
852 createdFolder.Owner = folderInfo.Owner;
853 createdFolder.ParentID = folderInfo.ParentID;
854
855 return true;
856 }
857
858 return false;
859 }
860 else
861 {
862 AddRequest(
863 new InventoryRequest(
864 Delegate.CreateDelegate(typeof(QueryFolderDelegate), this, "QueryFolder"),
865 new object[] { folder.ID }));
866
867 return true;
868 }
869
870 return false;
871 }
872
822 } 873 }
823 874
824 /// <summary> 875 /// <summary>
diff --git a/OpenSim/Framework/Communications/IInventoryServices.cs b/OpenSim/Framework/Communications/IInventoryServices.cs
index fc9d8af..e37b188 100644
--- a/OpenSim/Framework/Communications/IInventoryServices.cs
+++ b/OpenSim/Framework/Communications/IInventoryServices.cs
@@ -113,6 +113,14 @@ namespace OpenSim.Framework.Communications
113 InventoryItemBase QueryItem(InventoryItemBase item); 113 InventoryItemBase QueryItem(InventoryItemBase item);
114 114
115 /// <summary> 115 /// <summary>
116 /// Query the server for a folder that may have been added by
117 /// another region
118 /// </summary>
119 /// <param name="folder"></param>
120 /// <returns>true if the folder was found in local cache</returns>
121 InventoryFolderBase QueryFolder(InventoryFolderBase folder);
122
123 /// <summary>
116 /// Does the given user have an inventory structure? 124 /// Does the given user have an inventory structure?
117 /// </summary> 125 /// </summary>
118 /// <param name="userID"></param> 126 /// <param name="userID"></param>
diff --git a/OpenSim/Framework/Communications/ISecureInventoryService.cs b/OpenSim/Framework/Communications/ISecureInventoryService.cs
index d70dd0b..a405ee5 100644
--- a/OpenSim/Framework/Communications/ISecureInventoryService.cs
+++ b/OpenSim/Framework/Communications/ISecureInventoryService.cs
@@ -98,6 +98,8 @@ namespace OpenSim.Framework.Communications
98 98
99 InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id); 99 InventoryItemBase QueryItem(InventoryItemBase item, UUID session_id);
100 100
101 InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id);
102
101 /// <summary> 103 /// <summary>
102 /// Does the given user have an inventory structure? 104 /// Does the given user have an inventory structure?
103 /// </summary> 105 /// </summary>
diff --git a/OpenSim/Framework/Communications/InventoryServiceBase.cs b/OpenSim/Framework/Communications/InventoryServiceBase.cs
index cad7989..ff66250 100644
--- a/OpenSim/Framework/Communications/InventoryServiceBase.cs
+++ b/OpenSim/Framework/Communications/InventoryServiceBase.cs
@@ -292,6 +292,20 @@ namespace OpenSim.Framework.Communications
292 return null; 292 return null;
293 } 293 }
294 294
295 public virtual InventoryFolderBase QueryFolder(InventoryFolderBase item)
296 {
297 foreach (IInventoryDataPlugin plugin in m_plugins)
298 {
299 InventoryFolderBase result = plugin.queryInventoryFolder(item.ID);
300 if (result != null)
301 {
302 return result;
303 }
304 }
305
306 return null;
307 }
308
295 /// <summary> 309 /// <summary>
296 /// Purge a folder of all items items and subfolders. 310 /// Purge a folder of all items items and subfolders.
297 /// 311 ///
diff --git a/OpenSim/Grid/InventoryServer/Main.cs b/OpenSim/Grid/InventoryServer/Main.cs
index 70bfe60..e4cd446 100644
--- a/OpenSim/Grid/InventoryServer/Main.cs
+++ b/OpenSim/Grid/InventoryServer/Main.cs
@@ -131,6 +131,10 @@ namespace OpenSim.Grid.InventoryServer
131 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>( 131 new RestDeserialiseSecureHandler<InventoryItemBase, InventoryItemBase>(
132 "POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession)); 132 "POST", "/QueryItem/", m_inventoryService.QueryItem, m_inventoryService.CheckAuthSession));
133 133
134 m_httpServer.AddStreamHandler(
135 new RestDeserialiseSecureHandler<InventoryFolderBase, InventoryFolderBase>(
136 "POST", "/QueryFolder/", m_inventoryService.QueryFolder, m_inventoryService.CheckAuthSession));
137
134 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g 138 // WARNING: Root folders no longer just delivers the root and immediate child folders (e.g
135 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton. 139 // system folders such as Objects, Textures), but it now returns the entire inventory skeleton.
136 // It would have been better to rename this request, but complexities in the BaseHttpServer 140 // It would have been better to rename this request, but complexities in the BaseHttpServer
diff --git a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
index 9d70c46..a9e008c 100644
--- a/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
+++ b/OpenSim/Region/Communications/Hypergrid/HGInventoryService.cs
@@ -340,6 +340,29 @@ namespace OpenSim.Region.Communications.Hypergrid
340 340
341 return null; 341 return null;
342 } 342 }
343
344 public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
345 {
346 if (IsLocalStandaloneUser(item.Owner))
347 {
348 return base.QueryFolder(item);
349 }
350
351 try
352 {
353 string invServ = GetUserInventoryURI(item.Owner);
354
355 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
356 "POST", invServ + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString());
357 }
358 catch (WebException e)
359 {
360 m_log.ErrorFormat("[HGrid INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
361 e.Source, e.Message);
362 }
363
364 return null;
365 }
343 #endregion 366 #endregion
344 367
345 #region Methods common to ISecureInventoryService and IInventoryService 368 #region Methods common to ISecureInventoryService and IInventoryService
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 56566a8..26e4a55 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1
312 return null; 312 return null;
313 } 313 }
314 314
315 public InventoryFolderBase QueryFolder(InventoryFolderBase item)
316 {
317 try
318 {
319 return SynchronousRestObjectPoster.BeginPostObject<InventoryFolderBase, InventoryFolderBase>(
320 "POST", _inventoryServerUrl + "/QueryFolder/", item);
321 }
322 catch (WebException e)
323 {
324 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
325 e.Source, e.Message);
326 }
327
328 return null;
329 }
330
315 public bool HasInventoryForUser(UUID userID) 331 public bool HasInventoryForUser(UUID userID)
316 { 332 {
317 return false; 333 return false;
diff --git a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
index 0f50b01..03fb0d5 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1SecureInventoryService.cs
@@ -312,6 +312,22 @@ namespace OpenSim.Region.Communications.OGS1
312 return null; 312 return null;
313 } 313 }
314 314
315 public InventoryFolderBase QueryFolder(InventoryFolderBase item, UUID session_id)
316 {
317 try
318 {
319 return SynchronousRestSessionObjectPoster<InventoryFolderBase, InventoryFolderBase>.BeginPostObject(
320 "POST", _inventoryServerUrl + "/QueryFolder/", item, session_id.ToString(), item.Owner.ToString());
321 }
322 catch (WebException e)
323 {
324 m_log.ErrorFormat("[OGS1 INVENTORY SERVICE]: Query inventory item operation failed, {0} {1}",
325 e.Source, e.Message);
326 }
327
328 return null;
329 }
330
315 public bool HasInventoryForUser(UUID userID) 331 public bool HasInventoryForUser(UUID userID)
316 { 332 {
317 return false; 333 return false;
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 465167a..19b9b22 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -426,9 +426,38 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
426 426
427 if (AssetType.Folder == assetType) 427 if (AssetType.Folder == assetType)
428 { 428 {
429 // Folders not implemented yet 429 UUID folderID = new UUID(msg.binaryBucket, 1);
430 InventoryFolderBase folder = new InventoryFolderBase();
431
432 folder.ID = folderID;
433 folder.Owner = user.ControllingClient.AgentId;
434
435 // Fetch from database
430 // 436 //
431 return; 437 if (!userInfo.QueryFolder(folder))
438 {
439 m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
440 return;
441 }
442
443 // Get folder info
444 //
445 InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID);
446 if (folderInfo == null)
447 {
448 m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give");
449 return;
450 }
451
452 user.ControllingClient.SendBulkUpdateInventory(folderInfo);
453
454 // Deliver message
455 //
456 user.ControllingClient.SendInstantMessage(
457 new UUID(msg.fromAgentID), msg.message,
458 new UUID(msg.toAgentID),
459 msg.fromAgentName, msg.dialog, msg.timestamp,
460 folderID, false, msg.binaryBucket);
432 } 461 }
433 else 462 else
434 { 463 {
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 9528114..d129b93 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -618,6 +618,13 @@ namespace OpenSim.Region.Framework.Scenes
618 return null; 618 return null;
619 } 619 }
620 620
621 if (!recipientUserInfo.HasReceivedInventory)
622 {
623 recipientUserInfo.FetchInventory();
624 if (!WaitForInventory(recipientUserInfo))
625 return null;
626 }
627
621 if (recipientParentFolderId == UUID.Zero) 628 if (recipientParentFolderId == UUID.Zero)
622 recipientParentFolderId = recipientUserInfo.RootFolder.ID; 629 recipientParentFolderId = recipientUserInfo.RootFolder.ID;
623 630
diff --git a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
index 69b0917..efe0101 100644
--- a/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
+++ b/OpenSim/Tests/Common/Mock/TestInventoryDataPlugin.cs
@@ -120,6 +120,11 @@ namespace OpenSim.Tests.Common.Mock
120 return null; 120 return null;
121 } 121 }
122 122
123 public InventoryFolderBase queryInventoryFolder(UUID folderID)
124 {
125 return null;
126 }
127
123 public void addInventoryFolder(InventoryFolderBase folder) 128 public void addInventoryFolder(InventoryFolderBase folder)
124 { 129 {
125 m_folders[folder.ID] = folder; 130 m_folders[folder.ID] = folder;