aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Communications
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Communications')
-rw-r--r--OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs40
1 files changed, 32 insertions, 8 deletions
diff --git a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
index 6c1f77e..0fb083a 100644
--- a/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
+++ b/OpenSim/Region/Communications/OGS1/OGS1InventoryService.cs
@@ -32,6 +32,7 @@ using OpenSim.Framework;
32using OpenSim.Framework.Servers; 32using OpenSim.Framework.Servers;
33using OpenSim.Framework.Communications; 33using OpenSim.Framework.Communications;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Framework.Console;
35 36
36namespace OpenSim.Region.Communications.OGS1 37namespace OpenSim.Region.Communications.OGS1
37{ 38{
@@ -47,10 +48,10 @@ namespace OpenSim.Region.Communications.OGS1
47 48
48 #region IInventoryServices Members 49 #region IInventoryServices Members
49 50
51 // See IInventoryServices
50 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack, 52 public void RequestInventoryForUser(LLUUID userID, InventoryFolderInfo folderCallBack,
51 InventoryItemInfo itemCallBack) 53 InventoryItemInfo itemCallBack)
52 { 54 {
53
54 if (!m_RequestingInventory.ContainsKey(userID)) 55 if (!m_RequestingInventory.ContainsKey(userID))
55 { 56 {
56 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack); 57 InventoryRequest request = new InventoryRequest(userID, folderCallBack, itemCallBack);
@@ -59,30 +60,46 @@ namespace OpenSim.Region.Communications.OGS1
59 } 60 }
60 } 61 }
61 62
63 /// <summary>
64 /// Request the entire user's inventory (folders and items) from the inventory server.
65 ///
66 /// XXX May want to change this so that we don't end up shuffling over data which might prove
67 /// entirely unnecessary.
68 /// </summary>
69 /// <param name="userID"></param>
62 private void RequestInventory(LLUUID userID) 70 private void RequestInventory(LLUUID userID)
63 { 71 {
64 try 72 try
65 { 73 {
66 Console.WriteLine("Requesting Inventory from Inventory server ( " + _inventoryServerUrl + "/GetInventory/" +" ) for " + userID.ToString()); 74 MainLog.Instance.Verbose(
67 RestObjectPosterResponse<InventoryCollection> requester = new RestObjectPosterResponse<InventoryCollection>(); 75 "INVENTORY", "Requesting inventory from {0}/GetInventory/ for user {1}",
76 _inventoryServerUrl, userID);
77
78 RestObjectPosterResponse<InventoryCollection> requester
79 = new RestObjectPosterResponse<InventoryCollection>();
68 requester.ResponseCallback = InventoryResponse; 80 requester.ResponseCallback = InventoryResponse;
69 81
70 requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID); 82 requester.BeginPostObject<Guid>(_inventoryServerUrl + "/GetInventory/", userID.UUID);
71 Console.WriteLine("Request for Inventory sent");
72 } 83 }
73 catch (Exception e) 84 catch (Exception e)
74 { 85 {
75 Console.WriteLine(e.Message); 86 MainLog.Instance.Error("INVENTORY", e.ToString());
76 Console.WriteLine(e.StackTrace);
77 } 87 }
78 } 88 }
79 89
90 /// <summary>
91 /// Callback used by the inventory server GetInventory request
92 /// </summary>
93 /// <param name="userID"></param>
80 private void InventoryResponse(InventoryCollection response) 94 private void InventoryResponse(InventoryCollection response)
81 { 95 {
82 LLUUID userID = response.UserID; 96 LLUUID userID = response.UserID;
83 if (m_RequestingInventory.ContainsKey(userID)) 97 if (m_RequestingInventory.ContainsKey(userID))
84 { 98 {
85 99 MainLog.Instance.Verbose("INVENTORY",
100 "Received inventory response for user {0} containing {1} folders and {2} items",
101 userID, response.Folders.Count, response.AllItems.Count);
102
86 InventoryFolderImpl rootFolder = null; 103 InventoryFolderImpl rootFolder = null;
87 InventoryRequest request = m_RequestingInventory[userID]; 104 InventoryRequest request = m_RequestingInventory[userID];
88 foreach (InventoryFolderBase folder in response.Folders) 105 foreach (InventoryFolderBase folder in response.Folders)
@@ -113,6 +130,13 @@ namespace OpenSim.Region.Communications.OGS1
113 } 130 }
114 m_RequestingInventory.Remove(userID); 131 m_RequestingInventory.Remove(userID);
115 } 132 }
133 else
134 {
135 MainLog.Instance.Warn(
136 "INVENTORY",
137 "Received inventory response for {0} for which we do not have a record of requesting!",
138 userID);
139 }
116 } 140 }
117 141
118 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder) 142 public void AddNewInventoryFolder(LLUUID userID, InventoryFolderBase folder)