diff options
author | Justin Clark-Casey (justincc) | 2010-09-04 01:36:26 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-09-04 01:36:26 +0100 |
commit | 1e8e98a07fdad6cff4be780083b3d9ad2360b8e7 (patch) | |
tree | 525953a28c694123fc1450e882dca65aa620e124 /OpenSim/Region/Framework/Scenes | |
parent | Create Scene.Inventory.cs.AddInventoryItem(InventoryItemBase item) (diff) | |
download | opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.zip opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.gz opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.bz2 opensim-SC_OLD-1e8e98a07fdad6cff4be780083b3d9ad2360b8e7.tar.xz |
Move code that allows llGiveInvetory() to move item into appropriate system folder up from connectors into Scene.Inventory.cs
This fixes the problem for all architectures (hg as well as local and grid) and means we don't have to dupe code between connectors.
Not ideal in that it becomes non-modular, but methods in Scene.Inventory.cs should eventually be modularized anyway.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 48 |
1 files changed, 40 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 7cedde0..4e871d9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -70,18 +70,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
70 | 70 | ||
71 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) | 71 | public void AddUploadedInventoryItem(UUID agentID, InventoryItemBase item) |
72 | { | 72 | { |
73 | IMoneyModule money=RequestModuleInterface<IMoneyModule>(); | 73 | IMoneyModule money = RequestModuleInterface<IMoneyModule>(); |
74 | if (money != null) | 74 | if (money != null) |
75 | { | 75 | { |
76 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); | 76 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); |
77 | } | 77 | } |
78 | 78 | ||
79 | AddInventoryItem(agentID, item); | 79 | AddInventoryItem(item); |
80 | } | 80 | } |
81 | 81 | ||
82 | public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) | 82 | public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) |
83 | { | 83 | { |
84 | if (InventoryService.AddItem(item)) | 84 | if (AddInventoryItem(item)) |
85 | return true; | 85 | return true; |
86 | else | 86 | else |
87 | { | 87 | { |
@@ -96,8 +96,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
96 | /// Add the given inventory item to a user's inventory. | 96 | /// Add the given inventory item to a user's inventory. |
97 | /// </summary> | 97 | /// </summary> |
98 | /// <param name="item"></param> | 98 | /// <param name="item"></param> |
99 | public void AddInventoryItem(InventoryItemBase item) | 99 | public bool AddInventoryItem(InventoryItemBase item) |
100 | { | 100 | { |
101 | if (UUID.Zero == item.Folder) | ||
102 | { | ||
103 | InventoryFolderBase f = InventoryService.GetFolderForType(item.Owner, (AssetType)item.AssetType); | ||
104 | if (f != null) | ||
105 | { | ||
106 | // m_log.DebugFormat( | ||
107 | // "[LOCAL INVENTORY SERVICES CONNECTOR]: Found folder {0} type {1} for item {2}", | ||
108 | // f.Name, (AssetType)f.Type, item.Name); | ||
109 | |||
110 | item.Folder = f.ID; | ||
111 | } | ||
112 | else | ||
113 | { | ||
114 | f = InventoryService.GetRootFolder(item.Owner); | ||
115 | if (f != null) | ||
116 | { | ||
117 | item.Folder = f.ID; | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | m_log.WarnFormat( | ||
122 | "[AGENT INVENTORY]: Could not find root folder for {0} when trying to add item {1} with no parent folder specified", | ||
123 | item.Owner, item.Name); | ||
124 | return false; | ||
125 | } | ||
126 | } | ||
127 | } | ||
128 | |||
101 | if (InventoryService.AddItem(item)) | 129 | if (InventoryService.AddItem(item)) |
102 | { | 130 | { |
103 | int userlevel = 0; | 131 | int userlevel = 0; |
@@ -106,6 +134,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
106 | userlevel = 1; | 134 | userlevel = 1; |
107 | } | 135 | } |
108 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); | 136 | EventManager.TriggerOnNewInventoryItemUploadComplete(item.Owner, item.AssetID, item.Name, userlevel); |
137 | |||
138 | return true; | ||
109 | } | 139 | } |
110 | else | 140 | else |
111 | { | 141 | { |
@@ -113,7 +143,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
113 | "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", | 143 | "[AGENT INVENTORY]: Agent {0} could not add item {1} {2}", |
114 | item.Owner, item.Name, item.ID); | 144 | item.Owner, item.Name, item.ID); |
115 | 145 | ||
116 | return; | 146 | return false; |
117 | } | 147 | } |
118 | } | 148 | } |
119 | 149 | ||
@@ -538,7 +568,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
538 | itemCopy.SalePrice = item.SalePrice; | 568 | itemCopy.SalePrice = item.SalePrice; |
539 | itemCopy.SaleType = item.SaleType; | 569 | itemCopy.SaleType = item.SaleType; |
540 | 570 | ||
541 | if (InventoryService.AddItem(itemCopy)) | 571 | if (AddInventoryItem(itemCopy)) |
542 | { | 572 | { |
543 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); | 573 | IInventoryAccessModule invAccess = RequestModuleInterface<IInventoryAccessModule>(); |
544 | if (invAccess != null) | 574 | if (invAccess != null) |
@@ -764,8 +794,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | item.BasePermissions = baseMask; | 794 | item.BasePermissions = baseMask; |
765 | item.CreationDate = creationDate; | 795 | item.CreationDate = creationDate; |
766 | 796 | ||
767 | if (InventoryService.AddItem(item)) | 797 | if (AddInventoryItem(item)) |
798 | { | ||
768 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 799 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); |
800 | } | ||
769 | else | 801 | else |
770 | { | 802 | { |
771 | m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); | 803 | m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); |
@@ -1886,7 +1918,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1886 | // sets itemID so client can show item as 'attached' in inventory | 1918 | // sets itemID so client can show item as 'attached' in inventory |
1887 | grp.SetFromItemID(item.ID); | 1919 | grp.SetFromItemID(item.ID); |
1888 | 1920 | ||
1889 | if (InventoryService.AddItem(item)) | 1921 | if (AddInventoryItem(item)) |
1890 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 1922 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
1891 | else | 1923 | else |
1892 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | 1924 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); |