aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorDiva Canto2009-08-12 20:39:48 -0700
committerDiva Canto2009-08-12 20:39:48 -0700
commit7aa54593e0b6672979feec97b8151ed134388723 (patch)
treeeaa145993ba39c61f6cbfcd202deb50fbd125fe6 /OpenSim/Region/CoreModules
parent* Added two new packet handler implementations for inventory ops. This is sta... (diff)
downloadopensim-SC_OLD-7aa54593e0b6672979feec97b8151ed134388723.zip
opensim-SC_OLD-7aa54593e0b6672979feec97b8151ed134388723.tar.gz
opensim-SC_OLD-7aa54593e0b6672979feec97b8151ed134388723.tar.bz2
opensim-SC_OLD-7aa54593e0b6672979feec97b8151ed134388723.tar.xz
Redirected all calls to CachedUserProfile methods to the inventory service. Redirection of the RootFolder property is still todo. This compiles but probably inventory will be inconsistent.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs47
-rw-r--r--OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs51
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs7
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs39
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs141
-rw-r--r--OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs1
6 files changed, 124 insertions, 162 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
index 8d586c4..c9ee54f 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AgentAssetsTransactions.cs
@@ -192,40 +192,29 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
192 { 192 {
193 if (XferUploaders.ContainsKey(transactionID)) 193 if (XferUploaders.ContainsKey(transactionID))
194 { 194 {
195 CachedUserInfo userInfo = Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails( 195 UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
196 remoteClient.AgentId);
197 196
198 if (userInfo != null) 197 AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString());
199 {
200 UUID assetID = UUID.Combine(transactionID, remoteClient.SecureSessionId);
201
202 AssetBase asset = Manager.MyScene.AssetService.Get(assetID.ToString());
203
204 if (asset == null)
205 {
206 asset = GetTransactionAsset(transactionID);
207 }
208
209 if (asset != null && asset.FullID == assetID)
210 {
211 // Assets never get updated, new ones get created
212 asset.FullID = UUID.Random();
213 asset.Name = item.Name;
214 asset.Description = item.Description;
215 asset.Type = (sbyte)item.AssetType;
216 item.AssetID = asset.FullID;
217
218 Manager.MyScene.AssetService.Store(asset);
219 }
220 198
221 userInfo.UpdateItem(item); 199 if (asset == null)
200 {
201 asset = GetTransactionAsset(transactionID);
222 } 202 }
223 else 203
204 if (asset != null && asset.FullID == assetID)
224 { 205 {
225 m_log.ErrorFormat( 206 // Assets never get updated, new ones get created
226 "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item update", 207 asset.FullID = UUID.Random();
227 remoteClient.AgentId); 208 asset.Name = item.Name;
209 asset.Description = item.Description;
210 asset.Type = (sbyte)item.AssetType;
211 item.AssetID = asset.FullID;
212
213 Manager.MyScene.AssetService.Store(asset);
228 } 214 }
215
216 IInventoryService invService = Manager.MyScene.InventoryService;
217 invService.UpdateItem(item);
229 } 218 }
230 } 219 }
231 } 220 }
diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
index afd9f5a..e192b81 100644
--- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
+++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetXferUploader.cs
@@ -32,6 +32,7 @@ using log4net;
32using OpenMetaverse; 32using OpenMetaverse;
33using OpenSim.Framework; 33using OpenSim.Framework;
34using OpenSim.Framework.Communications.Cache; 34using OpenSim.Framework.Communications.Cache;
35using OpenSim.Services.Interfaces;
35 36
36namespace OpenSim.Region.CoreModules.Agent.AssetTransaction 37namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
37{ 38{
@@ -214,39 +215,31 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction
214 private void DoCreateItem(uint callbackID) 215 private void DoCreateItem(uint callbackID)
215 { 216 {
216 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset); 217 m_userTransactions.Manager.MyScene.AssetService.Store(m_asset);
217 CachedUserInfo userInfo =
218 m_userTransactions.Manager.MyScene.CommsManager.UserProfileCacheService.GetUserDetails(
219 ourClient.AgentId);
220 218
221 if (userInfo != null) 219 IInventoryService invService = m_userTransactions.Manager.MyScene.InventoryService;
222 { 220
223 InventoryItemBase item = new InventoryItemBase(); 221 InventoryItemBase item = new InventoryItemBase();
224 item.Owner = ourClient.AgentId; 222 item.Owner = ourClient.AgentId;
225 item.CreatorId = ourClient.AgentId.ToString(); 223 item.CreatorId = ourClient.AgentId.ToString();
226 item.ID = UUID.Random(); 224 item.ID = UUID.Random();
227 item.AssetID = m_asset.FullID; 225 item.AssetID = m_asset.FullID;
228 item.Description = m_description; 226 item.Description = m_description;
229 item.Name = m_name; 227 item.Name = m_name;
230 item.AssetType = type; 228 item.AssetType = type;
231 item.InvType = invType; 229 item.InvType = invType;
232 item.Folder = InventFolder; 230 item.Folder = InventFolder;
233 item.BasePermissions = 0x7fffffff; 231 item.BasePermissions = 0x7fffffff;
234 item.CurrentPermissions = 0x7fffffff; 232 item.CurrentPermissions = 0x7fffffff;
235 item.GroupPermissions=0; 233 item.GroupPermissions=0;
236 item.EveryOnePermissions=0; 234 item.EveryOnePermissions=0;
237 item.NextPermissions = nextPerm; 235 item.NextPermissions = nextPerm;
238 item.Flags = (uint) wearableType; 236 item.Flags = (uint) wearableType;
239 item.CreationDate = Util.UnixTimeSinceEpoch(); 237 item.CreationDate = Util.UnixTimeSinceEpoch();
240 238
241 userInfo.AddItem(item); 239 if (invService.AddItem(item))
242 ourClient.SendInventoryItemCreateUpdate(item, callbackID); 240 ourClient.SendInventoryItemCreateUpdate(item, callbackID);
243 }
244 else 241 else
245 { 242 ourClient.SendAlertMessage("Unable to create inventory item");
246 m_log.ErrorFormat(
247 "[ASSET TRANSACTIONS]: Could not find user {0} for inventory item creation",
248 ourClient.AgentId);
249 }
250 } 243 }
251 244
252 /// <summary> 245 /// <summary>
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
index b6250a2..49b2b5c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs
@@ -39,6 +39,7 @@ using OpenSim.Framework.Communications;
39using OpenSim.Framework.Communications.Cache; 39using OpenSim.Framework.Communications.Cache;
40using OpenSim.Region.Framework.Interfaces; 40using OpenSim.Region.Framework.Interfaces;
41using OpenSim.Region.Framework.Scenes; 41using OpenSim.Region.Framework.Scenes;
42using OpenSim.Services.Interfaces;
42 43
43namespace OpenSim.Region.CoreModules.Avatar.Friends 44namespace OpenSim.Region.CoreModules.Avatar.Friends
44{ 45{
@@ -654,8 +655,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends
654 initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID }); 655 initiator.ControllingClient.SendAgentOnline(new UUID[] { fromAgentID });
655 656
656 // find the folder for the friend... 657 // find the folder for the friend...
657 InventoryFolderImpl folder = 658 //InventoryFolderImpl folder =
658 initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard); 659 // initiator.Scene.CommsManager.UserProfileCacheService.GetUserDetails(toAgentID).FindFolderForType((int)InventoryType.CallingCard);
660 IInventoryService invService = initiator.Scene.InventoryService;
661 InventoryFolderBase folder = invService.GetFolderForType(toAgentID, AssetType.CallingCard);
659 if (folder != null) 662 if (folder != null)
660 { 663 {
661 // ... and add the calling card 664 // ... and add the calling card
diff --git a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
index 102feaf..e61648c 100644
--- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -33,6 +33,7 @@ using OpenSim.Framework;
33using OpenSim.Framework.Communications.Cache; 33using OpenSim.Framework.Communications.Cache;
34using OpenSim.Region.Framework.Interfaces; 34using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.Framework.Scenes; 35using OpenSim.Region.Framework.Scenes;
36using OpenSim.Services.Interfaces;
36 37
37namespace OpenSim.Region.CoreModules.Avatar.Gestures 38namespace OpenSim.Region.CoreModules.Avatar.Gestures
38{ 39{
@@ -62,42 +63,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Gestures
62 63
63 public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId) 64 public virtual void ActivateGesture(IClientAPI client, UUID assetId, UUID gestureId)
64 { 65 {
65 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); 66 IInventoryService invService = m_scene.InventoryService;
66 67
67 if (userInfo != null) 68 InventoryItemBase item = invService.QueryItem(new InventoryItemBase(gestureId));
69 if (item != null)
68 { 70 {
69 InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); 71 item.Flags = 1;
70 if (item != null) 72 invService.UpdateItem(item);
71 {
72 item.Flags = 1;
73 userInfo.UpdateItem(item);
74 }
75 else
76 m_log.ErrorFormat(
77 "[GESTURES]: Unable to find gesture to activate {0} for {1}", gestureId, client.Name);
78 } 73 }
79 else 74 else
80 m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name); 75 m_log.WarnFormat(
76 "[GESTURES]: Unable to find gesture {0} to activate for {1}", gestureId, client.Name);
81 } 77 }
82 78
83 public virtual void DeactivateGesture(IClientAPI client, UUID gestureId) 79 public virtual void DeactivateGesture(IClientAPI client, UUID gestureId)
84 { 80 {
85 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(client.AgentId); 81 IInventoryService invService = m_scene.InventoryService;
86 82
87 if (userInfo != null) 83 InventoryItemBase item = invService.QueryItem(new InventoryItemBase(gestureId));
84 if (item != null)
88 { 85 {
89 InventoryItemBase item = userInfo.RootFolder.FindItem(gestureId); 86 item.Flags = 0;
90 if (item != null) 87 invService.UpdateItem(item);
91 {
92 item.Flags = 0;
93 userInfo.UpdateItem(item);
94 }
95 else
96 m_log.ErrorFormat(
97 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
98 } 88 }
99 else 89 else
100 m_log.ErrorFormat("[GESTURES]: Unable to find user {0}", client.Name); 90 m_log.ErrorFormat(
91 "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
101 } 92 }
102 } 93 }
103} \ No newline at end of file 94} \ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
index 811d4cc..b5650fd 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs
@@ -35,6 +35,7 @@ using OpenSim.Framework;
35using OpenSim.Framework.Communications.Cache; 35using OpenSim.Framework.Communications.Cache;
36using OpenSim.Region.Framework.Interfaces; 36using OpenSim.Region.Framework.Interfaces;
37using OpenSim.Region.Framework.Scenes; 37using OpenSim.Region.Framework.Scenes;
38using OpenSim.Services.Interfaces;
38 39
39namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer 40namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
40{ 41{
@@ -154,7 +155,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
154 "into agent {1}'s inventory", 155 "into agent {1}'s inventory",
155 folderID, new UUID(im.toAgentID)); 156 folderID, new UUID(im.toAgentID));
156 157
157 InventoryFolderImpl folderCopy 158 InventoryFolderBase folderCopy
158 = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero); 159 = scene.GiveInventoryFolder(new UUID(im.toAgentID), client.AgentId, folderID, UUID.Zero);
159 160
160 if (folderCopy == null) 161 if (folderCopy == null)
@@ -247,52 +248,51 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
247 // It will have been pushed to the client, too 248 // It will have been pushed to the client, too
248 // 249 //
249 250
250 CachedUserInfo userInfo = 251 //CachedUserInfo userInfo =
251 scene.CommsManager.UserProfileCacheService. 252 // scene.CommsManager.UserProfileCacheService.
252 GetUserDetails(client.AgentId); 253 // GetUserDetails(client.AgentId);
254 IInventoryService invService = scene.InventoryService;
253 255
254 if (userInfo != null) 256 InventoryFolderBase trashFolder =
255 { 257 invService.GetFolderForType(client.AgentId, AssetType.TrashFolder);
256 InventoryFolderImpl trashFolder = 258
257 userInfo.FindFolderForType((int)AssetType.TrashFolder); 259 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
258
259 UUID inventoryEntityID = new UUID(im.imSessionID); // The inventory item/folder, back from it's trip
260
261 InventoryItemBase item = userInfo.RootFolder.FindItem(inventoryEntityID);
262 InventoryFolderBase folder = null;
263 260
264 if (item != null && trashFolder != null) 261 InventoryItemBase item = invService.QueryItem(new InventoryItemBase(inventoryEntityID));
265 { 262 InventoryFolderBase folder = null;
266 item.Folder = trashFolder.ID; 263
267 264 if (item != null && trashFolder != null)
268 userInfo.DeleteItem(inventoryEntityID); 265 {
266 item.Folder = trashFolder.ID;
269 267
270 scene.AddInventoryItem(client, item); 268 // Diva comment: can't we just update this item???
271 } 269 invService.DeleteItem(item);
272 else 270 scene.AddInventoryItem(client, item);
271 }
272 else
273 {
274 folder = invService.QueryFolder(new InventoryFolderBase(inventoryEntityID));
275
276 if (folder != null & trashFolder != null)
273 { 277 {
274 folder = userInfo.RootFolder.FindFolder(inventoryEntityID); 278 folder.ParentID = trashFolder.ID;
275 279 invService.MoveFolder(folder);
276 if (folder != null & trashFolder != null)
277 {
278 userInfo.MoveFolder(inventoryEntityID, trashFolder.ID);
279 }
280 } 280 }
281 }
282
283 if ((null == item && null == folder) | null == trashFolder)
284 {
285 string reason = String.Empty;
281 286
282 if ((null == item && null == folder) | null == trashFolder) 287 if (trashFolder == null)
283 { 288 reason += " Trash folder not found.";
284 string reason = String.Empty; 289 if (item == null)
285 290 reason += " Item not found.";
286 if (trashFolder == null) 291 if (folder == null)
287 reason += " Trash folder not found."; 292 reason += " Folder not found.";
288 if (item == null) 293
289 reason += " Item not found."; 294 client.SendAgentAlertMessage("Unable to delete "+
290 if (folder == null) 295 "received inventory" + reason, false);
291 reason += " Folder not found.";
292
293 client.SendAgentAlertMessage("Unable to delete "+
294 "received inventory" + reason, false);
295 }
296 } 296 }
297 297
298 ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID)); 298 ScenePresence user = scene.GetScenePresence(new UUID(im.toAgentID));
@@ -405,17 +405,18 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
405 return; 405 return;
406 } 406 }
407 407
408 CachedUserInfo userInfo = 408 //CachedUserInfo userInfo =
409 scene.CommsManager.UserProfileCacheService. 409 // scene.CommsManager.UserProfileCacheService.
410 GetUserDetails(user.ControllingClient.AgentId); 410 // GetUserDetails(user.ControllingClient.AgentId);
411 411
412 if (userInfo == null) 412 //if (userInfo == null)
413 { 413 //{
414 m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient"); 414 // m_log.Debug("[INVENTORY TRANSFER] Can't find user info of recipient");
415 return; 415 // return;
416 } 416 //}
417 417
418 AssetType assetType = (AssetType)msg.binaryBucket[0]; 418 AssetType assetType = (AssetType)msg.binaryBucket[0];
419 IInventoryService invService = scene.InventoryService;
419 420
420 if (AssetType.Folder == assetType) 421 if (AssetType.Folder == assetType)
421 { 422 {
@@ -425,31 +426,23 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
425 folder.ID = folderID; 426 folder.ID = folderID;
426 folder.Owner = user.ControllingClient.AgentId; 427 folder.Owner = user.ControllingClient.AgentId;
427 428
428 // Fetch from database 429 // Fetch from service
429 // 430 //
430 if (!userInfo.QueryFolder(folder)) 431 folder = invService.QueryFolder(folder);
432 if (folder == null)
431 { 433 {
432 m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give"); 434 m_log.Debug("[INVENTORY TRANSFER] Can't find folder to give");
433 return; 435 return;
434 } 436 }
435 437
436 // Get folder info 438 user.ControllingClient.SendBulkUpdateInventory(folder);
437 //
438 InventoryFolderImpl folderInfo = userInfo.RootFolder.FindFolder(folder.ID);
439 if (folderInfo == null)
440 {
441 m_log.Debug("[INVENTORY TRANSFER] Can't retrieve folder to give");
442 return;
443 }
444
445 user.ControllingClient.SendBulkUpdateInventory(folderInfo);
446 439
447 // This unelegant, slow kludge is to reload the folders and 440 //// This unelegant, slow kludge is to reload the folders and
448 // items. Since a folder give can transfer subfolders and 441 //// items. Since a folder give can transfer subfolders and
449 // items, this is the easiest way to pull that stuff in 442 //// items, this is the easiest way to pull that stuff in
450 // 443 ////
451 userInfo.DropInventory(); 444 //userInfo.DropInventory();
452 userInfo.FetchInventory(); 445 //userInfo.FetchInventory();
453 446
454 // Deliver message 447 // Deliver message
455 // 448 //
@@ -463,20 +456,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer
463 item.ID = itemID; 456 item.ID = itemID;
464 item.Owner = user.ControllingClient.AgentId; 457 item.Owner = user.ControllingClient.AgentId;
465 458
466 // Fetch from database 459 // Fetch from service
467 //
468 if (!userInfo.QueryItem(item))
469 {
470 m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
471 return;
472 }
473
474 // Get item info
475 // 460 //
476 item = userInfo.RootFolder.FindItem(item.ID); 461 item = invService.QueryItem(item);
477 if (item == null) 462 if (item == null)
478 { 463 {
479 m_log.Debug("[INVENTORY TRANSFER] Can't retrieve item to give"); 464 m_log.Debug("[INVENTORY TRANSFER] Can't find item to give");
480 return; 465 return;
481 } 466 }
482 467
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
index 551a7eb..49c0083 100644
--- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
+++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs
@@ -64,6 +64,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory
64 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); 64 Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID);
65 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", 65 m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}",
66 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); 66 presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count);
67
67 if (folders.Count > 0) 68 if (folders.Count > 0)
68 lock (m_InventoryCache) 69 lock (m_InventoryCache)
69 m_InventoryCache.Add(presence.UUID, folders); 70 m_InventoryCache.Add(presence.UUID, folders);