diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-18 11:09:43 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-18 11:09:43 -0400 |
commit | 311b51a1843f43daa7796a46961b65fe702e1b85 (patch) | |
tree | 756554b330c8bdd970f319c3af0327efb9017673 /OpenSim/Region | |
parent | * Some Physics Scene Changes to prepare for larger regions (diff) | |
parent | Fixes mantis #4020 (http://opensimulator.org/mantis/view.php?id=4020) (diff) | |
download | opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.zip opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.gz opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.bz2 opensim-SC_OLD-311b51a1843f43daa7796a46961b65fe702e1b85.tar.xz |
*remove conflicts
Diffstat (limited to '')
55 files changed, 1590 insertions, 1601 deletions
diff --git a/OpenSim/Region/Application/Application.cs b/OpenSim/Region/Application/Application.cs index df80290..2fd26bf 100644 --- a/OpenSim/Region/Application/Application.cs +++ b/OpenSim/Region/Application/Application.cs | |||
@@ -120,6 +120,7 @@ namespace OpenSim | |||
120 | configSource.AddSwitch("Startup", "gridmode"); | 120 | configSource.AddSwitch("Startup", "gridmode"); |
121 | configSource.AddSwitch("Startup", "physics"); | 121 | configSource.AddSwitch("Startup", "physics"); |
122 | configSource.AddSwitch("Startup", "gui"); | 122 | configSource.AddSwitch("Startup", "gui"); |
123 | configSource.AddSwitch("Startup", "console"); | ||
123 | 124 | ||
124 | configSource.AddConfig("StandAlone"); | 125 | configSource.AddConfig("StandAlone"); |
125 | configSource.AddConfig("Network"); | 126 | configSource.AddConfig("Network"); |
@@ -223,4 +224,4 @@ namespace OpenSim | |||
223 | _IsHandlingException = false; | 224 | _IsHandlingException = false; |
224 | } | 225 | } |
225 | } | 226 | } |
226 | } \ No newline at end of file | 227 | } |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 390cfcd..38874f9 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -52,6 +52,7 @@ namespace OpenSim | |||
52 | protected string m_startupCommandsFile; | 52 | protected string m_startupCommandsFile; |
53 | protected string m_shutdownCommandsFile; | 53 | protected string m_shutdownCommandsFile; |
54 | protected bool m_gui = false; | 54 | protected bool m_gui = false; |
55 | protected string m_consoleType = "local"; | ||
55 | 56 | ||
56 | private string m_timedScript = "disabled"; | 57 | private string m_timedScript = "disabled"; |
57 | private Timer m_scriptTimer; | 58 | private Timer m_scriptTimer; |
@@ -71,7 +72,10 @@ namespace OpenSim | |||
71 | m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt"); | 72 | m_startupCommandsFile = startupConfig.GetString("startup_console_commands_file", "startup_commands.txt"); |
72 | m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "shutdown_commands.txt"); | 73 | m_shutdownCommandsFile = startupConfig.GetString("shutdown_console_commands_file", "shutdown_commands.txt"); |
73 | 74 | ||
74 | m_gui = startupConfig.GetBoolean("gui", false); | 75 | if (startupConfig.GetString("console", String.Empty) == String.Empty) |
76 | m_gui = startupConfig.GetBoolean("gui", false); | ||
77 | else | ||
78 | m_consoleType= startupConfig.GetString("console", String.Empty); | ||
75 | 79 | ||
76 | m_timedScript = startupConfig.GetString("timer_Script", "disabled"); | 80 | m_timedScript = startupConfig.GetString("timer_Script", "disabled"); |
77 | if (m_logFileAppender != null) | 81 | if (m_logFileAppender != null) |
@@ -110,13 +114,31 @@ namespace OpenSim | |||
110 | if (m_gui) // Driven by external GUI | 114 | if (m_gui) // Driven by external GUI |
111 | m_console = new CommandConsole("Region"); | 115 | m_console = new CommandConsole("Region"); |
112 | else | 116 | else |
113 | m_console = new LocalConsole("Region"); | 117 | { |
118 | switch (m_consoleType) | ||
119 | { | ||
120 | case "basic": | ||
121 | m_console = new CommandConsole("Region"); | ||
122 | break; | ||
123 | case "rest": | ||
124 | m_console = new RemoteConsole("Region"); | ||
125 | ((RemoteConsole)m_console).ReadConfig(m_config.Source); | ||
126 | break; | ||
127 | default: | ||
128 | m_console = new LocalConsole("Region"); | ||
129 | break; | ||
130 | } | ||
131 | } | ||
132 | |||
114 | MainConsole.Instance = m_console; | 133 | MainConsole.Instance = m_console; |
115 | 134 | ||
116 | RegisterConsoleCommands(); | 135 | RegisterConsoleCommands(); |
117 | 136 | ||
118 | base.StartupSpecific(); | 137 | base.StartupSpecific(); |
119 | 138 | ||
139 | if (m_console is RemoteConsole) | ||
140 | ((RemoteConsole)m_console).SetServer(m_httpServer); | ||
141 | |||
120 | //Run Startup Commands | 142 | //Run Startup Commands |
121 | if (String.IsNullOrEmpty(m_startupCommandsFile)) | 143 | if (String.IsNullOrEmpty(m_startupCommandsFile)) |
122 | { | 144 | { |
diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index e28bc9a..7bc0b77 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs | |||
@@ -70,14 +70,14 @@ namespace OpenSim | |||
70 | 70 | ||
71 | protected bool m_autoCreateClientStack = true; | 71 | protected bool m_autoCreateClientStack = true; |
72 | 72 | ||
73 | /// <summary> | 73 | /// <value> |
74 | /// The file used to load and save prim backup xml if no filename has been specified | 74 | /// The file used to load and save prim backup xml if no filename has been specified |
75 | /// </summary> | 75 | /// </value> |
76 | protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; | 76 | protected const string DEFAULT_PRIM_BACKUP_FILENAME = "prim-backup.xml"; |
77 | 77 | ||
78 | /// <summary> | 78 | /// <value> |
79 | /// The file used to load and save an opensimulator archive if no filename has been specified | 79 | /// The file used to load and save an opensimulator archive if no filename has been specified |
80 | /// </summary> | 80 | /// </value> |
81 | protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; | 81 | protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; |
82 | 82 | ||
83 | public ConfigSettings ConfigurationSettings | 83 | public ConfigSettings ConfigurationSettings |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7633b7b..06bea3d 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -197,6 +197,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
197 | private ObjectExtraParams handlerUpdateExtraParams; //OnUpdateExtraParams; | 197 | private ObjectExtraParams handlerUpdateExtraParams; //OnUpdateExtraParams; |
198 | private ObjectDuplicate handlerObjectDuplicate; | 198 | private ObjectDuplicate handlerObjectDuplicate; |
199 | private ObjectDuplicateOnRay handlerObjectDuplicateOnRay; | 199 | private ObjectDuplicateOnRay handlerObjectDuplicateOnRay; |
200 | private ObjectRequest handlerObjectRequest; | ||
200 | private ObjectSelect handlerObjectSelect; | 201 | private ObjectSelect handlerObjectSelect; |
201 | private ObjectDeselect handlerObjectDeselect; | 202 | private ObjectDeselect handlerObjectDeselect; |
202 | private ObjectIncludeInSearch handlerObjectIncludeInSearch; | 203 | private ObjectIncludeInSearch handlerObjectIncludeInSearch; |
@@ -1083,6 +1084,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1083 | public event GodKickUser OnGodKickUser; | 1084 | public event GodKickUser OnGodKickUser; |
1084 | public event ObjectExtraParams OnUpdateExtraParams; | 1085 | public event ObjectExtraParams OnUpdateExtraParams; |
1085 | public event UpdateShape OnUpdatePrimShape; | 1086 | public event UpdateShape OnUpdatePrimShape; |
1087 | public event ObjectRequest OnObjectRequest; | ||
1086 | public event ObjectSelect OnObjectSelect; | 1088 | public event ObjectSelect OnObjectSelect; |
1087 | public event ObjectDeselect OnObjectDeselect; | 1089 | public event ObjectDeselect OnObjectDeselect; |
1088 | public event GenericCall7 OnObjectDescription; | 1090 | public event GenericCall7 OnObjectDescription; |
@@ -2156,16 +2158,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2156 | 2158 | ||
2157 | protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase) | 2159 | protected void SendBulkUpdateInventoryFolder(InventoryFolderBase folderBase) |
2158 | { | 2160 | { |
2159 | // XXX: Nasty temporary move that will be resolved shortly | ||
2160 | InventoryFolderImpl folder = (InventoryFolderImpl)folderBase; | ||
2161 | |||
2162 | // We will use the same transaction id for all the separate packets to be sent out in this update. | 2161 | // We will use the same transaction id for all the separate packets to be sent out in this update. |
2163 | UUID transactionId = UUID.Random(); | 2162 | UUID transactionId = UUID.Random(); |
2164 | 2163 | ||
2165 | List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks | 2164 | List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks |
2166 | = new List<BulkUpdateInventoryPacket.FolderDataBlock>(); | 2165 | = new List<BulkUpdateInventoryPacket.FolderDataBlock>(); |
2167 | 2166 | ||
2168 | SendBulkUpdateInventoryFolderRecursive(folder, ref folderDataBlocks, transactionId); | 2167 | SendBulkUpdateInventoryFolderRecursive(folderBase, ref folderDataBlocks, transactionId); |
2169 | 2168 | ||
2170 | if (folderDataBlocks.Count > 0) | 2169 | if (folderDataBlocks.Count > 0) |
2171 | { | 2170 | { |
@@ -2191,17 +2190,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2191 | /// <param name="folderDataBlocks"></param> | 2190 | /// <param name="folderDataBlocks"></param> |
2192 | /// <param name="transactionId"></param> | 2191 | /// <param name="transactionId"></param> |
2193 | private void SendBulkUpdateInventoryFolderRecursive( | 2192 | private void SendBulkUpdateInventoryFolderRecursive( |
2194 | InventoryFolderImpl folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks, | 2193 | InventoryFolderBase folder, ref List<BulkUpdateInventoryPacket.FolderDataBlock> folderDataBlocks, |
2195 | UUID transactionId) | 2194 | UUID transactionId) |
2196 | { | 2195 | { |
2197 | folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); | 2196 | folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); |
2198 | 2197 | ||
2199 | const int MAX_ITEMS_PER_PACKET = 5; | 2198 | const int MAX_ITEMS_PER_PACKET = 5; |
2200 | 2199 | ||
2200 | IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); | ||
2201 | // If there are any items then we have to start sending them off in this packet - the next folder will have | 2201 | // If there are any items then we have to start sending them off in this packet - the next folder will have |
2202 | // to be in its own bulk update packet. Also, we can only fit 5 items in a packet (at least this was the limit | 2202 | // to be in its own bulk update packet. Also, we can only fit 5 items in a packet (at least this was the limit |
2203 | // being used on the Linden grid at 20081203). | 2203 | // being used on the Linden grid at 20081203). |
2204 | List<InventoryItemBase> items = folder.RequestListOfItems(); | 2204 | InventoryCollection contents = invService.GetFolderContent(AgentId, folder.ID); // folder.RequestListOfItems(); |
2205 | List<InventoryItemBase> items = contents.Items; | ||
2205 | while (items.Count > 0) | 2206 | while (items.Count > 0) |
2206 | { | 2207 | { |
2207 | BulkUpdateInventoryPacket bulkUpdate | 2208 | BulkUpdateInventoryPacket bulkUpdate |
@@ -2233,8 +2234,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2233 | folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); | 2234 | folderDataBlocks.Add(GenerateBulkUpdateFolderDataBlock(folder)); |
2234 | } | 2235 | } |
2235 | 2236 | ||
2236 | List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls(); | 2237 | List<InventoryFolderBase> subFolders = contents.Folders; |
2237 | foreach (InventoryFolderImpl subFolder in subFolders) | 2238 | foreach (InventoryFolderBase subFolder in subFolders) |
2238 | { | 2239 | { |
2239 | SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId); | 2240 | SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId); |
2240 | } | 2241 | } |
@@ -5937,6 +5938,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5937 | 5938 | ||
5938 | break; | 5939 | break; |
5939 | 5940 | ||
5941 | case PacketType.RequestMultipleObjects: | ||
5942 | RequestMultipleObjectsPacket incomingRequest = (RequestMultipleObjectsPacket)Pack; | ||
5943 | |||
5944 | #region Packet Session and User Check | ||
5945 | if (m_checkPackets) | ||
5946 | { | ||
5947 | if (incomingRequest.AgentData.SessionID != SessionId || | ||
5948 | incomingRequest.AgentData.AgentID != AgentId) | ||
5949 | break; | ||
5950 | } | ||
5951 | #endregion | ||
5952 | |||
5953 | handlerObjectRequest = null; | ||
5954 | |||
5955 | for (int i = 0; i < incomingRequest.ObjectData.Length; i++) | ||
5956 | { | ||
5957 | handlerObjectRequest = OnObjectRequest; | ||
5958 | if (handlerObjectRequest != null) | ||
5959 | { | ||
5960 | handlerObjectRequest(incomingRequest.ObjectData[i].ID, this); | ||
5961 | } | ||
5962 | } | ||
5963 | break; | ||
5940 | case PacketType.ObjectSelect: | 5964 | case PacketType.ObjectSelect: |
5941 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; | 5965 | ObjectSelectPacket incomingselect = (ObjectSelectPacket)Pack; |
5942 | 5966 | ||
@@ -6609,20 +6633,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6609 | } | 6633 | } |
6610 | else // Agent | 6634 | else // Agent |
6611 | { | 6635 | { |
6612 | CachedUserInfo userInfo = ((Scene)m_scene).CommsManager.UserProfileCacheService.GetUserDetails(AgentId); | 6636 | //InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID); |
6613 | if (userInfo == null) | 6637 | IInventoryService invService = m_scene.RequestModuleInterface<IInventoryService>(); |
6614 | { | 6638 | InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(itemID)); |
6615 | m_log.ErrorFormat( | ||
6616 | "[CLIENT]: Could not resolve user {0} for caps inventory update", | ||
6617 | AgentId); | ||
6618 | |||
6619 | break; | ||
6620 | } | ||
6621 | |||
6622 | if (userInfo.RootFolder == null) | ||
6623 | break; | ||
6624 | |||
6625 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(itemID); | ||
6626 | if (assetRequestItem == null) | 6639 | if (assetRequestItem == null) |
6627 | { | 6640 | { |
6628 | assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | 6641 | assetRequestItem = ((Scene)m_scene).CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs index bd11d97..9fb1041 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/Tests/BasicCircuitTests.cs | |||
@@ -34,6 +34,7 @@ using OpenMetaverse; | |||
34 | using OpenMetaverse.Packets; | 34 | using OpenMetaverse.Packets; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Tests.Common; | 36 | using OpenSim.Tests.Common; |
37 | using OpenSim.Tests.Common.Mock; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.ClientStack.LindenUDP.Tests | 39 | namespace OpenSim.Region.ClientStack.LindenUDP.Tests |
39 | { | 40 | { |
diff --git a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs index aef1b94..47c7fe4 100644 --- a/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs +++ b/OpenSim/Region/Communications/OGS1/OGS1GridServices.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.Communications.OGS1 | |||
147 | { | 147 | { |
148 | // The timeout should always be significantly larger than the timeout for the grid server to request | 148 | // The timeout should always be significantly larger than the timeout for the grid server to request |
149 | // the initial status of the region before confirming registration. | 149 | // the initial status of the region before confirming registration. |
150 | GridResp = GridReq.Send(serversInfo.GridURL, 90000); | 150 | GridResp = GridReq.Send(serversInfo.GridURL, 9999999); |
151 | } | 151 | } |
152 | catch (Exception e) | 152 | catch (Exception e) |
153 | { | 153 | { |
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; | |||
32 | using OpenMetaverse; | 32 | using OpenMetaverse; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Services.Interfaces; | ||
35 | 36 | ||
36 | namespace OpenSim.Region.CoreModules.Agent.AssetTransaction | 37 | namespace 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/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index fa5369f..71ff28c 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -37,6 +37,7 @@ using OpenSim.Framework.Communications.Cache; | |||
37 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
38 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
39 | using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>; | 39 | using BlockingQueue = OpenSim.Framework.BlockingQueue<OpenSim.Region.Framework.Interfaces.ITextureSender>; |
40 | using OpenSim.Services.Interfaces; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.CoreModules.Agent.TextureDownload | 42 | namespace OpenSim.Region.CoreModules.Agent.TextureDownload |
42 | { | 43 | { |
@@ -217,11 +218,16 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload | |||
217 | if (profile == null) // Deny unknown user | 218 | if (profile == null) // Deny unknown user |
218 | return; | 219 | return; |
219 | 220 | ||
220 | if (profile.RootFolder == null) // Deny no inventory | 221 | IInventoryService invService = scene.InventoryService; |
222 | if (invService.GetRootFolder(client.AgentId) == null) // Deny no inventory | ||
221 | return; | 223 | return; |
222 | 224 | ||
223 | if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned | 225 | // Diva 2009-08-13: this test doesn't make any sense to many devs |
224 | return; | 226 | //if (profile.UserProfile.GodLevel < 200 && profile.RootFolder.FindAsset(e.RequestedAssetID) == null) // Deny if not owned |
227 | //{ | ||
228 | // m_log.WarnFormat("[TEXTURE]: user {0} doesn't have permissions to texture {1}"); | ||
229 | // return; | ||
230 | //} | ||
225 | 231 | ||
226 | m_log.Debug("Texture preview"); | 232 | m_log.Debug("Texture preview"); |
227 | } | 233 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 33dc7a5..582beee 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -34,6 +34,7 @@ using OpenSim.Framework; | |||
34 | using OpenSim.Framework.Communications.Cache; | 34 | using OpenSim.Framework.Communications.Cache; |
35 | using OpenSim.Region.Framework.Interfaces; | 35 | using OpenSim.Region.Framework.Interfaces; |
36 | using OpenSim.Region.Framework.Scenes; | 36 | using OpenSim.Region.Framework.Scenes; |
37 | using OpenSim.Services.Interfaces; | ||
37 | 38 | ||
38 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | 39 | namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory |
39 | { | 40 | { |
@@ -115,9 +116,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
115 | } | 116 | } |
116 | 117 | ||
117 | 118 | ||
118 | public void SetAppearanceAssets(CachedUserInfo profile, ref AvatarAppearance appearance) | 119 | public void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
119 | { | 120 | { |
120 | if (profile.RootFolder != null) | 121 | IInventoryService invService = m_scene.InventoryService; |
122 | |||
123 | if (invService.GetRootFolder(userID) != null) | ||
121 | { | 124 | { |
122 | for (int i = 0; i < 13; i++) | 125 | for (int i = 0; i < 13; i++) |
123 | { | 126 | { |
@@ -127,7 +130,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
127 | } | 130 | } |
128 | else | 131 | else |
129 | { | 132 | { |
130 | InventoryItemBase baseItem = profile.RootFolder.FindItem(appearance.Wearables[i].ItemID); | 133 | InventoryItemBase baseItem = invService.GetItem(new InventoryItemBase(appearance.Wearables[i].ItemID)); |
131 | 134 | ||
132 | if (baseItem != null) | 135 | if (baseItem != null) |
133 | { | 136 | { |
@@ -143,7 +146,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
143 | } | 146 | } |
144 | else | 147 | else |
145 | { | 148 | { |
146 | m_log.Error("[APPEARANCE]: you have no inventory, appearance stuff isn't going to work"); | 149 | m_log.WarnFormat("[APPEARANCE]: user {0} has no inventory, appearance isn't going to work", userID); |
147 | } | 150 | } |
148 | } | 151 | } |
149 | 152 | ||
@@ -163,8 +166,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
163 | return; | 166 | return; |
164 | } | 167 | } |
165 | 168 | ||
166 | CachedUserInfo profile = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(clientView.AgentId); | ||
167 | |||
168 | AvatarAppearance avatAppearance = null; | 169 | AvatarAppearance avatAppearance = null; |
169 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) | 170 | if (!TryGetAvatarAppearance(clientView.AgentId, out avatAppearance)) |
170 | { | 171 | { |
@@ -174,34 +175,18 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
174 | 175 | ||
175 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); | 176 | //m_log.DebugFormat("[APPEARANCE]: Received wearables for {0}", clientView.Name); |
176 | 177 | ||
177 | if (profile != null) | 178 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
178 | { | 179 | { |
179 | if (profile.RootFolder != null) | 180 | if (wear.Type < 13) |
180 | { | 181 | { |
181 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 182 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; |
182 | { | ||
183 | if (wear.Type < 13) | ||
184 | { | ||
185 | avatAppearance.Wearables[wear.Type].ItemID = wear.ItemID; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | SetAppearanceAssets(profile, ref avatAppearance); | ||
190 | |||
191 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); | ||
192 | avatar.Appearance = avatAppearance; | ||
193 | } | ||
194 | else | ||
195 | { | ||
196 | m_log.WarnFormat( | ||
197 | "[APPEARANCE]: Inventory has not yet been received for {0}, cannot set wearables", | ||
198 | clientView.Name); | ||
199 | } | 183 | } |
200 | } | 184 | } |
201 | else | 185 | |
202 | { | 186 | SetAppearanceAssets(avatar.UUID, ref avatAppearance); |
203 | m_log.WarnFormat("[APPEARANCE]: Cannot set wearables for {0}, no user profile found", clientView.Name); | 187 | |
204 | } | 188 | m_scene.CommsManager.AvatarService.UpdateUserAppearance(clientView.AgentId, avatAppearance); |
189 | avatar.Appearance = avatAppearance; | ||
205 | } | 190 | } |
206 | 191 | ||
207 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) | 192 | public static void GetDefaultAvatarAppearance(out AvatarWearable[] wearables, out byte[] visualParams) |
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; | |||
39 | using OpenSim.Framework.Communications.Cache; | 39 | using OpenSim.Framework.Communications.Cache; |
40 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
41 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
42 | using OpenSim.Services.Interfaces; | ||
42 | 43 | ||
43 | namespace OpenSim.Region.CoreModules.Avatar.Friends | 44 | namespace 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..a68db1b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs | |||
@@ -33,6 +33,7 @@ using OpenSim.Framework; | |||
33 | using OpenSim.Framework.Communications.Cache; | 33 | using OpenSim.Framework.Communications.Cache; |
34 | using OpenSim.Region.Framework.Interfaces; | 34 | using OpenSim.Region.Framework.Interfaces; |
35 | using OpenSim.Region.Framework.Scenes; | 35 | using OpenSim.Region.Framework.Scenes; |
36 | using OpenSim.Services.Interfaces; | ||
36 | 37 | ||
37 | namespace OpenSim.Region.CoreModules.Avatar.Gestures | 38 | namespace 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.GetItem(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.GetItem(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/Archiver/Tests/InventoryArchiverTests.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs index 470a386..d51ed40 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/Tests/InventoryArchiverTests.cs | |||
@@ -74,7 +74,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
74 | /// <summary> | 74 | /// <summary> |
75 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). | 75 | /// Test saving a V0.1 OpenSim Inventory Archive (subject to change since there is no fixed format yet). |
76 | /// </summary> | 76 | /// </summary> |
77 | [Test] | 77 | // Commenting for now! The mock inventory service needs more beef, at least for |
78 | // GetFolderForType | ||
79 | //[Test] | ||
78 | public void TestSaveIarV0_1() | 80 | public void TestSaveIarV0_1() |
79 | { | 81 | { |
80 | TestHelper.InMethod(); | 82 | TestHelper.InMethod(); |
@@ -145,7 +147,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
145 | item1.Name = "My Little Dog"; | 147 | item1.Name = "My Little Dog"; |
146 | item1.AssetID = asset1.FullID; | 148 | item1.AssetID = asset1.FullID; |
147 | item1.ID = item1Id; | 149 | item1.ID = item1Id; |
148 | item1.Folder = userInfo.RootFolder.FindFolderByPath("Objects").ID; | 150 | //userInfo.RootFolder.FindFolderByPath("Objects").ID; |
151 | InventoryFolderBase objsFolder = scene.InventoryService.GetFolderForType(userId, AssetType.Object); | ||
152 | item1.Folder = objsFolder.ID; | ||
149 | scene.AddInventoryItem(userId, item1); | 153 | scene.AddInventoryItem(userId, item1); |
150 | 154 | ||
151 | MemoryStream archiveWriteStream = new MemoryStream(); | 155 | MemoryStream archiveWriteStream = new MemoryStream(); |
@@ -161,8 +165,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
161 | MemoryStream archiveReadStream = new MemoryStream(archive); | 165 | MemoryStream archiveReadStream = new MemoryStream(archive); |
162 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); | 166 | TarArchiveReader tar = new TarArchiveReader(archiveReadStream); |
163 | 167 | ||
164 | InventoryFolderImpl objectsFolder = userInfo.RootFolder.FindFolderByPath("Objects"); | ||
165 | |||
166 | //bool gotControlFile = false; | 168 | //bool gotControlFile = false; |
167 | bool gotObject1File = false; | 169 | bool gotObject1File = false; |
168 | //bool gotObject2File = false; | 170 | //bool gotObject2File = false; |
@@ -170,7 +172,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver.Tests | |||
170 | "{0}{1}/{2}_{3}.xml", | 172 | "{0}{1}/{2}_{3}.xml", |
171 | ArchiveConstants.INVENTORY_PATH, | 173 | ArchiveConstants.INVENTORY_PATH, |
172 | string.Format( | 174 | string.Format( |
173 | "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objectsFolder.ID), | 175 | "Objects{0}{1}", ArchiveConstants.INVENTORY_NODE_NAME_COMPONENT_SEPARATOR, objsFolder.ID), |
174 | item1.Name, | 176 | item1.Name, |
175 | item1Id); | 177 | item1Id); |
176 | 178 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Transfer/InventoryTransferModule.cs index 811d4cc..5315c11 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; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.CoreModules.Avatar.Inventory.Transfer | 40 | namespace 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.GetItem(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.GetFolder(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.GetFolder(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.GetItem(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/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index bcf20be..e9c1e9d 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs | |||
@@ -450,7 +450,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
450 | 450 | ||
451 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName); | 451 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName); |
452 | 452 | ||
453 | // DEPRECIATED | 453 | // DEPRECATED |
454 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); | 454 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); |
455 | 455 | ||
456 | responseMap["connect"] = OSD.FromBoolean(true); | 456 | responseMap["connect"] = OSD.FromBoolean(true); |
@@ -591,7 +591,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
591 | httpaddr = httpsCN; | 591 | httpaddr = httpsCN; |
592 | } | 592 | } |
593 | 593 | ||
594 | // DEPRECIATED | 594 | // DEPRECATED |
595 | responseMap["seed_capability"] | 595 | responseMap["seed_capability"] |
596 | = OSD.FromString( | 596 | = OSD.FromString( |
597 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); | 597 | regionCapsHttpProtocol + httpaddr + ":" + reg.HttpPort + CapsUtil.GetCapsSeedPath(userCap.CapsObjectPath)); |
@@ -764,7 +764,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
764 | responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); | 764 | responseMap["sim_port"] = OSD.FromInteger(reg.InternalEndPoint.Port); |
765 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName);// + ":" + reg.InternalEndPoint.Port.ToString()); | 765 | responseMap["sim_host"] = OSD.FromString(reg.ExternalHostName);// + ":" + reg.InternalEndPoint.Port.ToString()); |
766 | 766 | ||
767 | // DEPRECIATED | 767 | // DEPRECATED |
768 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); | 768 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(reg.ExternalHostName).ToString()); |
769 | 769 | ||
770 | responseMap["session_id"] = OSD.FromUUID(SessionID); | 770 | responseMap["session_id"] = OSD.FromUUID(SessionID); |
@@ -851,7 +851,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
851 | 851 | ||
852 | string rezRespSeedCap = ""; | 852 | string rezRespSeedCap = ""; |
853 | 853 | ||
854 | // DEPRECIATED | 854 | // DEPRECATED |
855 | if (rezResponseMap.ContainsKey("seed_capability")) | 855 | if (rezResponseMap.ContainsKey("seed_capability")) |
856 | rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); | 856 | rezRespSeedCap = rezResponseMap["seed_capability"].AsString(); |
857 | 857 | ||
@@ -863,7 +863,7 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
863 | if (rezResponseMap.ContainsKey("rez_avatar/rez")) | 863 | if (rezResponseMap.ContainsKey("rez_avatar/rez")) |
864 | rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString(); | 864 | rezRespSeedCap = rezResponseMap["rez_avatar/rez"].AsString(); |
865 | 865 | ||
866 | // DEPRECIATED | 866 | // DEPRECATED |
867 | string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); | 867 | string rezRespSim_ip = rezResponseMap["sim_ip"].AsString(); |
868 | 868 | ||
869 | string rezRespSim_host = rezResponseMap["sim_host"].AsString(); | 869 | string rezRespSim_host = rezResponseMap["sim_host"].AsString(); |
@@ -879,13 +879,13 @@ namespace OpenSim.Region.CoreModules.InterGrid | |||
879 | { | 879 | { |
880 | RezResponsePositionArray = (OSDArray)rezResponseMap["position"]; | 880 | RezResponsePositionArray = (OSDArray)rezResponseMap["position"]; |
881 | } | 881 | } |
882 | // DEPRECIATED | 882 | // DEPRECATED |
883 | responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap); | 883 | responseMap["seed_capability"] = OSD.FromString(rezRespSeedCap); |
884 | 884 | ||
885 | // REPLACEMENT r3 | 885 | // REPLACEMENT r3 |
886 | responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap); | 886 | responseMap["region_seed_capability"] = OSD.FromString(rezRespSeedCap); |
887 | 887 | ||
888 | // DEPRECIATED | 888 | // DEPRECATED |
889 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); | 889 | responseMap["sim_ip"] = OSD.FromString(Util.GetHostFromDNS(rezRespSim_ip).ToString()); |
890 | 890 | ||
891 | responseMap["sim_host"] = OSD.FromString(rezRespSim_host); | 891 | responseMap["sim_host"] = OSD.FromString(rezRespSim_host); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs index 20671e0..bce160a 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsIn/Land/LandServiceInConnectorModule.cs | |||
@@ -123,7 +123,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land | |||
123 | 123 | ||
124 | public LandData GetLandData(ulong regionHandle, uint x, uint y) | 124 | public LandData GetLandData(ulong regionHandle, uint x, uint y) |
125 | { | 125 | { |
126 | m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {2}", | 126 | m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}", |
127 | regionHandle, m_Scenes.Count); | 127 | regionHandle, m_Scenes.Count); |
128 | foreach (Scene s in m_Scenes) | 128 | foreach (Scene s in m_Scenes) |
129 | { | 129 | { |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs index 375faf5..ef5ffe1 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/BaseInventoryConnector.cs | |||
@@ -82,7 +82,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
82 | /// </summary> | 82 | /// </summary> |
83 | /// <param name="userID"></param> | 83 | /// <param name="userID"></param> |
84 | /// <returns>null if no root folder was found</returns> | 84 | /// <returns>null if no root folder was found</returns> |
85 | public abstract InventoryFolderBase GetRootFolder(UUID userID); | 85 | public InventoryFolderBase GetRootFolder(UUID userID) |
86 | { | ||
87 | // Root folder is here as system type Folder. | ||
88 | return m_cache.GetFolderForType(userID, AssetType.Folder); | ||
89 | } | ||
86 | 90 | ||
87 | public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); | 91 | public abstract Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID); |
88 | 92 | ||
@@ -184,9 +188,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
184 | /// <returns>true if the item was successfully deleted</returns> | 188 | /// <returns>true if the item was successfully deleted</returns> |
185 | public abstract bool DeleteItem(InventoryItemBase item); | 189 | public abstract bool DeleteItem(InventoryItemBase item); |
186 | 190 | ||
187 | public abstract InventoryItemBase QueryItem(InventoryItemBase item); | 191 | public abstract InventoryItemBase GetItem(InventoryItemBase item); |
188 | 192 | ||
189 | public abstract InventoryFolderBase QueryFolder(InventoryFolderBase folder); | 193 | public abstract InventoryFolderBase GetFolder(InventoryFolderBase folder); |
190 | 194 | ||
191 | /// <summary> | 195 | /// <summary> |
192 | /// Does the given user have an inventory structure? | 196 | /// Does the given user have an inventory structure? |
@@ -202,5 +206,6 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
202 | /// <returns></returns> | 206 | /// <returns></returns> |
203 | public abstract List<InventoryItemBase> GetActiveGestures(UUID userId); | 207 | public abstract List<InventoryItemBase> GetActiveGestures(UUID userId); |
204 | 208 | ||
209 | public abstract int GetAssetPermissions(UUID userID, UUID assetID); | ||
205 | } | 210 | } |
206 | } | 211 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs index 62b9bed..dd451ef 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker.cs | |||
@@ -238,7 +238,19 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
238 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | 238 | public override Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) |
239 | { | 239 | { |
240 | if (IsLocalGridUser(userID)) | 240 | if (IsLocalGridUser(userID)) |
241 | return GetSystemFoldersLocal(userID); | 241 | { |
242 | // This is not pretty, but it will have to do for now | ||
243 | if (m_GridService is BaseInventoryConnector) | ||
244 | { | ||
245 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to RemoteInventoryServiceConnector module"); | ||
246 | return ((BaseInventoryConnector)m_GridService).GetSystemFolders(userID); | ||
247 | } | ||
248 | else | ||
249 | { | ||
250 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetSystemsFolders redirected to GetSystemFoldersLocal"); | ||
251 | return GetSystemFoldersLocal(userID); | ||
252 | } | ||
253 | } | ||
242 | else | 254 | else |
243 | { | 255 | { |
244 | UUID sessionID = GetSessionID(userID); | 256 | UUID sessionID = GetSessionID(userID); |
@@ -262,6 +274,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
262 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | 274 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) |
263 | folders[(AssetType)folder.Type] = folder; | 275 | folders[(AssetType)folder.Type] = folder; |
264 | } | 276 | } |
277 | // Put the root folder there, as type Folder | ||
278 | folders[AssetType.Folder] = root; | ||
265 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); | 279 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: System folders count for {0}: {1}", userID, folders.Count); |
266 | return folders; | 280 | return folders; |
267 | } | 281 | } |
@@ -387,13 +401,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
387 | } | 401 | } |
388 | } | 402 | } |
389 | 403 | ||
390 | public override InventoryItemBase QueryItem(InventoryItemBase item) | 404 | public override InventoryItemBase GetItem(InventoryItemBase item) |
391 | { | 405 | { |
392 | if (item == null) | 406 | if (item == null) |
393 | return null; | 407 | return null; |
394 | 408 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: GetItem {0} for user {1}", item.ID, item.Owner); | |
395 | if (IsLocalGridUser(item.Owner)) | 409 | if (IsLocalGridUser(item.Owner)) |
396 | return m_GridService.QueryItem(item); | 410 | return m_GridService.GetItem(item); |
397 | else | 411 | else |
398 | { | 412 | { |
399 | UUID sessionID = GetSessionID(item.Owner); | 413 | UUID sessionID = GetSessionID(item.Owner); |
@@ -402,13 +416,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
402 | } | 416 | } |
403 | } | 417 | } |
404 | 418 | ||
405 | public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 419 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
406 | { | 420 | { |
407 | if (folder == null) | 421 | if (folder == null) |
408 | return null; | 422 | return null; |
409 | 423 | ||
410 | if (IsLocalGridUser(folder.Owner)) | 424 | if (IsLocalGridUser(folder.Owner)) |
411 | return m_GridService.QueryFolder(folder); | 425 | return m_GridService.GetFolder(folder); |
412 | else | 426 | else |
413 | { | 427 | { |
414 | UUID sessionID = GetSessionID(folder.Owner); | 428 | UUID sessionID = GetSessionID(folder.Owner); |
@@ -422,39 +436,56 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
422 | return false; | 436 | return false; |
423 | } | 437 | } |
424 | 438 | ||
425 | public override InventoryFolderBase GetRootFolder(UUID userID) | 439 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) |
426 | { | 440 | { |
427 | return null; | 441 | return new List<InventoryItemBase>(); |
428 | } | 442 | } |
429 | 443 | ||
430 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 444 | public override int GetAssetPermissions(UUID userID, UUID assetID) |
431 | { | 445 | { |
432 | return new List<InventoryItemBase>(); | 446 | if (IsLocalGridUser(userID)) |
447 | return m_GridService.GetAssetPermissions(userID, assetID); | ||
448 | else | ||
449 | { | ||
450 | UUID sessionID = GetSessionID(userID); | ||
451 | string uri = GetUserInventoryURI(userID) + "/" + userID.ToString(); | ||
452 | return m_HGService.GetAssetPermissions(uri, assetID, sessionID); | ||
453 | } | ||
433 | } | 454 | } |
434 | 455 | ||
435 | #endregion | 456 | #endregion |
436 | 457 | ||
437 | private UUID GetSessionID(UUID userID) | 458 | private UUID GetSessionID(UUID userID) |
438 | { | 459 | { |
439 | ScenePresence sp = m_Scene.GetScenePresence(userID); | 460 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); |
440 | if (sp != null) | 461 | if (uinfo != null) |
441 | return sp.ControllingClient.SessionId; | 462 | return uinfo.SessionID; |
442 | 463 | ||
464 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: user profile for {0} not found", userID); | ||
443 | return UUID.Zero; | 465 | return UUID.Zero; |
444 | } | 466 | } |
445 | 467 | ||
446 | private bool IsLocalGridUser(UUID userID) | 468 | private bool IsLocalGridUser(UUID userID) |
447 | { | 469 | { |
448 | if (m_UserProfileService == null) | 470 | if (m_UserProfileService == null) |
471 | { | ||
472 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile service. Returning false."); | ||
449 | return false; | 473 | return false; |
474 | } | ||
450 | 475 | ||
451 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); | 476 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); |
452 | if (uinfo == null) | 477 | if (uinfo == null) |
478 | { | ||
479 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, no profile for user {0}. Returning true.", userID); | ||
453 | return true; | 480 | return true; |
481 | } | ||
454 | 482 | ||
455 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); | 483 | string userInventoryServerURI = HGNetworkServersInfo.ServerURI(uinfo.UserProfile.UserInventoryURI); |
484 | string uri = m_LocalGridInventoryURI.TrimEnd('/'); | ||
485 | |||
486 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: IsLocalGridUser, comparing {0} to {1}.", userInventoryServerURI, uri); | ||
456 | 487 | ||
457 | if ((userInventoryServerURI == m_LocalGridInventoryURI) || (userInventoryServerURI == "")) | 488 | if ((userInventoryServerURI == uri) || (userInventoryServerURI == "")) |
458 | { | 489 | { |
459 | return true; | 490 | return true; |
460 | } | 491 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index c16e92e..c8f04a5 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -91,6 +91,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
91 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); | 91 | Dictionary<AssetType, InventoryFolderBase> folders = m_Connector.GetSystemFolders(presence.UUID); |
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", |
93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); | 93 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
94 | |||
94 | if (folders.Count > 0) | 95 | if (folders.Count > 0) |
95 | lock (m_InventoryCache) | 96 | lock (m_InventoryCache) |
96 | m_InventoryCache.Add(presence.UUID, folders); | 97 | m_InventoryCache.Add(presence.UUID, folders); |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs index 6efe903..2fbc5fe 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/LocalInventoryServiceConnector.cs | |||
@@ -201,8 +201,15 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
201 | foreach (InventoryFolderBase folder in content.Folders) | 201 | foreach (InventoryFolderBase folder in content.Folders) |
202 | { | 202 | { |
203 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) | 203 | if ((folder.Type != (short)AssetType.Folder) && (folder.Type != (short)AssetType.Unknown)) |
204 | { | ||
205 | m_log.InfoFormat("[INVENTORY CONNECTOR]: folder type {0} ", folder.Type); | ||
204 | folders[(AssetType)folder.Type] = folder; | 206 | folders[(AssetType)folder.Type] = folder; |
207 | } | ||
205 | } | 208 | } |
209 | // Put the root folder there, as type Folder | ||
210 | folders[AssetType.Folder] = root; | ||
211 | m_log.InfoFormat("[INVENTORY CONNECTOR]: root folder is type {0} ", root.Type); | ||
212 | |||
206 | return folders; | 213 | return folders; |
207 | } | 214 | } |
208 | } | 215 | } |
@@ -292,14 +299,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
292 | return m_InventoryService.DeleteItem(item); | 299 | return m_InventoryService.DeleteItem(item); |
293 | } | 300 | } |
294 | 301 | ||
295 | public override InventoryItemBase QueryItem(InventoryItemBase item) | 302 | public override InventoryItemBase GetItem(InventoryItemBase item) |
296 | { | 303 | { |
297 | return m_InventoryService.QueryItem(item); | 304 | return m_InventoryService.GetItem(item); |
298 | } | 305 | } |
299 | 306 | ||
300 | public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 307 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
301 | { | 308 | { |
302 | return m_InventoryService.QueryFolder(folder); | 309 | return m_InventoryService.GetFolder(folder); |
303 | } | 310 | } |
304 | 311 | ||
305 | /// <summary> | 312 | /// <summary> |
@@ -312,19 +319,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
312 | return m_InventoryService.HasInventoryForUser(userID); | 319 | return m_InventoryService.HasInventoryForUser(userID); |
313 | } | 320 | } |
314 | 321 | ||
315 | /// <summary> | 322 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) |
316 | /// Retrieve the root inventory folder for the given user. | ||
317 | /// </summary> | ||
318 | /// <param name="userID"></param> | ||
319 | /// <returns>null if no root folder was found</returns> | ||
320 | public override InventoryFolderBase GetRootFolder(UUID userID) | ||
321 | { | 323 | { |
322 | return m_InventoryService.GetRootFolder(userID); | 324 | return m_InventoryService.GetActiveGestures(userId); |
323 | } | 325 | } |
324 | 326 | ||
325 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 327 | public override int GetAssetPermissions(UUID userID, UUID assetID) |
326 | { | 328 | { |
327 | return m_InventoryService.GetActiveGestures(userId); | 329 | return m_InventoryService.GetAssetPermissions(userID, assetID); |
328 | } | 330 | } |
329 | #endregion IInventoryService | 331 | #endregion IInventoryService |
330 | } | 332 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs index f87aab9..bef716b 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteInventoryServiceConnector.cs | |||
@@ -32,6 +32,7 @@ using System.Reflection; | |||
32 | using Nini.Config; | 32 | using Nini.Config; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Statistics; | 34 | using OpenSim.Framework.Statistics; |
35 | using OpenSim.Framework.Communications.Cache; | ||
35 | using OpenSim.Services.Connectors; | 36 | using OpenSim.Services.Connectors; |
36 | using OpenSim.Region.Framework.Interfaces; | 37 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 38 | using OpenSim.Region.Framework.Scenes; |
@@ -48,6 +49,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
48 | private bool m_Enabled = false; | 49 | private bool m_Enabled = false; |
49 | private bool m_Initialized = false; | 50 | private bool m_Initialized = false; |
50 | private Scene m_Scene; | 51 | private Scene m_Scene; |
52 | private UserProfileCacheService m_UserProfileService; | ||
51 | private InventoryServicesConnector m_RemoteConnector; | 53 | private InventoryServicesConnector m_RemoteConnector; |
52 | 54 | ||
53 | public Type ReplaceableInterface | 55 | public Type ReplaceableInterface |
@@ -104,12 +106,14 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
104 | 106 | ||
105 | public void AddRegion(Scene scene) | 107 | public void AddRegion(Scene scene) |
106 | { | 108 | { |
109 | m_Scene = scene; | ||
110 | m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | ||
111 | |||
107 | if (!m_Enabled) | 112 | if (!m_Enabled) |
108 | return; | 113 | return; |
109 | 114 | ||
110 | if (!m_Initialized) | 115 | if (!m_Initialized) |
111 | { | 116 | { |
112 | m_Scene = scene; | ||
113 | // ugh! | 117 | // ugh! |
114 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); | 118 | scene.CommsManager.UserProfileCacheService.SetInventoryService(this); |
115 | scene.CommsManager.UserService.SetInventoryService(this); | 119 | scene.CommsManager.UserService.SetInventoryService(this); |
@@ -130,6 +134,10 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
130 | 134 | ||
131 | public void RegionLoaded(Scene scene) | 135 | public void RegionLoaded(Scene scene) |
132 | { | 136 | { |
137 | m_UserProfileService = m_Scene.CommsManager.UserProfileCacheService; | ||
138 | if (m_UserProfileService != null) | ||
139 | m_log.Debug("[XXXX] Set m_UserProfileService in " + m_Scene.RegionInfo.RegionName); | ||
140 | |||
133 | if (!m_Enabled) | 141 | if (!m_Enabled) |
134 | return; | 142 | return; |
135 | 143 | ||
@@ -273,7 +281,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
273 | return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); | 281 | return m_RemoteConnector.DeleteItem(item.Owner.ToString(), item, sessionID); |
274 | } | 282 | } |
275 | 283 | ||
276 | public override InventoryItemBase QueryItem(InventoryItemBase item) | 284 | public override InventoryItemBase GetItem(InventoryItemBase item) |
277 | { | 285 | { |
278 | if (item == null) | 286 | if (item == null) |
279 | return null; | 287 | return null; |
@@ -282,7 +290,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
282 | return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); | 290 | return m_RemoteConnector.QueryItem(item.Owner.ToString(), item, sessionID); |
283 | } | 291 | } |
284 | 292 | ||
285 | public override InventoryFolderBase QueryFolder(InventoryFolderBase folder) | 293 | public override InventoryFolderBase GetFolder(InventoryFolderBase folder) |
286 | { | 294 | { |
287 | if (folder == null) | 295 | if (folder == null) |
288 | return null; | 296 | return null; |
@@ -296,25 +304,39 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
296 | return false; | 304 | return false; |
297 | } | 305 | } |
298 | 306 | ||
299 | public override InventoryFolderBase GetRootFolder(UUID userID) | 307 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) |
300 | { | 308 | { |
301 | return null; | 309 | return new List<InventoryItemBase>(); |
302 | } | 310 | } |
303 | 311 | ||
304 | public override List<InventoryItemBase> GetActiveGestures(UUID userId) | 312 | public override int GetAssetPermissions(UUID userID, UUID assetID) |
305 | { | 313 | { |
306 | return new List<InventoryItemBase>(); | 314 | UUID sessionID = GetSessionID(userID); |
315 | return m_RemoteConnector.GetAssetPermissions(userID.ToString(), assetID, sessionID); | ||
307 | } | 316 | } |
308 | 317 | ||
318 | |||
309 | #endregion | 319 | #endregion |
310 | 320 | ||
311 | private UUID GetSessionID(UUID userID) | 321 | private UUID GetSessionID(UUID userID) |
312 | { | 322 | { |
313 | ScenePresence sp = m_Scene.GetScenePresence(userID); | 323 | if (m_Scene == null) |
314 | if (sp != null) | 324 | { |
315 | return sp.ControllingClient.SessionId; | 325 | m_log.Debug("[INVENTORY CONNECTOR]: OOPS! scene is null"); |
326 | } | ||
316 | 327 | ||
328 | if (m_UserProfileService == null) | ||
329 | { | ||
330 | m_log.Debug("[INVENTORY CONNECTOR]: OOPS! UserProfileCacheService is null"); | ||
331 | return UUID.Zero; | ||
332 | } | ||
333 | |||
334 | CachedUserInfo uinfo = m_UserProfileService.GetUserDetails(userID); | ||
335 | if (uinfo != null) | ||
336 | return uinfo.SessionID; | ||
337 | m_log.DebugFormat("[INVENTORY CONNECTOR]: user profile for {0} not found", userID); | ||
317 | return UUID.Zero; | 338 | return UUID.Zero; |
339 | |||
318 | } | 340 | } |
319 | 341 | ||
320 | } | 342 | } |
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 6db9cbf..9c71b41 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -35,6 +35,7 @@ using OpenSim.Framework; | |||
35 | using OpenSim.Framework.Communications.Cache; | 35 | using OpenSim.Framework.Communications.Cache; |
36 | using OpenSim.Region.Framework.Interfaces; | 36 | using OpenSim.Region.Framework.Interfaces; |
37 | using OpenSim.Region.Framework.Scenes; | 37 | using OpenSim.Region.Framework.Scenes; |
38 | using OpenSim.Services.Interfaces; | ||
38 | 39 | ||
39 | // Temporary fix of wrong GroupPowers constants in OpenMetaverse library | 40 | // Temporary fix of wrong GroupPowers constants in OpenMetaverse library |
40 | enum GroupPowers : long | 41 | enum GroupPowers : long |
@@ -964,19 +965,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
964 | 965 | ||
965 | if (objectID == UUID.Zero) // User inventory | 966 | if (objectID == UUID.Zero) // User inventory |
966 | { | 967 | { |
967 | CachedUserInfo userInfo = | 968 | IInventoryService invService = m_scene.InventoryService; |
968 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 969 | InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); |
969 | |||
970 | if (userInfo == null) | ||
971 | { | ||
972 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for edit notecard check", user); | ||
973 | return false; | ||
974 | } | ||
975 | |||
976 | if (userInfo.RootFolder == null) | ||
977 | return false; | ||
978 | |||
979 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard); | ||
980 | if (assetRequestItem == null) // Library item | 970 | if (assetRequestItem == null) // Library item |
981 | { | 971 | { |
982 | assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 972 | assetRequestItem = scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); |
@@ -1394,19 +1384,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1394 | 1384 | ||
1395 | if (objectID == UUID.Zero) // User inventory | 1385 | if (objectID == UUID.Zero) // User inventory |
1396 | { | 1386 | { |
1397 | CachedUserInfo userInfo = | 1387 | IInventoryService invService = m_scene.InventoryService; |
1398 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 1388 | InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(script)); |
1399 | |||
1400 | if (userInfo == null) | ||
1401 | { | ||
1402 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for administrator check", user); | ||
1403 | return false; | ||
1404 | } | ||
1405 | |||
1406 | if (userInfo.RootFolder == null) | ||
1407 | return false; | ||
1408 | |||
1409 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(script); | ||
1410 | if (assetRequestItem == null) // Library item | 1389 | if (assetRequestItem == null) // Library item |
1411 | { | 1390 | { |
1412 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); | 1391 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(script); |
@@ -1499,19 +1478,8 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1499 | 1478 | ||
1500 | if (objectID == UUID.Zero) // User inventory | 1479 | if (objectID == UUID.Zero) // User inventory |
1501 | { | 1480 | { |
1502 | CachedUserInfo userInfo = | 1481 | IInventoryService invService = m_scene.InventoryService; |
1503 | scene.CommsManager.UserProfileCacheService.GetUserDetails(user); | 1482 | InventoryItemBase assetRequestItem = invService.GetItem(new InventoryItemBase(notecard)); |
1504 | |||
1505 | if (userInfo == null) | ||
1506 | { | ||
1507 | m_log.ErrorFormat("[PERMISSIONS]: Could not find user {0} for view notecard check", user); | ||
1508 | return false; | ||
1509 | } | ||
1510 | |||
1511 | if (userInfo.RootFolder == null) | ||
1512 | return false; | ||
1513 | |||
1514 | InventoryItemBase assetRequestItem = userInfo.RootFolder.FindItem(notecard); | ||
1515 | if (assetRequestItem == null) // Library item | 1483 | if (assetRequestItem == null) // Library item |
1516 | { | 1484 | { |
1517 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); | 1485 | assetRequestItem = m_scene.CommsManager.UserProfileCacheService.LibraryRoot.FindItem(notecard); |
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index 62779e7..e9c35e9 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs | |||
@@ -107,6 +107,7 @@ namespace OpenSim.Region.Examples.SimpleModule | |||
107 | public event UpdateShape OnUpdatePrimShape; | 107 | public event UpdateShape OnUpdatePrimShape; |
108 | public event ObjectExtraParams OnUpdateExtraParams; | 108 | public event ObjectExtraParams OnUpdateExtraParams; |
109 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 109 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
110 | public event ObjectRequest OnObjectRequest; | ||
110 | public event ObjectSelect OnObjectSelect; | 111 | public event ObjectSelect OnObjectSelect; |
111 | public event GenericCall7 OnObjectDescription; | 112 | public event GenericCall7 OnObjectDescription; |
112 | public event GenericCall7 OnObjectName; | 113 | public event GenericCall7 OnObjectName; |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 7bbe045..287d8d9 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
63 | public delegate void OnNewClientDelegate(IClientAPI client); | 63 | public delegate void OnNewClientDelegate(IClientAPI client); |
64 | 64 | ||
65 | /// <summary> | 65 | /// <summary> |
66 | /// Depreciated in favour of OnClientConnect. | 66 | /// Deprecated in favour of OnClientConnect. |
67 | /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. | 67 | /// Will be marked Obsolete after IClientCore has 100% of IClientAPI interfaces. |
68 | /// </summary> | 68 | /// </summary> |
69 | public event OnNewClientDelegate OnNewClient; | 69 | public event OnNewClientDelegate OnNewClient; |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs index 4224198..5d65f98 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGAssetMapper.cs | |||
@@ -201,31 +201,31 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) | 204 | //public InventoryItemBase Get(InventoryItemBase item, UUID rootFolder, CachedUserInfo userInfo) |
205 | { | 205 | //{ |
206 | InventoryClient invCli = null; | 206 | // InventoryClient invCli = null; |
207 | string inventoryURL = UserInventoryURL(item.Owner); | 207 | // string inventoryURL = UserInventoryURL(item.Owner); |
208 | if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) | 208 | // if (!m_inventoryServers.TryGetValue(inventoryURL, out invCli)) |
209 | { | 209 | // { |
210 | m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL); | 210 | // m_log.Debug("[HGScene]: Starting new InventorytClient for " + inventoryURL); |
211 | invCli = new InventoryClient(inventoryURL); | 211 | // invCli = new InventoryClient(inventoryURL); |
212 | m_inventoryServers.Add(inventoryURL, invCli); | 212 | // m_inventoryServers.Add(inventoryURL, invCli); |
213 | } | 213 | // } |
214 | 214 | ||
215 | item = invCli.GetInventoryItem(item); | 215 | // item = invCli.GetInventoryItem(item); |
216 | if (item != null) | 216 | // if (item != null) |
217 | { | 217 | // { |
218 | // Change the folder, stick it in root folder, all items flattened out here in this region cache | 218 | // // Change the folder, stick it in root folder, all items flattened out here in this region cache |
219 | item.Folder = rootFolder; | 219 | // item.Folder = rootFolder; |
220 | //userInfo.AddItem(item); don't use this, it calls back to the inventory server | 220 | // //userInfo.AddItem(item); don't use this, it calls back to the inventory server |
221 | lock (userInfo.RootFolder.Items) | 221 | // lock (userInfo.RootFolder.Items) |
222 | { | 222 | // { |
223 | userInfo.RootFolder.Items[item.ID] = item; | 223 | // userInfo.RootFolder.Items[item.ID] = item; |
224 | } | 224 | // } |
225 | 225 | ||
226 | } | 226 | // } |
227 | return item; | 227 | // return item; |
228 | } | 228 | //} |
229 | 229 | ||
230 | public void Post(UUID assetID, UUID ownerID) | 230 | public void Post(UUID assetID, UUID ownerID) |
231 | { | 231 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs index cb6794e..dd6928f 100644 --- a/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Hypergrid/HGScene.Inventory.cs | |||
@@ -117,25 +117,20 @@ namespace OpenSim.Region.Framework.Scenes.Hypergrid | |||
117 | 117 | ||
118 | if (fromTaskID.Equals(UUID.Zero)) | 118 | if (fromTaskID.Equals(UUID.Zero)) |
119 | { | 119 | { |
120 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 120 | InventoryItemBase item = new InventoryItemBase(itemID); |
121 | if (userInfo != null) | 121 | item.Owner = remoteClient.AgentId; |
122 | item = InventoryService.GetItem(item); | ||
123 | //if (item == null) | ||
124 | //{ // Fetch the item | ||
125 | // item = new InventoryItemBase(); | ||
126 | // item.Owner = remoteClient.AgentId; | ||
127 | // item.ID = itemID; | ||
128 | // item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
129 | //} | ||
130 | if (item != null) | ||
122 | { | 131 | { |
123 | if (userInfo.RootFolder != null) | 132 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); |
124 | { | 133 | |
125 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | ||
126 | if (item == null) | ||
127 | { // Fetch the item | ||
128 | item = new InventoryItemBase(); | ||
129 | item.Owner = remoteClient.AgentId; | ||
130 | item.ID = itemID; | ||
131 | item = m_assMapper.Get(item, userInfo.RootFolder.ID, userInfo); | ||
132 | } | ||
133 | if (item != null) | ||
134 | { | ||
135 | m_assMapper.Get(item.AssetID, remoteClient.AgentId); | ||
136 | |||
137 | } | ||
138 | } | ||
139 | } | 134 | } |
140 | } | 135 | } |
141 | 136 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index facd301..46777e1 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -80,17 +80,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
80 | 80 | ||
81 | public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) | 81 | public bool AddInventoryItemReturned(UUID AgentId, InventoryItemBase item) |
82 | { | 82 | { |
83 | CachedUserInfo userInfo | 83 | if (InventoryService.AddItem(item)) |
84 | = CommsManager.UserProfileCacheService.GetUserDetails(AgentId); | ||
85 | if (userInfo != null) | ||
86 | { | ||
87 | userInfo.AddItem(item); | ||
88 | return true; | 84 | return true; |
89 | } | ||
90 | else | 85 | else |
91 | { | 86 | { |
92 | m_log.ErrorFormat( | 87 | m_log.WarnFormat( |
93 | "[AGENT INVENTORY]: Agent was not found for add of item {1} {2}", item.Name, item.ID); | 88 | "[AGENT INVENTORY]: Unable to add item {1} to agent {2} inventory", item.Name, AgentId); |
94 | 89 | ||
95 | return false; | 90 | return false; |
96 | } | 91 | } |
@@ -98,13 +93,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
98 | 93 | ||
99 | public void AddInventoryItem(UUID AgentID, InventoryItemBase item) | 94 | public void AddInventoryItem(UUID AgentID, InventoryItemBase item) |
100 | { | 95 | { |
101 | CachedUserInfo userInfo | ||
102 | = CommsManager.UserProfileCacheService.GetUserDetails(AgentID); | ||
103 | 96 | ||
104 | if (userInfo != null) | 97 | if (InventoryService.AddItem(item)) |
105 | { | 98 | { |
106 | userInfo.AddItem(item); | ||
107 | |||
108 | int userlevel = 0; | 99 | int userlevel = 0; |
109 | if (Permissions.IsGod(AgentID)) | 100 | if (Permissions.IsGod(AgentID)) |
110 | { | 101 | { |
@@ -120,8 +111,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
120 | } | 111 | } |
121 | else | 112 | else |
122 | { | 113 | { |
123 | m_log.ErrorFormat( | 114 | m_log.WarnFormat( |
124 | "[AGENT INVENTORY]: Agent {1} was not found for add of item {2} {3}", | 115 | "[AGENT INVENTORY]: Agent {1} could not add item {2} {3}", |
125 | AgentID, item.Name, item.ID); | 116 | AgentID, item.Name, item.ID); |
126 | 117 | ||
127 | return; | 118 | return; |
@@ -136,20 +127,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | /// in which the item is to be placed.</param> | 127 | /// in which the item is to be placed.</param> |
137 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) | 128 | public void AddInventoryItem(IClientAPI remoteClient, InventoryItemBase item) |
138 | { | 129 | { |
139 | CachedUserInfo userInfo | 130 | AddInventoryItem(remoteClient.AgentId, item); |
140 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 131 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
141 | |||
142 | if (userInfo != null) | ||
143 | { | ||
144 | AddInventoryItem(remoteClient.AgentId, item); | ||
145 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | m_log.ErrorFormat( | ||
150 | "[AGENT INVENTORY]: Could not resolve user {0} for adding an inventory item", | ||
151 | remoteClient.AgentId); | ||
152 | } | ||
153 | } | 132 | } |
154 | 133 | ||
155 | /// <summary> | 134 | /// <summary> |
@@ -161,47 +140,40 @@ namespace OpenSim.Region.Framework.Scenes | |||
161 | /// <returns></returns> | 140 | /// <returns></returns> |
162 | public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) | 141 | public virtual UUID CapsUpdateInventoryItemAsset(IClientAPI remoteClient, UUID itemID, byte[] data) |
163 | { | 142 | { |
164 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 143 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
165 | if (userInfo != null) | 144 | |
145 | if (item != null) | ||
166 | { | 146 | { |
167 | if (userInfo.RootFolder != null) | 147 | if ((InventoryType)item.InvType == InventoryType.Notecard) |
168 | { | 148 | { |
169 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 149 | if (!Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) |
170 | |||
171 | if (item != null) | ||
172 | { | 150 | { |
173 | if ((InventoryType)item.InvType == InventoryType.Notecard) | 151 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); |
174 | { | 152 | return UUID.Zero; |
175 | if (!Permissions.CanEditNotecard(itemID, UUID.Zero, remoteClient.AgentId)) | 153 | } |
176 | { | ||
177 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit notecard", false); | ||
178 | return UUID.Zero; | ||
179 | } | ||
180 | 154 | ||
181 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | 155 | remoteClient.SendAgentAlertMessage("Notecard saved", false); |
182 | } | 156 | } |
183 | else if ((InventoryType)item.InvType == InventoryType.LSL) | 157 | else if ((InventoryType)item.InvType == InventoryType.LSL) |
184 | { | 158 | { |
185 | if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) | 159 | if (!Permissions.CanEditScript(itemID, UUID.Zero, remoteClient.AgentId)) |
186 | { | 160 | { |
187 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); | 161 | remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); |
188 | return UUID.Zero; | 162 | return UUID.Zero; |
189 | } | 163 | } |
190 | 164 | ||
191 | remoteClient.SendAgentAlertMessage("Script saved", false); | 165 | remoteClient.SendAgentAlertMessage("Script saved", false); |
192 | } | 166 | } |
193 | 167 | ||
194 | AssetBase asset = | 168 | AssetBase asset = |
195 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); | 169 | CreateAsset(item.Name, item.Description, (sbyte)item.AssetType, data); |
196 | item.AssetID = asset.FullID; | 170 | item.AssetID = asset.FullID; |
197 | AssetService.Store(asset); | 171 | AssetService.Store(asset); |
198 | 172 | ||
199 | userInfo.UpdateItem(item); | 173 | InventoryService.UpdateItem(item); |
200 | 174 | ||
201 | // remoteClient.SendInventoryItemCreateUpdate(item); | 175 | // remoteClient.SendInventoryItemCreateUpdate(item); |
202 | return (asset.FullID); | 176 | return (asset.FullID); |
203 | } | ||
204 | } | ||
205 | } | 177 | } |
206 | else | 178 | else |
207 | { | 179 | { |
@@ -343,63 +315,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
343 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, | 315 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, |
344 | UUID itemID, InventoryItemBase itemUpd) | 316 | UUID itemID, InventoryItemBase itemUpd) |
345 | { | 317 | { |
346 | CachedUserInfo userInfo | 318 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
347 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
348 | 319 | ||
349 | if (userInfo != null && userInfo.RootFolder != null) | 320 | if (item != null) |
350 | { | 321 | { |
351 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 322 | if (UUID.Zero == transactionID) |
352 | |||
353 | if (item != null) | ||
354 | { | 323 | { |
355 | if (UUID.Zero == transactionID) | 324 | item.Name = itemUpd.Name; |
356 | { | 325 | item.Description = itemUpd.Description; |
357 | item.Name = itemUpd.Name; | 326 | item.NextPermissions = itemUpd.NextPermissions; |
358 | item.Description = itemUpd.Description; | 327 | item.CurrentPermissions |= 8; // Slam! |
359 | item.NextPermissions = itemUpd.NextPermissions; | 328 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; |
360 | item.CurrentPermissions |= 8; // Slam! | 329 | item.GroupPermissions = itemUpd.GroupPermissions; |
361 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; | ||
362 | item.GroupPermissions = itemUpd.GroupPermissions; | ||
363 | |||
364 | item.GroupID = itemUpd.GroupID; | ||
365 | item.GroupOwned = itemUpd.GroupOwned; | ||
366 | item.CreationDate = itemUpd.CreationDate; | ||
367 | // The client sends zero if its newly created? | ||
368 | |||
369 | if (itemUpd.CreationDate == 0) | ||
370 | item.CreationDate = Util.UnixTimeSinceEpoch(); | ||
371 | else | ||
372 | item.CreationDate = itemUpd.CreationDate; | ||
373 | 330 | ||
374 | // TODO: Check if folder changed and move item | 331 | item.GroupID = itemUpd.GroupID; |
375 | //item.NextPermissions = itemUpd.Folder; | 332 | item.GroupOwned = itemUpd.GroupOwned; |
376 | item.InvType = itemUpd.InvType; | 333 | item.CreationDate = itemUpd.CreationDate; |
377 | item.SalePrice = itemUpd.SalePrice; | 334 | // The client sends zero if its newly created? |
378 | item.SaleType = itemUpd.SaleType; | ||
379 | item.Flags = itemUpd.Flags; | ||
380 | 335 | ||
381 | userInfo.UpdateItem(item); | 336 | if (itemUpd.CreationDate == 0) |
382 | } | 337 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
383 | else | 338 | else |
384 | { | 339 | item.CreationDate = itemUpd.CreationDate; |
385 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); | 340 | |
386 | if (agentTransactions != null) | 341 | // TODO: Check if folder changed and move item |
387 | { | 342 | //item.NextPermissions = itemUpd.Folder; |
388 | agentTransactions.HandleItemUpdateFromTransaction( | 343 | item.InvType = itemUpd.InvType; |
389 | remoteClient, transactionID, item); | 344 | item.SalePrice = itemUpd.SalePrice; |
390 | } | 345 | item.SaleType = itemUpd.SaleType; |
391 | } | 346 | item.Flags = itemUpd.Flags; |
347 | |||
348 | InventoryService.UpdateItem(item); | ||
392 | } | 349 | } |
393 | else | 350 | else |
394 | { | 351 | { |
395 | m_log.Error( | 352 | IAgentAssetTransactions agentTransactions = this.RequestModuleInterface<IAgentAssetTransactions>(); |
396 | "[AGENTINVENTORY]: Item ID " + itemID + " not found for an inventory item update."); | 353 | if (agentTransactions != null) |
354 | { | ||
355 | agentTransactions.HandleItemUpdateFromTransaction( | ||
356 | remoteClient, transactionID, item); | ||
357 | } | ||
397 | } | 358 | } |
398 | } | 359 | } |
399 | else | 360 | else |
400 | { | 361 | { |
401 | m_log.Error( | 362 | m_log.Error( |
402 | "[AGENT INVENTORY]: Agent ID " + remoteClient.AgentId + " not found for an inventory item update."); | 363 | "[AGENTINVENTORY]: Item ID " + itemID + " not found for an inventory item update."); |
403 | } | 364 | } |
404 | } | 365 | } |
405 | 366 | ||
@@ -445,123 +406,85 @@ namespace OpenSim.Region.Framework.Scenes | |||
445 | public virtual InventoryItemBase GiveInventoryItem( | 406 | public virtual InventoryItemBase GiveInventoryItem( |
446 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) | 407 | UUID recipient, UUID senderId, UUID itemId, UUID recipientFolderId) |
447 | { | 408 | { |
448 | // Retrieve the item from the sender | ||
449 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); | ||
450 | |||
451 | Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); | 409 | Console.WriteLine("Scene.Inventory.cs: GiveInventoryItem"); |
452 | 410 | ||
453 | if (senderUserInfo == null) | 411 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemId)); |
454 | { | ||
455 | m_log.ErrorFormat( | ||
456 | "[AGENT INVENTORY]: Failed to find sending user {0} for item {1}", senderId, itemId); | ||
457 | |||
458 | return null; | ||
459 | } | ||
460 | 412 | ||
461 | if (senderUserInfo.RootFolder != null) | 413 | if ((item != null) && (item.Owner == senderId)) |
462 | { | 414 | { |
463 | InventoryItemBase item = senderUserInfo.RootFolder.FindItem(itemId); | 415 | if (!Permissions.BypassPermissions()) |
464 | |||
465 | if (item != null) | ||
466 | { | 416 | { |
467 | if (!Permissions.BypassPermissions()) | 417 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) |
468 | { | 418 | return null; |
469 | if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) | 419 | } |
470 | return null; | ||
471 | } | ||
472 | 420 | ||
473 | CachedUserInfo recipientUserInfo | 421 | // Insert a copy of the item into the recipient |
474 | = CommsManager.UserProfileCacheService.GetUserDetails(recipient); | 422 | InventoryItemBase itemCopy = new InventoryItemBase(); |
423 | itemCopy.Owner = recipient; | ||
424 | itemCopy.CreatorId = item.CreatorId; | ||
425 | itemCopy.ID = UUID.Random(); | ||
426 | itemCopy.AssetID = item.AssetID; | ||
427 | itemCopy.Description = item.Description; | ||
428 | itemCopy.Name = item.Name; | ||
429 | itemCopy.AssetType = item.AssetType; | ||
430 | itemCopy.InvType = item.InvType; | ||
431 | itemCopy.Folder = recipientFolderId; | ||
475 | 432 | ||
476 | if (recipientUserInfo != null) | 433 | if (Permissions.PropagatePermissions()) |
434 | { | ||
435 | if (item.InvType == (int)InventoryType.Object) | ||
477 | { | 436 | { |
478 | if (!recipientUserInfo.HasReceivedInventory) | 437 | itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); |
479 | recipientUserInfo.FetchInventory(); | 438 | itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; |
480 | |||
481 | // Insert a copy of the item into the recipient | ||
482 | InventoryItemBase itemCopy = new InventoryItemBase(); | ||
483 | itemCopy.Owner = recipient; | ||
484 | itemCopy.CreatorId = item.CreatorId; | ||
485 | itemCopy.ID = UUID.Random(); | ||
486 | itemCopy.AssetID = item.AssetID; | ||
487 | itemCopy.Description = item.Description; | ||
488 | itemCopy.Name = item.Name; | ||
489 | itemCopy.AssetType = item.AssetType; | ||
490 | itemCopy.InvType = item.InvType; | ||
491 | itemCopy.Folder = recipientFolderId; | ||
492 | |||
493 | if (Permissions.PropagatePermissions()) | ||
494 | { | ||
495 | if (item.InvType == (int)InventoryType.Object) | ||
496 | { | ||
497 | itemCopy.BasePermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | ||
498 | itemCopy.BasePermissions |= (item.CurrentPermissions & 7) << 13; | ||
499 | } | ||
500 | else | ||
501 | { | ||
502 | itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; | ||
503 | } | ||
504 | |||
505 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; | ||
506 | if ((item.CurrentPermissions & 8) != 0) // Propagate slam bit | ||
507 | { | ||
508 | itemCopy.BasePermissions &= item.NextPermissions; | ||
509 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; | ||
510 | itemCopy.CurrentPermissions |= 8; | ||
511 | } | ||
512 | |||
513 | itemCopy.NextPermissions = item.NextPermissions; | ||
514 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | ||
515 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; | ||
516 | } | ||
517 | else | ||
518 | { | ||
519 | itemCopy.CurrentPermissions = item.CurrentPermissions; | ||
520 | itemCopy.NextPermissions = item.NextPermissions; | ||
521 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | ||
522 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; | ||
523 | itemCopy.BasePermissions = item.BasePermissions; | ||
524 | } | ||
525 | |||
526 | itemCopy.GroupID = UUID.Zero; | ||
527 | itemCopy.GroupOwned = false; | ||
528 | itemCopy.Flags = item.Flags; | ||
529 | itemCopy.SalePrice = item.SalePrice; | ||
530 | itemCopy.SaleType = item.SaleType; | ||
531 | |||
532 | recipientUserInfo.AddItem(itemCopy); | ||
533 | |||
534 | if (!Permissions.BypassPermissions()) | ||
535 | { | ||
536 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
537 | senderUserInfo.DeleteItem(itemId); | ||
538 | } | ||
539 | |||
540 | return itemCopy; | ||
541 | } | 439 | } |
542 | else | 440 | else |
543 | { | 441 | { |
544 | m_log.ErrorFormat( | 442 | itemCopy.BasePermissions = item.BasePermissions & item.NextPermissions; |
545 | "[AGENT INVENTORY]: Could not find userinfo for recipient user {0} of item {1}, {2} from {3}", | 443 | } |
546 | recipient, item.Name, | 444 | |
547 | item.ID, senderId); | 445 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; |
446 | if ((item.CurrentPermissions & 8) != 0) // Propagate slam bit | ||
447 | { | ||
448 | itemCopy.BasePermissions &= item.NextPermissions; | ||
449 | itemCopy.CurrentPermissions = itemCopy.BasePermissions; | ||
450 | itemCopy.CurrentPermissions |= 8; | ||
548 | } | 451 | } |
452 | |||
453 | itemCopy.NextPermissions = item.NextPermissions; | ||
454 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | ||
455 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; | ||
549 | } | 456 | } |
550 | else | 457 | else |
551 | { | 458 | { |
552 | m_log.ErrorFormat( | 459 | itemCopy.CurrentPermissions = item.CurrentPermissions; |
553 | "[AGENT INVENTORY]: Failed to find item {0} to give to {1}", itemId, senderId); | 460 | itemCopy.NextPermissions = item.NextPermissions; |
461 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & item.NextPermissions; | ||
462 | itemCopy.GroupPermissions = item.GroupPermissions & item.NextPermissions; | ||
463 | itemCopy.BasePermissions = item.BasePermissions; | ||
464 | } | ||
465 | |||
466 | itemCopy.GroupID = UUID.Zero; | ||
467 | itemCopy.GroupOwned = false; | ||
468 | itemCopy.Flags = item.Flags; | ||
469 | itemCopy.SalePrice = item.SalePrice; | ||
470 | itemCopy.SaleType = item.SaleType; | ||
554 | 471 | ||
555 | return null; | 472 | InventoryService.AddItem(itemCopy); |
473 | |||
474 | if (!Permissions.BypassPermissions()) | ||
475 | { | ||
476 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
477 | InventoryService.DeleteItem(new InventoryItemBase(itemId)); | ||
556 | } | 478 | } |
479 | |||
480 | return itemCopy; | ||
557 | } | 481 | } |
558 | else | 482 | else |
559 | { | 483 | { |
560 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemId.ToString() + ", no root folder"); | 484 | m_log.WarnFormat("[AGENT INVENTORY]: Failed to find item {0} or item does not belong to giver ", itemId); |
561 | return null; | 485 | return null; |
562 | } | 486 | } |
563 | 487 | ||
564 | return null; | ||
565 | } | 488 | } |
566 | 489 | ||
567 | /// <summary> | 490 | /// <summary> |
@@ -578,31 +501,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
578 | /// <returns> | 501 | /// <returns> |
579 | /// The inventory folder copy given, null if the copy was unsuccessful | 502 | /// The inventory folder copy given, null if the copy was unsuccessful |
580 | /// </returns> | 503 | /// </returns> |
581 | public virtual InventoryFolderImpl GiveInventoryFolder( | 504 | public virtual InventoryFolderBase GiveInventoryFolder( |
582 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) | 505 | UUID recipientId, UUID senderId, UUID folderId, UUID recipientParentFolderId) |
583 | { | 506 | { |
584 | // Retrieve the folder from the sender | 507 | //// Retrieve the folder from the sender |
585 | CachedUserInfo senderUserInfo = CommsManager.UserProfileCacheService.GetUserDetails(senderId); | 508 | InventoryFolderBase folder = InventoryService.GetFolder(new InventoryFolderBase(folderId)); |
586 | |||
587 | if (null == senderUserInfo) | ||
588 | { | ||
589 | m_log.ErrorFormat( | ||
590 | "[AGENT INVENTORY]: Failed to find sending user {0} for folder {1}", senderId, folderId); | ||
591 | |||
592 | return null; | ||
593 | } | ||
594 | |||
595 | if (!senderUserInfo.HasReceivedInventory) | ||
596 | { | ||
597 | m_log.DebugFormat( | ||
598 | "[AGENT INVENTORY]: Could not give inventory folder - have not yet received inventory for {0}", | ||
599 | senderId); | ||
600 | |||
601 | return null; | ||
602 | } | ||
603 | |||
604 | InventoryFolderImpl folder = senderUserInfo.RootFolder.FindFolder(folderId); | ||
605 | |||
606 | if (null == folder) | 509 | if (null == folder) |
607 | { | 510 | { |
608 | m_log.ErrorFormat( | 511 | m_log.ErrorFormat( |
@@ -611,48 +514,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | return null; | 514 | return null; |
612 | } | 515 | } |
613 | 516 | ||
614 | CachedUserInfo recipientUserInfo | ||
615 | = CommsManager.UserProfileCacheService.GetUserDetails(recipientId); | ||
616 | |||
617 | if (null == recipientUserInfo) | ||
618 | { | ||
619 | m_log.ErrorFormat( | ||
620 | "[AGENT INVENTORY]: Failed to find receiving user {0} for folder {1}", recipientId, folderId); | ||
621 | |||
622 | return null; | ||
623 | } | ||
624 | 517 | ||
625 | if (!recipientUserInfo.HasReceivedInventory) | 518 | if (recipientParentFolderId == UUID.Zero) |
626 | { | 519 | { |
627 | recipientUserInfo.FetchInventory(); | 520 | InventoryFolderBase recipientRootFolder = InventoryService.GetRootFolder(recipientId); |
628 | if (!WaitForInventory(recipientUserInfo)) | 521 | if (recipientRootFolder != null) |
522 | recipientParentFolderId = recipientRootFolder.ID; | ||
523 | else | ||
524 | { | ||
525 | m_log.WarnFormat("[AGENT INVENTORY]: Unable to find root folder for receiving agent"); | ||
629 | return null; | 526 | return null; |
527 | } | ||
630 | } | 528 | } |
631 | 529 | ||
632 | if (recipientParentFolderId == UUID.Zero) | ||
633 | recipientParentFolderId = recipientUserInfo.RootFolder.ID; | ||
634 | |||
635 | UUID newFolderId = UUID.Random(); | 530 | UUID newFolderId = UUID.Random(); |
636 | recipientUserInfo.CreateFolder(folder.Name, newFolderId, (ushort)folder.Type, recipientParentFolderId); | 531 | InventoryFolderBase newFolder = new InventoryFolderBase(newFolderId, folder.Name, recipientId, folder.Type, recipientParentFolderId, folder.Version); |
637 | 532 | InventoryService.AddFolder(newFolder); | |
638 | // XXX: Messy - we should really get this back in the CreateFolder call | ||
639 | InventoryFolderImpl copiedFolder = recipientUserInfo.RootFolder.FindFolder(newFolderId); | ||
640 | 533 | ||
641 | // Give all the subfolders | 534 | // Give all the subfolders |
642 | List<InventoryFolderImpl> subFolders = folder.RequestListOfFolderImpls(); | 535 | InventoryCollection contents = InventoryService.GetFolderContent(senderId, folderId); |
643 | foreach (InventoryFolderImpl childFolder in subFolders) | 536 | foreach (InventoryFolderBase childFolder in contents.Folders) |
644 | { | 537 | { |
645 | GiveInventoryFolder(recipientId, senderId, childFolder.ID, copiedFolder.ID); | 538 | GiveInventoryFolder(recipientId, senderId, childFolder.ID, newFolder.ID); |
646 | } | 539 | } |
647 | 540 | ||
648 | // Give all the items | 541 | // Give all the items |
649 | List<InventoryItemBase> items = folder.RequestListOfItems(); | 542 | foreach (InventoryItemBase item in contents.Items) |
650 | foreach (InventoryItemBase item in items) | ||
651 | { | 543 | { |
652 | GiveInventoryItem(recipientId, senderId, item.ID, copiedFolder.ID); | 544 | GiveInventoryItem(recipientId, senderId, item.ID, newFolder.ID); |
653 | } | 545 | } |
654 | 546 | ||
655 | return copiedFolder; | 547 | return newFolder; |
656 | } | 548 | } |
657 | 549 | ||
658 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, | 550 | public void CopyInventoryItem(IClientAPI remoteClient, uint callbackID, UUID oldAgentID, UUID oldItemID, |
@@ -666,24 +558,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
666 | 558 | ||
667 | if (item == null) | 559 | if (item == null) |
668 | { | 560 | { |
669 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(oldAgentID); | 561 | item = InventoryService.GetItem(new InventoryItemBase(oldItemID)); |
670 | if (userInfo == null) | ||
671 | { | ||
672 | m_log.Error("[AGENT INVENTORY]: Failed to find user " + oldAgentID.ToString()); | ||
673 | return; | ||
674 | } | ||
675 | |||
676 | if (userInfo.RootFolder != null) | ||
677 | { | ||
678 | item = userInfo.RootFolder.FindItem(oldItemID); | ||
679 | 562 | ||
680 | if (item == null) | 563 | if (item == null) |
681 | { | ||
682 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); | ||
683 | return; | ||
684 | } | ||
685 | } | ||
686 | else | ||
687 | { | 564 | { |
688 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); | 565 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + oldItemID.ToString()); |
689 | return; | 566 | return; |
@@ -759,41 +636,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
759 | m_log.DebugFormat( | 636 | m_log.DebugFormat( |
760 | "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); | 637 | "[AGENT INVENTORY]: Moving item {0} to {1} for {2}", itemID, folderID, remoteClient.AgentId); |
761 | 638 | ||
762 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 639 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
763 | |||
764 | if (userInfo == null) | ||
765 | { | ||
766 | m_log.Error("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); | ||
767 | |||
768 | return; | ||
769 | } | ||
770 | 640 | ||
771 | if (userInfo.RootFolder != null) | 641 | if (item != null) |
772 | { | 642 | { |
773 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 643 | if (newName != String.Empty) |
774 | |||
775 | if (item != null) | ||
776 | { | 644 | { |
777 | if (newName != String.Empty) | 645 | item.Name = newName; |
778 | { | ||
779 | item.Name = newName; | ||
780 | } | ||
781 | item.Folder = folderID; | ||
782 | |||
783 | userInfo.DeleteItem(item.ID); | ||
784 | |||
785 | AddInventoryItem(remoteClient, item); | ||
786 | } | 646 | } |
787 | else | 647 | item.Folder = folderID; |
788 | { | ||
789 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); | ||
790 | 648 | ||
791 | return; | 649 | // Diva comment: can't we just update? |
792 | } | 650 | InventoryService.DeleteItem(item); |
651 | |||
652 | AddInventoryItem(remoteClient, item); | ||
793 | } | 653 | } |
794 | else | 654 | else |
795 | { | 655 | { |
796 | m_log.Error("[AGENT INVENTORY]: Failed to find item " + itemID.ToString() + ", no root folder"); | 656 | m_log.Warn("[AGENT INVENTORY]: Failed to find item " + itemID.ToString()); |
797 | 657 | ||
798 | return; | 658 | return; |
799 | } | 659 | } |
@@ -830,37 +690,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
830 | IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, | 690 | IClientAPI remoteClient, string creatorID, UUID folderID, string name, uint flags, uint callbackID, AssetBase asset, sbyte invType, |
831 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) | 691 | uint baseMask, uint currentMask, uint everyoneMask, uint nextOwnerMask, uint groupMask, int creationDate) |
832 | { | 692 | { |
833 | CachedUserInfo userInfo | 693 | InventoryItemBase item = new InventoryItemBase(); |
834 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 694 | item.Owner = remoteClient.AgentId; |
835 | 695 | item.CreatorId = creatorID; | |
836 | if (userInfo != null) | 696 | item.ID = UUID.Random(); |
837 | { | 697 | item.AssetID = asset.FullID; |
838 | InventoryItemBase item = new InventoryItemBase(); | 698 | item.Description = asset.Description; |
839 | item.Owner = remoteClient.AgentId; | 699 | item.Name = name; |
840 | item.CreatorId = creatorID; | 700 | item.Flags = flags; |
841 | item.ID = UUID.Random(); | 701 | item.AssetType = asset.Type; |
842 | item.AssetID = asset.FullID; | 702 | item.InvType = invType; |
843 | item.Description = asset.Description; | 703 | item.Folder = folderID; |
844 | item.Name = name; | 704 | item.CurrentPermissions = currentMask; |
845 | item.Flags = flags; | 705 | item.NextPermissions = nextOwnerMask; |
846 | item.AssetType = asset.Type; | 706 | item.EveryOnePermissions = everyoneMask; |
847 | item.InvType = invType; | 707 | item.GroupPermissions = groupMask; |
848 | item.Folder = folderID; | 708 | item.BasePermissions = baseMask; |
849 | item.CurrentPermissions = currentMask; | 709 | item.CreationDate = creationDate; |
850 | item.NextPermissions = nextOwnerMask; | 710 | |
851 | item.EveryOnePermissions = everyoneMask; | 711 | if (InventoryService.AddItem(item)) |
852 | item.GroupPermissions = groupMask; | ||
853 | item.BasePermissions = baseMask; | ||
854 | item.CreationDate = creationDate; | ||
855 | |||
856 | userInfo.AddItem(item); | ||
857 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); | 712 | remoteClient.SendInventoryItemCreateUpdate(item, callbackID); |
858 | } | ||
859 | else | 713 | else |
860 | { | 714 | { |
715 | m_dialogModule.SendAlertToUser(remoteClient, "Failed to create item"); | ||
861 | m_log.WarnFormat( | 716 | m_log.WarnFormat( |
862 | "No user details associated with client {0} uuid {1} in CreateNewInventoryItem!", | 717 | "Failed to add item for {0} in CreateNewInventoryItem!", |
863 | remoteClient.Name, remoteClient.AgentId); | 718 | remoteClient.Name); |
864 | } | 719 | } |
865 | } | 720 | } |
866 | 721 | ||
@@ -941,19 +796,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
941 | /// <param name="itemID"></param> | 796 | /// <param name="itemID"></param> |
942 | private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) | 797 | private void RemoveInventoryItem(IClientAPI remoteClient, UUID itemID) |
943 | { | 798 | { |
944 | CachedUserInfo userInfo | 799 | InventoryService.DeleteItem(new InventoryItemBase(itemID)); |
945 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
946 | |||
947 | if (userInfo == null) | ||
948 | { | ||
949 | m_log.WarnFormat( | ||
950 | "[AGENT INVENTORY]: Failed to find user {0} {1} to delete inventory item {2}", | ||
951 | remoteClient.Name, remoteClient.AgentId, itemID); | ||
952 | |||
953 | return; | ||
954 | } | ||
955 | |||
956 | userInfo.DeleteItem(itemID); | ||
957 | } | 800 | } |
958 | 801 | ||
959 | /// <summary> | 802 | /// <summary> |
@@ -964,28 +807,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
964 | /// <param name="folderID"></param> | 807 | /// <param name="folderID"></param> |
965 | private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) | 808 | private void RemoveInventoryFolder(IClientAPI remoteClient, UUID folderID) |
966 | { | 809 | { |
967 | CachedUserInfo userInfo | 810 | // Unclear is this handler is ever called by the Linden client, but it might |
968 | = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
969 | 811 | ||
970 | if (userInfo == null) | 812 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
813 | folder.Owner = remoteClient.AgentId; | ||
814 | InventoryFolderBase trash = InventoryService.GetFolderForType(remoteClient.AgentId, AssetType.TrashFolder); | ||
815 | if (trash != null) | ||
971 | { | 816 | { |
972 | m_log.Warn("[AGENT INVENTORY]: Failed to find user " + remoteClient.AgentId.ToString()); | 817 | folder.ParentID = trash.ID; |
973 | return; | 818 | InventoryService.MoveFolder(folder); |
974 | } | ||
975 | |||
976 | if (userInfo.RootFolder != null) | ||
977 | { | ||
978 | InventoryItemBase folder = userInfo.RootFolder.FindItem(folderID); | ||
979 | |||
980 | if (folder != null) | ||
981 | { | ||
982 | m_log.WarnFormat( | ||
983 | "[AGENT INVENTORY]: Remove folder not implemented in request by {0} {1} for {2}", | ||
984 | remoteClient.Name, remoteClient.AgentId, folderID); | ||
985 | |||
986 | // doesn't work just yet, commented out. will fix in next patch. | ||
987 | // userInfo.DeleteItem(folder); | ||
988 | } | ||
989 | } | 819 | } |
990 | } | 820 | } |
991 | 821 | ||
@@ -1202,20 +1032,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1202 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); | 1032 | return MoveTaskInventoryItem(avatar.ControllingClient, folderId, part, itemId); |
1203 | } | 1033 | } |
1204 | else | 1034 | else |
1205 | { | 1035 | { |
1206 | CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(avatarId); | ||
1207 | if (profile == null || profile.RootFolder == null) | ||
1208 | { | ||
1209 | m_log.ErrorFormat( | ||
1210 | "[PRIM INVENTORY]: " + | ||
1211 | "Avatar {0} cannot be found to add item", | ||
1212 | avatarId); | ||
1213 | return null; | ||
1214 | } | ||
1215 | |||
1216 | if (!profile.HasReceivedInventory) | ||
1217 | profile.FetchInventory(); | ||
1218 | |||
1219 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); | 1036 | InventoryItemBase agentItem = CreateAgentInventoryItemFromTask(avatarId, part, itemId); |
1220 | 1037 | ||
1221 | if (agentItem == null) | 1038 | if (agentItem == null) |
@@ -1332,19 +1149,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1332 | 1149 | ||
1333 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) | 1150 | public UUID MoveTaskInventoryItems(UUID destID, string category, SceneObjectPart host, List<UUID> items) |
1334 | { | 1151 | { |
1335 | CachedUserInfo profile = CommsManager.UserProfileCacheService.GetUserDetails(destID); | 1152 | InventoryFolderBase rootFolder = InventoryService.GetRootFolder(destID); |
1336 | if (profile == null || profile.RootFolder == null) | ||
1337 | { | ||
1338 | m_log.ErrorFormat( | ||
1339 | "[PRIM INVENTORY]: " + | ||
1340 | "Avatar {0} cannot be found to add items", | ||
1341 | destID); | ||
1342 | return UUID.Zero; | ||
1343 | } | ||
1344 | 1153 | ||
1345 | UUID newFolderID = UUID.Random(); | 1154 | UUID newFolderID = UUID.Random(); |
1346 | 1155 | ||
1347 | profile.CreateFolder(category, newFolderID, 0xffff, profile.RootFolder.ID); | 1156 | InventoryFolderBase newFolder = new InventoryFolderBase(newFolderID, category, destID, 0xff, rootFolder.ID, rootFolder.Version); |
1157 | InventoryService.AddFolder(newFolder); | ||
1348 | 1158 | ||
1349 | foreach (UUID itemID in items) | 1159 | foreach (UUID itemID in items) |
1350 | { | 1160 | { |
@@ -1358,19 +1168,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1358 | } | 1168 | } |
1359 | } | 1169 | } |
1360 | 1170 | ||
1361 | ScenePresence avatar; | 1171 | ScenePresence avatar = null; |
1362 | |||
1363 | if (TryGetAvatar(destID, out avatar)) | 1172 | if (TryGetAvatar(destID, out avatar)) |
1364 | { | 1173 | { |
1365 | profile.SendInventoryDecendents(avatar.ControllingClient, | 1174 | //profile.SendInventoryDecendents(avatar.ControllingClient, |
1366 | profile.RootFolder.ID, true, false); | 1175 | // profile.RootFolder.ID, true, false); |
1367 | profile.SendInventoryDecendents(avatar.ControllingClient, | 1176 | //profile.SendInventoryDecendents(avatar.ControllingClient, |
1368 | newFolderID, false, true); | 1177 | // newFolderID, false, true); |
1178 | |||
1179 | SendInventoryUpdate(avatar.ControllingClient, rootFolder, true, false); | ||
1180 | SendInventoryUpdate(avatar.ControllingClient, newFolder, false, true); | ||
1369 | } | 1181 | } |
1370 | 1182 | ||
1371 | return newFolderID; | 1183 | return newFolderID; |
1372 | } | 1184 | } |
1373 | 1185 | ||
1186 | private void SendInventoryUpdate(IClientAPI client, InventoryFolderBase folder, bool fetchFolders, bool fetchItems) | ||
1187 | { | ||
1188 | InventoryCollection contents = InventoryService.GetFolderContent(client.AgentId, folder.ID); | ||
1189 | client.SendInventoryFolderDetails(client.AgentId, folder.ID, contents.Items, contents.Folders, fetchFolders, fetchItems); | ||
1190 | } | ||
1191 | |||
1374 | /// <summary> | 1192 | /// <summary> |
1375 | /// Update an item in a prim (task) inventory. | 1193 | /// Update an item in a prim (task) inventory. |
1376 | /// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see> | 1194 | /// This method does not handle scripts, <see>RezScript(IClientAPI, UUID, unit)</see> |
@@ -1406,39 +1224,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | UUID copyID = UUID.Random(); | 1224 | UUID copyID = UUID.Random(); |
1407 | if (itemID != UUID.Zero) | 1225 | if (itemID != UUID.Zero) |
1408 | { | 1226 | { |
1409 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1227 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
1410 | 1228 | ||
1411 | if (userInfo != null && userInfo.RootFolder != null) | 1229 | // Try library |
1230 | if (null == item) | ||
1412 | { | 1231 | { |
1413 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 1232 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); |
1414 | 1233 | } | |
1415 | // Try library | ||
1416 | // XXX clumsy, possibly should be one call | ||
1417 | if (null == item) | ||
1418 | { | ||
1419 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | ||
1420 | } | ||
1421 | 1234 | ||
1422 | if (item != null) | 1235 | if (item != null) |
1423 | { | 1236 | { |
1424 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); | 1237 | part.ParentGroup.AddInventoryItem(remoteClient, primLocalID, item, copyID); |
1425 | m_log.InfoFormat( | 1238 | m_log.InfoFormat( |
1426 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", | 1239 | "[PRIM INVENTORY]: Update with item {0} requested of prim {1} for {2}", |
1427 | item.Name, primLocalID, remoteClient.Name); | 1240 | item.Name, primLocalID, remoteClient.Name); |
1428 | part.GetProperties(remoteClient); | 1241 | part.GetProperties(remoteClient); |
1429 | if (!Permissions.BypassPermissions()) | 1242 | if (!Permissions.BypassPermissions()) |
1430 | { | ||
1431 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
1432 | RemoveInventoryItem(remoteClient, itemID); | ||
1433 | } | ||
1434 | } | ||
1435 | else | ||
1436 | { | 1243 | { |
1437 | m_log.ErrorFormat( | 1244 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
1438 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | 1245 | RemoveInventoryItem(remoteClient, itemID); |
1439 | itemID, remoteClient.Name); | ||
1440 | } | 1246 | } |
1441 | } | 1247 | } |
1248 | else | ||
1249 | { | ||
1250 | m_log.ErrorFormat( | ||
1251 | "[PRIM INVENTORY]: Could not find inventory item {0} to update for {1}!", | ||
1252 | itemID, remoteClient.Name); | ||
1253 | } | ||
1442 | } | 1254 | } |
1443 | } | 1255 | } |
1444 | else // Updating existing item with new perms etc | 1256 | else // Updating existing item with new perms etc |
@@ -1475,53 +1287,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1475 | 1287 | ||
1476 | if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory | 1288 | if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory |
1477 | { | 1289 | { |
1478 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1290 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
1479 | 1291 | ||
1480 | if (userInfo != null && userInfo.RootFolder != null) | 1292 | // Try library |
1293 | // XXX clumsy, possibly should be one call | ||
1294 | if (null == item) | ||
1481 | { | 1295 | { |
1482 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 1296 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); |
1483 | 1297 | } | |
1484 | // Try library | ||
1485 | // XXX clumsy, possibly should be one call | ||
1486 | if (null == item) | ||
1487 | { | ||
1488 | item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID); | ||
1489 | } | ||
1490 | 1298 | ||
1491 | if (item != null) | 1299 | if (item != null) |
1300 | { | ||
1301 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1302 | if (part != null) | ||
1492 | { | 1303 | { |
1493 | SceneObjectPart part = GetSceneObjectPart(localID); | 1304 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) |
1494 | if (part != null) | 1305 | return; |
1495 | { | ||
1496 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1497 | return; | ||
1498 | 1306 | ||
1499 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); | 1307 | part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); |
1500 | // TODO: switch to posting on_rez here when scripts | 1308 | // TODO: switch to posting on_rez here when scripts |
1501 | // have state in inventory | 1309 | // have state in inventory |
1502 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); | 1310 | part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); |
1503 | 1311 | ||
1504 | // m_log.InfoFormat("[PRIMINVENTORY]: " + | 1312 | // m_log.InfoFormat("[PRIMINVENTORY]: " + |
1505 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1313 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
1506 | // item.inventoryName, localID, remoteClient.Name); | 1314 | // item.inventoryName, localID, remoteClient.Name); |
1507 | part.GetProperties(remoteClient); | 1315 | part.GetProperties(remoteClient); |
1508 | } | ||
1509 | else | ||
1510 | { | ||
1511 | m_log.ErrorFormat( | ||
1512 | "[PRIM INVENTORY]: " + | ||
1513 | "Could not rez script {0} into prim local ID {1} for user {2}" | ||
1514 | + " because the prim could not be found in the region!", | ||
1515 | item.Name, localID, remoteClient.Name); | ||
1516 | } | ||
1517 | } | 1316 | } |
1518 | else | 1317 | else |
1519 | { | 1318 | { |
1520 | m_log.ErrorFormat( | 1319 | m_log.ErrorFormat( |
1521 | "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", | 1320 | "[PRIM INVENTORY]: " + |
1522 | itemID, remoteClient.Name); | 1321 | "Could not rez script {0} into prim local ID {1} for user {2}" |
1322 | + " because the prim could not be found in the region!", | ||
1323 | item.Name, localID, remoteClient.Name); | ||
1523 | } | 1324 | } |
1524 | } | 1325 | } |
1326 | else | ||
1327 | { | ||
1328 | m_log.ErrorFormat( | ||
1329 | "[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!", | ||
1330 | itemID, remoteClient.Name); | ||
1331 | } | ||
1525 | } | 1332 | } |
1526 | else // script has been rezzed directly into a prim's inventory | 1333 | else // script has been rezzed directly into a prim's inventory |
1527 | { | 1334 | { |
@@ -1811,26 +1618,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1811 | } | 1618 | } |
1812 | } | 1619 | } |
1813 | 1620 | ||
1814 | private bool WaitForInventory(CachedUserInfo info) | ||
1815 | { | ||
1816 | // 200 Seconds wait. This is called in the context of the | ||
1817 | // background delete thread, so we can afford to waste time | ||
1818 | // here. | ||
1819 | // | ||
1820 | int count = 200; | ||
1821 | |||
1822 | while (count > 0) | ||
1823 | { | ||
1824 | System.Threading.Thread.Sleep(100); | ||
1825 | count--; | ||
1826 | if (info.HasReceivedInventory) | ||
1827 | return true; | ||
1828 | } | ||
1829 | m_log.DebugFormat("Timed out waiting for inventory of user {0}", | ||
1830 | info.UserProfile.ID.ToString()); | ||
1831 | return false; | ||
1832 | } | ||
1833 | |||
1834 | /// <summary> | 1621 | /// <summary> |
1835 | /// Delete a scene object from a scene and place in the given avatar's inventory. | 1622 | /// Delete a scene object from a scene and place in the given avatar's inventory. |
1836 | /// Returns the UUID of the newly created asset. | 1623 | /// Returns the UUID of the newly created asset. |
@@ -1848,7 +1635,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1848 | 1635 | ||
1849 | // Get the user info of the item destination | 1636 | // Get the user info of the item destination |
1850 | // | 1637 | // |
1851 | CachedUserInfo userInfo; | 1638 | UUID userID = UUID.Zero; |
1852 | 1639 | ||
1853 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || | 1640 | if (action == DeRezAction.Take || action == DeRezAction.TakeCopy || |
1854 | action == DeRezAction.SaveToExistingUserInventoryItem) | 1641 | action == DeRezAction.SaveToExistingUserInventoryItem) |
@@ -1859,28 +1646,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1859 | if (remoteClient == null) | 1646 | if (remoteClient == null) |
1860 | return UUID.Zero; | 1647 | return UUID.Zero; |
1861 | 1648 | ||
1862 | userInfo = CommsManager.UserProfileCacheService.GetUserDetails( | 1649 | userID = remoteClient.AgentId; |
1863 | remoteClient.AgentId); | ||
1864 | } | 1650 | } |
1865 | else | 1651 | else |
1866 | { | 1652 | { |
1867 | // All returns / deletes go to the object owner | 1653 | // All returns / deletes go to the object owner |
1868 | // | 1654 | // |
1869 | userInfo = CommsManager.UserProfileCacheService.GetUserDetails( | ||
1870 | objectGroup.RootPart.OwnerID); | ||
1871 | } | ||
1872 | 1655 | ||
1873 | if (userInfo == null) // Can't proceed | 1656 | userID = objectGroup.RootPart.OwnerID; |
1874 | { | ||
1875 | return UUID.Zero; | ||
1876 | } | 1657 | } |
1877 | 1658 | ||
1878 | if (!userInfo.HasReceivedInventory) | 1659 | if (userID == UUID.Zero) // Can't proceed |
1879 | { | 1660 | { |
1880 | // Async inventory requests will queue, but they will never | 1661 | return UUID.Zero; |
1881 | // execute unless inventory is actually fetched | ||
1882 | // | ||
1883 | userInfo.FetchInventory(); | ||
1884 | } | 1662 | } |
1885 | 1663 | ||
1886 | // If we're returning someone's item, it goes back to the | 1664 | // If we're returning someone's item, it goes back to the |
@@ -1894,8 +1672,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1894 | 1672 | ||
1895 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 1673 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
1896 | { | 1674 | { |
1897 | item = userInfo.RootFolder.FindItem( | 1675 | item = new InventoryItemBase(objectGroup.RootPart.FromUserInventoryItemID); |
1898 | objectGroup.RootPart.FromUserInventoryItemID); | 1676 | item = InventoryService.GetItem(item); |
1677 | |||
1678 | //item = userInfo.RootFolder.FindItem( | ||
1679 | // objectGroup.RootPart.FromUserInventoryItemID); | ||
1899 | 1680 | ||
1900 | if (null == item) | 1681 | if (null == item) |
1901 | { | 1682 | { |
@@ -1920,53 +1701,36 @@ namespace OpenSim.Region.Framework.Scenes | |||
1920 | // have to wait for the inventory to find | 1701 | // have to wait for the inventory to find |
1921 | // the destination folder | 1702 | // the destination folder |
1922 | // | 1703 | // |
1923 | if (!WaitForInventory(userInfo)) | 1704 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
1924 | return UUID.Zero; | ||
1925 | folder = userInfo.FindFolderForType( | ||
1926 | (int)AssetType.LostAndFoundFolder); | ||
1927 | } | 1705 | } |
1928 | else | 1706 | else |
1929 | { | 1707 | { |
1930 | // Assume inventory skeleton was loaded during login | 1708 | // Assume inventory skeleton was loaded during login |
1931 | // and all folders can be found | 1709 | // and all folders can be found |
1932 | // | 1710 | // |
1933 | folder = userInfo.FindFolderForType( | 1711 | folder = InventoryService.GetFolderForType(userID, AssetType.TrashFolder); |
1934 | (int)AssetType.TrashFolder); | ||
1935 | } | 1712 | } |
1936 | } | 1713 | } |
1937 | else if (action == DeRezAction.Return) | 1714 | else if (action == DeRezAction.Return) |
1938 | { | 1715 | { |
1939 | // Wait if needed | ||
1940 | // | ||
1941 | if (!userInfo.HasReceivedInventory) | ||
1942 | { | ||
1943 | if (!WaitForInventory(userInfo)) | ||
1944 | return UUID.Zero; | ||
1945 | } | ||
1946 | 1716 | ||
1947 | // Dump to lost + found unconditionally | 1717 | // Dump to lost + found unconditionally |
1948 | // | 1718 | // |
1949 | folder = userInfo.FindFolderForType( | 1719 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
1950 | (int)AssetType.LostAndFoundFolder); | ||
1951 | } | 1720 | } |
1952 | 1721 | ||
1953 | if (folderID == UUID.Zero && folder == null) | 1722 | if (folderID == UUID.Zero && folder == null) |
1954 | { | 1723 | { |
1955 | // Catch all. Use lost & found | 1724 | // Catch all. Use lost & found |
1956 | // | 1725 | // |
1957 | if (!userInfo.HasReceivedInventory) | ||
1958 | { | ||
1959 | if (!WaitForInventory(userInfo)) | ||
1960 | return UUID.Zero; | ||
1961 | } | ||
1962 | 1726 | ||
1963 | folder = userInfo.FindFolderForType( | 1727 | folder = InventoryService.GetFolderForType(userID, AssetType.LostAndFoundFolder); |
1964 | (int)AssetType.LostAndFoundFolder); | ||
1965 | } | 1728 | } |
1966 | 1729 | ||
1967 | if (folder == null) // None of the above | 1730 | if (folder == null) // None of the above |
1968 | { | 1731 | { |
1969 | folder = userInfo.RootFolder.FindFolder(folderID); | 1732 | //folder = userInfo.RootFolder.FindFolder(folderID); |
1733 | folder = new InventoryFolderBase(folderID); | ||
1970 | 1734 | ||
1971 | if (folder == null) // Nowhere to put it | 1735 | if (folder == null) // Nowhere to put it |
1972 | { | 1736 | { |
@@ -1979,7 +1743,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1979 | item.ID = UUID.Random(); | 1743 | item.ID = UUID.Random(); |
1980 | item.InvType = (int)InventoryType.Object; | 1744 | item.InvType = (int)InventoryType.Object; |
1981 | item.Folder = folder.ID; | 1745 | item.Folder = folder.ID; |
1982 | item.Owner = userInfo.UserProfile.ID; | 1746 | item.Owner = userID; |
1983 | } | 1747 | } |
1984 | 1748 | ||
1985 | AssetBase asset = CreateAsset( | 1749 | AssetBase asset = CreateAsset( |
@@ -1993,7 +1757,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1993 | if (DeRezAction.SaveToExistingUserInventoryItem == action) | 1757 | if (DeRezAction.SaveToExistingUserInventoryItem == action) |
1994 | { | 1758 | { |
1995 | item.AssetID = asset.FullID; | 1759 | item.AssetID = asset.FullID; |
1996 | userInfo.UpdateItem(item); | 1760 | InventoryService.UpdateItem(item); |
1997 | } | 1761 | } |
1998 | else | 1762 | else |
1999 | { | 1763 | { |
@@ -2034,7 +1798,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2034 | item.Name = asset.Name; | 1798 | item.Name = asset.Name; |
2035 | item.AssetType = asset.Type; | 1799 | item.AssetType = asset.Type; |
2036 | 1800 | ||
2037 | userInfo.AddItem(item); | 1801 | InventoryService.AddItem(item); |
2038 | 1802 | ||
2039 | if (remoteClient != null && item.Owner == remoteClient.AgentId) | 1803 | if (remoteClient != null && item.Owner == remoteClient.AgentId) |
2040 | { | 1804 | { |
@@ -2053,7 +1817,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2053 | return assetID; | 1817 | return assetID; |
2054 | } | 1818 | } |
2055 | 1819 | ||
2056 | public void updateKnownAsset(IClientAPI remoteClient, SceneObjectGroup grp, UUID assetID, UUID agentID) | 1820 | public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) |
2057 | { | 1821 | { |
2058 | SceneObjectGroup objectGroup = grp; | 1822 | SceneObjectGroup objectGroup = grp; |
2059 | if (objectGroup != null) | 1823 | if (objectGroup != null) |
@@ -2070,65 +1834,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
2070 | 1834 | ||
2071 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); | 1835 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(objectGroup); |
2072 | 1836 | ||
2073 | CachedUserInfo userInfo = | 1837 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
2074 | CommsManager.UserProfileCacheService.GetUserDetails(agentID); | 1838 | |
2075 | if (userInfo != null && userInfo.RootFolder != null) | 1839 | if (item != null) |
2076 | { | 1840 | { |
2077 | Queue<InventoryFolderImpl> searchfolders = new Queue<InventoryFolderImpl>(); | 1841 | AssetBase asset = CreateAsset( |
2078 | searchfolders.Enqueue(userInfo.RootFolder); | 1842 | objectGroup.GetPartName(objectGroup.LocalId), |
1843 | objectGroup.GetPartDescription(objectGroup.LocalId), | ||
1844 | (sbyte)AssetType.Object, | ||
1845 | Utils.StringToBytes(sceneObjectXml)); | ||
1846 | AssetService.Store(asset); | ||
2079 | 1847 | ||
2080 | UUID foundFolder = UUID.Zero; | 1848 | item.AssetID = asset.FullID; |
2081 | InventoryItemBase item = null; | 1849 | item.Description = asset.Description; |
1850 | item.Name = asset.Name; | ||
1851 | item.AssetType = asset.Type; | ||
1852 | item.InvType = (int)InventoryType.Object; | ||
2082 | 1853 | ||
2083 | // search through folders to find the asset. | 1854 | InventoryService.UpdateItem(item); |
2084 | while (searchfolders.Count > 0) | ||
2085 | { | ||
2086 | InventoryFolderImpl fld = searchfolders.Dequeue(); | ||
2087 | lock (fld) | ||
2088 | { | ||
2089 | if (fld != null) | ||
2090 | { | ||
2091 | if (fld.Items.ContainsKey(assetID)) | ||
2092 | { | ||
2093 | item = fld.Items[assetID]; | ||
2094 | foundFolder = fld.ID; | ||
2095 | searchfolders.Clear(); | ||
2096 | break; | ||
2097 | } | ||
2098 | else | ||
2099 | { | ||
2100 | foreach (InventoryFolderImpl subfld in fld.RequestListOfFolderImpls()) | ||
2101 | { | ||
2102 | searchfolders.Enqueue(subfld); | ||
2103 | } | ||
2104 | } | ||
2105 | } | ||
2106 | } | ||
2107 | } | ||
2108 | 1855 | ||
2109 | if (foundFolder != UUID.Zero && item != null) | 1856 | // this gets called when the agent loggs off! |
1857 | if (remoteClient != null) | ||
2110 | { | 1858 | { |
2111 | AssetBase asset = CreateAsset( | 1859 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
2112 | objectGroup.GetPartName(objectGroup.LocalId), | ||
2113 | objectGroup.GetPartDescription(objectGroup.LocalId), | ||
2114 | (sbyte)AssetType.Object, | ||
2115 | Utils.StringToBytes(sceneObjectXml)); | ||
2116 | AssetService.Store(asset); | ||
2117 | |||
2118 | item.AssetID = asset.FullID; | ||
2119 | item.Description = asset.Description; | ||
2120 | item.Name = asset.Name; | ||
2121 | item.AssetType = asset.Type; | ||
2122 | item.InvType = (int)InventoryType.Object; | ||
2123 | item.Folder = foundFolder; | ||
2124 | |||
2125 | userInfo.UpdateItem(item); | ||
2126 | |||
2127 | // this gets called when the agent loggs off! | ||
2128 | if (remoteClient != null) | ||
2129 | { | ||
2130 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | ||
2131 | } | ||
2132 | } | 1860 | } |
2133 | } | 1861 | } |
2134 | } | 1862 | } |
@@ -2140,59 +1868,54 @@ namespace OpenSim.Region.Framework.Scenes | |||
2140 | if (grp != null) | 1868 | if (grp != null) |
2141 | { | 1869 | { |
2142 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 1870 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
1871 | |||
1872 | AssetBase asset = CreateAsset( | ||
1873 | grp.GetPartName(grp.LocalId), | ||
1874 | grp.GetPartDescription(grp.LocalId), | ||
1875 | (sbyte)AssetType.Object, | ||
1876 | Utils.StringToBytes(sceneObjectXml)); | ||
1877 | AssetService.Store(asset); | ||
2143 | 1878 | ||
2144 | CachedUserInfo userInfo = | 1879 | InventoryItemBase item = new InventoryItemBase(); |
2145 | CommsManager.UserProfileCacheService.GetUserDetails(AgentId); | 1880 | item.CreatorId = grp.RootPart.CreatorID.ToString(); |
2146 | 1881 | item.Owner = remoteClient.AgentId; | |
2147 | if (userInfo != null) | 1882 | item.ID = UUID.Random(); |
2148 | { | 1883 | item.AssetID = asset.FullID; |
2149 | AssetBase asset = CreateAsset( | 1884 | item.Description = asset.Description; |
2150 | grp.GetPartName(grp.LocalId), | 1885 | item.Name = asset.Name; |
2151 | grp.GetPartDescription(grp.LocalId), | 1886 | item.AssetType = asset.Type; |
2152 | (sbyte)AssetType.Object, | 1887 | item.InvType = (int)InventoryType.Object; |
2153 | Utils.StringToBytes(sceneObjectXml)); | ||
2154 | AssetService.Store(asset); | ||
2155 | |||
2156 | InventoryItemBase item = new InventoryItemBase(); | ||
2157 | item.CreatorId = grp.RootPart.CreatorID.ToString(); | ||
2158 | item.Owner = remoteClient.AgentId; | ||
2159 | item.ID = UUID.Random(); | ||
2160 | item.AssetID = asset.FullID; | ||
2161 | item.Description = asset.Description; | ||
2162 | item.Name = asset.Name; | ||
2163 | item.AssetType = asset.Type; | ||
2164 | item.InvType = (int)InventoryType.Object; | ||
2165 | 1888 | ||
2166 | item.Folder = UUID.Zero; // Objects folder! | 1889 | item.Folder = UUID.Zero; // Objects folder! |
2167 | 1890 | ||
2168 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) | 1891 | if ((remoteClient.AgentId != grp.RootPart.OwnerID) && Permissions.PropagatePermissions()) |
2169 | { | 1892 | { |
2170 | item.BasePermissions = grp.RootPart.NextOwnerMask; | 1893 | item.BasePermissions = grp.RootPart.NextOwnerMask; |
2171 | item.CurrentPermissions = grp.RootPart.NextOwnerMask; | 1894 | item.CurrentPermissions = grp.RootPart.NextOwnerMask; |
2172 | item.NextPermissions = grp.RootPart.NextOwnerMask; | 1895 | item.NextPermissions = grp.RootPart.NextOwnerMask; |
2173 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; | 1896 | item.EveryOnePermissions = grp.RootPart.EveryoneMask & grp.RootPart.NextOwnerMask; |
2174 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; | 1897 | item.GroupPermissions = grp.RootPart.GroupMask & grp.RootPart.NextOwnerMask; |
2175 | } | 1898 | } |
2176 | else | 1899 | else |
2177 | { | 1900 | { |
2178 | item.BasePermissions = grp.RootPart.BaseMask; | 1901 | item.BasePermissions = grp.RootPart.BaseMask; |
2179 | item.CurrentPermissions = grp.RootPart.OwnerMask; | 1902 | item.CurrentPermissions = grp.RootPart.OwnerMask; |
2180 | item.NextPermissions = grp.RootPart.NextOwnerMask; | 1903 | item.NextPermissions = grp.RootPart.NextOwnerMask; |
2181 | item.EveryOnePermissions = grp.RootPart.EveryoneMask; | 1904 | item.EveryOnePermissions = grp.RootPart.EveryoneMask; |
2182 | item.GroupPermissions = grp.RootPart.GroupMask; | 1905 | item.GroupPermissions = grp.RootPart.GroupMask; |
2183 | } | 1906 | } |
2184 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 1907 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
2185 | 1908 | ||
2186 | // sets assetID so client can show asset as 'attached' in inventory | 1909 | // sets itemID so client can show item as 'attached' in inventory |
2187 | grp.SetFromAssetID(item.ID); | 1910 | grp.SetFromItemID(item.ID); |
2188 | 1911 | ||
2189 | userInfo.AddItem(item); | 1912 | if (InventoryService.AddItem(item)) |
2190 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 1913 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
1914 | else | ||
1915 | m_dialogModule.SendAlertToUser(remoteClient, "Operation failed"); | ||
2191 | 1916 | ||
2192 | itemID = item.ID; | 1917 | itemID = item.ID; |
2193 | return item.AssetID; | 1918 | return item.AssetID; |
2194 | } | ||
2195 | return UUID.Zero; | ||
2196 | } | 1919 | } |
2197 | return UUID.Zero; | 1920 | return UUID.Zero; |
2198 | } | 1921 | } |
@@ -2261,180 +1984,164 @@ namespace OpenSim.Region.Framework.Scenes | |||
2261 | BypassRayCast, bRayEndIsIntersection,true,scale, false); | 1984 | BypassRayCast, bRayEndIsIntersection,true,scale, false); |
2262 | 1985 | ||
2263 | // Rez object | 1986 | // Rez object |
2264 | CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 1987 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
2265 | if (userInfo != null) | 1988 | |
1989 | if (item != null) | ||
2266 | { | 1990 | { |
2267 | // Do NOT use HasReceivedInventory here, this is called | 1991 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); |
2268 | // from within ItemReceive during login for attachments. | 1992 | |
2269 | // Using HasReceivedInventory here will break attachment | 1993 | if (rezAsset != null) |
2270 | // persistence! | ||
2271 | // | ||
2272 | if (userInfo.RootFolder != null) | ||
2273 | { | 1994 | { |
2274 | InventoryItemBase item = userInfo.RootFolder.FindItem(itemID); | 1995 | UUID itemId = UUID.Zero; |
2275 | 1996 | ||
2276 | if (item != null) | 1997 | // If we have permission to copy then link the rezzed object back to the user inventory |
1998 | // item that it came from. This allows us to enable 'save object to inventory' | ||
1999 | if (!Permissions.BypassPermissions()) | ||
2277 | { | 2000 | { |
2278 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); | 2001 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) |
2279 | |||
2280 | if (rezAsset != null) | ||
2281 | { | 2002 | { |
2282 | UUID itemId = UUID.Zero; | 2003 | itemId = item.ID; |
2283 | 2004 | } | |
2284 | // If we have permission to copy then link the rezzed object back to the user inventory | 2005 | } |
2285 | // item that it came from. This allows us to enable 'save object to inventory' | 2006 | else |
2286 | if (!Permissions.BypassPermissions()) | 2007 | { |
2287 | { | 2008 | // Brave new fullperm world |
2288 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == (uint)PermissionMask.Copy) | 2009 | // |
2289 | { | 2010 | itemId = item.ID; |
2290 | itemId = item.ID; | 2011 | } |
2291 | } | ||
2292 | } | ||
2293 | else | ||
2294 | { | ||
2295 | // Brave new fullperm world | ||
2296 | // | ||
2297 | itemId = item.ID; | ||
2298 | } | ||
2299 | |||
2300 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
2301 | SceneObjectGroup group | ||
2302 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); | ||
2303 | 2012 | ||
2304 | if (!Permissions.CanRezObject( | 2013 | string xmlData = Utils.BytesToString(rezAsset.Data); |
2305 | group.Children.Count, remoteClient.AgentId, pos) | 2014 | SceneObjectGroup group |
2306 | && !attachment) | 2015 | = SceneObjectSerializer.FromOriginalXmlFormat(itemId, xmlData); |
2307 | { | ||
2308 | return null; | ||
2309 | } | ||
2310 | 2016 | ||
2311 | group.ResetIDs(); | 2017 | if (!Permissions.CanRezObject( |
2018 | group.Children.Count, remoteClient.AgentId, pos) | ||
2019 | && !attachment) | ||
2020 | { | ||
2021 | return null; | ||
2022 | } | ||
2312 | 2023 | ||
2313 | if (attachment) | 2024 | group.ResetIDs(); |
2314 | group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2315 | 2025 | ||
2316 | AddNewSceneObject(group, true); | 2026 | if (attachment) |
2027 | group.RootPart.ObjectFlags |= (uint)PrimFlags.Phantom; | ||
2317 | 2028 | ||
2318 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); | 2029 | AddNewSceneObject(group, true); |
2319 | // if attachment we set it's asset id so object updates can reflect that | ||
2320 | // if not, we set it's position in world. | ||
2321 | if (!attachment) | ||
2322 | { | ||
2323 | float offsetHeight = 0; | ||
2324 | pos = GetNewRezLocation( | ||
2325 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2326 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
2327 | pos.Z += offsetHeight; | ||
2328 | group.AbsolutePosition = pos; | ||
2329 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
2330 | 2030 | ||
2331 | } | 2031 | // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); |
2332 | else | 2032 | // if attachment we set it's asset id so object updates can reflect that |
2333 | { | 2033 | // if not, we set it's position in world. |
2334 | group.SetFromAssetID(itemID); | 2034 | if (!attachment) |
2335 | } | 2035 | { |
2036 | float offsetHeight = 0; | ||
2037 | pos = GetNewRezLocation( | ||
2038 | RayStart, RayEnd, RayTargetID, Quaternion.Identity, | ||
2039 | BypassRayCast, bRayEndIsIntersection, true, group.GetAxisAlignedBoundingBox(out offsetHeight), false); | ||
2040 | pos.Z += offsetHeight; | ||
2041 | group.AbsolutePosition = pos; | ||
2042 | // m_log.InfoFormat("rezx point for inventory rezz is {0} {1} {2} and offsetheight was {3}", pos.X, pos.Y, pos.Z, offsetHeight); | ||
2336 | 2043 | ||
2337 | SceneObjectPart rootPart = null; | 2044 | } |
2338 | try | 2045 | else |
2339 | { | 2046 | { |
2340 | rootPart = group.GetChildPart(group.UUID); | 2047 | group.SetFromItemID(itemID); |
2341 | } | 2048 | } |
2342 | catch (NullReferenceException) | ||
2343 | { | ||
2344 | string isAttachment = ""; | ||
2345 | 2049 | ||
2346 | if (attachment) | 2050 | SceneObjectPart rootPart = null; |
2347 | isAttachment = " Object was an attachment"; | 2051 | try |
2052 | { | ||
2053 | rootPart = group.GetChildPart(group.UUID); | ||
2054 | } | ||
2055 | catch (NullReferenceException) | ||
2056 | { | ||
2057 | string isAttachment = ""; | ||
2348 | 2058 | ||
2349 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); | 2059 | if (attachment) |
2350 | } | 2060 | isAttachment = " Object was an attachment"; |
2351 | 2061 | ||
2352 | // Since renaming the item in the inventory does not affect the name stored | 2062 | m_log.Error("[AGENT INVENTORY]: Error rezzing ItemID: " + itemID + " object has no rootpart." + isAttachment); |
2353 | // in the serialization, transfer the correct name from the inventory to the | 2063 | } |
2354 | // object itself before we rez. | ||
2355 | rootPart.Name = item.Name; | ||
2356 | rootPart.Description = item.Description; | ||
2357 | 2064 | ||
2358 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | 2065 | // Since renaming the item in the inventory does not affect the name stored |
2066 | // in the serialization, transfer the correct name from the inventory to the | ||
2067 | // object itself before we rez. | ||
2068 | rootPart.Name = item.Name; | ||
2069 | rootPart.Description = item.Description; | ||
2359 | 2070 | ||
2360 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); | 2071 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); |
2361 | if (rootPart.OwnerID != item.Owner) | ||
2362 | { | ||
2363 | //Need to kill the for sale here | ||
2364 | rootPart.ObjectSaleType = 0; | ||
2365 | rootPart.SalePrice = 10; | ||
2366 | 2072 | ||
2367 | if (Permissions.PropagatePermissions()) | 2073 | group.SetGroup(remoteClient.ActiveGroupId, remoteClient); |
2368 | { | 2074 | if (rootPart.OwnerID != item.Owner) |
2369 | if ((item.CurrentPermissions & 8) != 0) | 2075 | { |
2370 | { | 2076 | //Need to kill the for sale here |
2371 | foreach (SceneObjectPart part in partList) | 2077 | rootPart.ObjectSaleType = 0; |
2372 | { | 2078 | rootPart.SalePrice = 10; |
2373 | part.EveryoneMask = item.EveryOnePermissions; | ||
2374 | part.NextOwnerMask = item.NextPermissions; | ||
2375 | part.GroupMask = 0; // DO NOT propagate here | ||
2376 | } | ||
2377 | } | ||
2378 | group.ApplyNextOwnerPermissions(); | ||
2379 | } | ||
2380 | } | ||
2381 | 2079 | ||
2382 | foreach (SceneObjectPart part in partList) | 2080 | if (Permissions.PropagatePermissions()) |
2081 | { | ||
2082 | if ((item.CurrentPermissions & 8) != 0) | ||
2383 | { | 2083 | { |
2384 | if (part.OwnerID != item.Owner) | 2084 | foreach (SceneObjectPart part in partList) |
2385 | { | ||
2386 | part.LastOwnerID = part.OwnerID; | ||
2387 | part.OwnerID = item.Owner; | ||
2388 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
2389 | } | ||
2390 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | ||
2391 | { | 2085 | { |
2392 | part.EveryoneMask = item.EveryOnePermissions; | 2086 | part.EveryoneMask = item.EveryOnePermissions; |
2393 | part.NextOwnerMask = item.NextPermissions; | 2087 | part.NextOwnerMask = item.NextPermissions; |
2394 | |||
2395 | part.GroupMask = 0; // DO NOT propagate here | 2088 | part.GroupMask = 0; // DO NOT propagate here |
2396 | } | 2089 | } |
2397 | } | 2090 | } |
2091 | group.ApplyNextOwnerPermissions(); | ||
2092 | } | ||
2093 | } | ||
2398 | 2094 | ||
2399 | rootPart.TrimPermissions(); | 2095 | foreach (SceneObjectPart part in partList) |
2096 | { | ||
2097 | if (part.OwnerID != item.Owner) | ||
2098 | { | ||
2099 | part.LastOwnerID = part.OwnerID; | ||
2100 | part.OwnerID = item.Owner; | ||
2101 | part.Inventory.ChangeInventoryOwner(item.Owner); | ||
2102 | } | ||
2103 | else if (((item.CurrentPermissions & 8) != 0) && (!attachment)) // Slam! | ||
2104 | { | ||
2105 | part.EveryoneMask = item.EveryOnePermissions; | ||
2106 | part.NextOwnerMask = item.NextPermissions; | ||
2400 | 2107 | ||
2401 | if (!attachment) | 2108 | part.GroupMask = 0; // DO NOT propagate here |
2402 | { | 2109 | } |
2403 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | 2110 | } |
2404 | { | ||
2405 | group.ClearPartAttachmentData(); | ||
2406 | } | ||
2407 | } | ||
2408 | 2111 | ||
2409 | if (!attachment) | 2112 | rootPart.TrimPermissions(); |
2410 | { | ||
2411 | // Fire on_rez | ||
2412 | group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); | ||
2413 | 2113 | ||
2414 | rootPart.ScheduleFullUpdate(); | 2114 | if (!attachment) |
2415 | } | 2115 | { |
2116 | if (group.RootPart.Shape.PCode == (byte)PCode.Prim) | ||
2117 | { | ||
2118 | group.ClearPartAttachmentData(); | ||
2119 | } | ||
2120 | } | ||
2416 | 2121 | ||
2417 | if (!Permissions.BypassPermissions()) | 2122 | if (!attachment) |
2418 | { | 2123 | { |
2419 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | 2124 | // Fire on_rez |
2420 | { | 2125 | group.CreateScriptInstances(0, true, DefaultScriptEngine, 0); |
2421 | // If this is done on attachments, no | ||
2422 | // copy ones will be lost, so avoid it | ||
2423 | // | ||
2424 | if (!attachment) | ||
2425 | userInfo.DeleteItem(item.ID); | ||
2426 | } | ||
2427 | } | ||
2428 | 2126 | ||
2429 | return rootPart.ParentGroup; | 2127 | rootPart.ScheduleFullUpdate(); |
2128 | } | ||
2129 | |||
2130 | if (!Permissions.BypassPermissions()) | ||
2131 | { | ||
2132 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) | ||
2133 | { | ||
2134 | // If this is done on attachments, no | ||
2135 | // copy ones will be lost, so avoid it | ||
2136 | // | ||
2137 | if (!attachment) | ||
2138 | InventoryService.DeleteItem(item); | ||
2430 | } | 2139 | } |
2431 | } | 2140 | } |
2141 | |||
2142 | return rootPart.ParentGroup; | ||
2432 | } | 2143 | } |
2433 | else | ||
2434 | m_log.WarnFormat("[AGENT INVENTORY]: Root folder not found in {0}", RegionInfo.RegionName); | ||
2435 | } | 2144 | } |
2436 | else | ||
2437 | m_log.WarnFormat("[AGENT INVENTORY]: User profile not found in {0}", RegionInfo.RegionName); | ||
2438 | 2145 | ||
2439 | return null; | 2146 | return null; |
2440 | } | 2147 | } |
@@ -2602,7 +2309,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2602 | ScenePresence presence; | 2309 | ScenePresence presence; |
2603 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | 2310 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
2604 | { | 2311 | { |
2605 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.UUID); | 2312 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID, remoteClient.AgentId)); |
2313 | |||
2314 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
2606 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); | 2315 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); |
2607 | if (ava != null) | 2316 | if (ava != null) |
2608 | { | 2317 | { |
@@ -2650,7 +2359,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2650 | ScenePresence presence; | 2359 | ScenePresence presence; |
2651 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | 2360 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
2652 | { | 2361 | { |
2653 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, att.UUID); | 2362 | // XXYY!! |
2363 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); | ||
2364 | presence.Appearance.SetAttachment((int)AttachmentPt, itemID, item.AssetID /*att.UUID*/); | ||
2654 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); | 2365 | IAvatarFactory ava = RequestModuleInterface<IAvatarFactory>(); |
2655 | if (ava != null) | 2366 | if (ava != null) |
2656 | { | 2367 | { |
@@ -2666,7 +2377,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2666 | if (part == null || part.ParentGroup == null) | 2377 | if (part == null || part.ParentGroup == null) |
2667 | return; | 2378 | return; |
2668 | 2379 | ||
2669 | UUID inventoryID = part.ParentGroup.GetFromAssetID(); | 2380 | UUID inventoryID = part.ParentGroup.GetFromItemID(); |
2670 | 2381 | ||
2671 | ScenePresence presence; | 2382 | ScenePresence presence; |
2672 | if (TryGetAvatar(remoteClient.AgentId, out presence)) | 2383 | if (TryGetAvatar(remoteClient.AgentId, out presence)) |
@@ -2681,13 +2392,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2681 | ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); | 2392 | ava.UpdateDatabase(remoteClient.AgentId, presence.Appearance); |
2682 | } | 2393 | } |
2683 | part.ParentGroup.DetachToGround(); | 2394 | part.ParentGroup.DetachToGround(); |
2684 | CachedUserInfo userInfo = | 2395 | |
2685 | CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 2396 | InventoryService.DeleteItem(new InventoryItemBase(inventoryID)); |
2686 | if (userInfo != null) | 2397 | remoteClient.SendRemoveInventoryItem(inventoryID); |
2687 | { | ||
2688 | userInfo.DeleteItem(inventoryID); | ||
2689 | remoteClient.SendRemoveInventoryItem(inventoryID); | ||
2690 | } | ||
2691 | } | 2398 | } |
2692 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); | 2399 | SendAttachEvent(part.ParentGroup.LocalId, itemID, UUID.Zero); |
2693 | } | 2400 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 113918d..fde922f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -109,6 +109,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | } | 109 | } |
110 | 110 | ||
111 | /// <summary> | 111 | /// <summary> |
112 | /// Invoked when the client requests a prim. | ||
113 | /// </summary> | ||
114 | /// <param name="primLocalID"></param> | ||
115 | /// <param name="remoteClient"></param> | ||
116 | public void RequestPrim(uint primLocalID, IClientAPI remoteClient) | ||
117 | { | ||
118 | List<EntityBase> EntityList = GetEntities(); | ||
119 | |||
120 | foreach (EntityBase ent in EntityList) | ||
121 | { | ||
122 | if (ent is SceneObjectGroup) | ||
123 | { | ||
124 | if (((SceneObjectGroup)ent).LocalId == primLocalID) | ||
125 | { | ||
126 | ((SceneObjectGroup)ent).SendFullUpdateToClient(remoteClient); | ||
127 | return; | ||
128 | } | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | /// <summary> | ||
112 | /// Invoked when the client selects a prim. | 134 | /// Invoked when the client selects a prim. |
113 | /// </summary> | 135 | /// </summary> |
114 | /// <param name="primLocalID"></param> | 136 | /// <param name="primLocalID"></param> |
@@ -382,31 +404,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
382 | return; | 404 | return; |
383 | } | 405 | } |
384 | 406 | ||
385 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 407 | InventoryItemBase item = InventoryService.GetItem(new InventoryItemBase(itemID)); |
386 | 408 | ||
387 | if (null == userProfile) | 409 | if (item != null) |
388 | { | 410 | { |
389 | m_log.ErrorFormat( | 411 | remoteClient.SendInventoryItemDetails(ownerID, item); |
390 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
391 | remoteClient.Name, remoteClient.AgentId); | ||
392 | return; | ||
393 | } | ||
394 | |||
395 | if (userProfile.HasReceivedInventory) | ||
396 | { | ||
397 | InventoryItemBase item = null; | ||
398 | if (userProfile.RootFolder == null) | ||
399 | m_log.ErrorFormat( | ||
400 | "[AGENT INVENTORY]: User {0} {1} does not have a root folder.", | ||
401 | remoteClient.Name, remoteClient.AgentId); | ||
402 | else | ||
403 | item = userProfile.RootFolder.FindItem(itemID); | ||
404 | |||
405 | if (item != null) | ||
406 | { | ||
407 | remoteClient.SendInventoryItemDetails(ownerID, item); | ||
408 | } | ||
409 | } | 412 | } |
413 | // else shouldn't we send an alert message? | ||
410 | } | 414 | } |
411 | 415 | ||
412 | /// <summary> | 416 | /// <summary> |
@@ -435,23 +439,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
435 | return; | 439 | return; |
436 | } | 440 | } |
437 | 441 | ||
438 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 442 | SendInventoryUpdate(remoteClient, new InventoryFolderBase(folderID), fetchFolders, fetchItems); |
439 | |||
440 | if (null == userProfile) | ||
441 | { | ||
442 | m_log.ErrorFormat( | ||
443 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
444 | remoteClient.Name, remoteClient.AgentId); | ||
445 | return; | ||
446 | } | ||
447 | |||
448 | userProfile.SendInventoryDecendents(remoteClient, folderID, fetchFolders, fetchItems); | ||
449 | } | 443 | } |
450 | 444 | ||
451 | /// <summary> | 445 | /// <summary> |
452 | /// Handle the caps inventory descendents fetch. | 446 | /// Handle the caps inventory descendents fetch. |
453 | /// | 447 | /// |
454 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. | 448 | /// Since the folder structure is sent to the client on login, I believe we only need to handle items. |
449 | /// Diva comment 8/13/2009: what if someone gave us a folder in the meantime?? | ||
455 | /// </summary> | 450 | /// </summary> |
456 | /// <param name="agentID"></param> | 451 | /// <param name="agentID"></param> |
457 | /// <param name="folderID"></param> | 452 | /// <param name="folderID"></param> |
@@ -477,59 +472,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
477 | { | 472 | { |
478 | return fold.RequestListOfItems(); | 473 | return fold.RequestListOfItems(); |
479 | } | 474 | } |
480 | |||
481 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(agentID); | ||
482 | |||
483 | if (null == userProfile) | ||
484 | { | ||
485 | m_log.ErrorFormat("[AGENT INVENTORY]: Could not find user profile for {0}", agentID); | ||
486 | return null; | ||
487 | } | ||
488 | 475 | ||
489 | // XXX: When a client crosses into a scene, their entire inventory is fetched | 476 | InventoryCollection contents = InventoryService.GetFolderContent(agentID, folderID); |
490 | // asynchronously. If the client makes a request before the inventory is received, we need | 477 | return contents.Items; |
491 | // to give the inventory a chance to come in. | ||
492 | // | ||
493 | // This is a crude way of dealing with that by retrying the lookup. It's not quite as bad | ||
494 | // in CAPS as doing this with the udp request, since here it won't hold up other packets. | ||
495 | // In fact, here we'll be generous and try for longer. | ||
496 | if (!userProfile.HasReceivedInventory) | ||
497 | { | ||
498 | int attempts = 0; | ||
499 | while (attempts++ < 30) | ||
500 | { | ||
501 | m_log.DebugFormat( | ||
502 | "[INVENTORY CACHE]: Poll number {0} for inventory items in folder {1} for user {2}", | ||
503 | attempts, folderID, agentID); | ||
504 | |||
505 | Thread.Sleep(2000); | ||
506 | |||
507 | if (userProfile.HasReceivedInventory) | ||
508 | { | ||
509 | break; | ||
510 | } | ||
511 | } | ||
512 | } | ||
513 | 478 | ||
514 | if (userProfile.HasReceivedInventory) | ||
515 | { | ||
516 | if ((fold = userProfile.RootFolder.FindFolder(folderID)) != null) | ||
517 | { | ||
518 | return fold.RequestListOfItems(); | ||
519 | } | ||
520 | else | ||
521 | { | ||
522 | m_log.WarnFormat( | ||
523 | "[AGENT INVENTORY]: Could not find folder {0} requested by user {1}", | ||
524 | folderID, agentID); | ||
525 | return null; | ||
526 | } | ||
527 | } | ||
528 | else | ||
529 | { | ||
530 | m_log.ErrorFormat("[INVENTORY CACHE]: Could not find root folder for user {0}", agentID); | ||
531 | return null; | ||
532 | } | ||
533 | } | 479 | } |
534 | 480 | ||
535 | /// <summary> | 481 | /// <summary> |
@@ -543,19 +489,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
543 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, | 489 | public void HandleCreateInventoryFolder(IClientAPI remoteClient, UUID folderID, ushort folderType, |
544 | string folderName, UUID parentID) | 490 | string folderName, UUID parentID) |
545 | { | 491 | { |
546 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 492 | InventoryFolderBase folder = new InventoryFolderBase(folderID, folderName, remoteClient.AgentId, (short)folderType, parentID, 1); |
547 | 493 | if (!InventoryService.AddFolder(folder)) | |
548 | if (null == userProfile) | ||
549 | { | 494 | { |
550 | m_log.ErrorFormat( | 495 | m_log.WarnFormat( |
551 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
552 | remoteClient.Name, remoteClient.AgentId); | ||
553 | return; | ||
554 | } | ||
555 | |||
556 | if (!userProfile.CreateFolder(folderName, folderID, folderType, parentID)) | ||
557 | { | ||
558 | m_log.ErrorFormat( | ||
559 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", | 496 | "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", |
560 | remoteClient.Name, remoteClient.AgentId); | 497 | remoteClient.Name, remoteClient.AgentId); |
561 | } | 498 | } |
@@ -580,54 +517,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | // m_log.DebugFormat( | 517 | // m_log.DebugFormat( |
581 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); | 518 | // "[AGENT INVENTORY]: Updating inventory folder {0} {1} for {2} {3}", folderID, name, remoteClient.Name, remoteClient.AgentId); |
582 | 519 | ||
583 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | 520 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
584 | 521 | folder = InventoryService.GetFolder(folder); | |
585 | if (null == userProfile) | 522 | if (folder != null) |
586 | { | ||
587 | m_log.ErrorFormat( | ||
588 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
589 | remoteClient.Name, remoteClient.AgentId); | ||
590 | return; | ||
591 | } | ||
592 | |||
593 | if (!userProfile.UpdateFolder(name, folderID, type, parentID)) | ||
594 | { | 523 | { |
595 | m_log.ErrorFormat( | 524 | folder.Name = name; |
596 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | 525 | folder.Type = (short)type; |
597 | remoteClient.Name, remoteClient.AgentId); | 526 | folder.ParentID = parentID; |
527 | if (!InventoryService.UpdateFolder(folder)) | ||
528 | { | ||
529 | m_log.ErrorFormat( | ||
530 | "[AGENT INVENTORY]: Failed to update folder for user {0} {1}", | ||
531 | remoteClient.Name, remoteClient.AgentId); | ||
532 | } | ||
598 | } | 533 | } |
599 | } | 534 | } |
600 | 535 | ||
601 | /// <summary> | ||
602 | /// Handle an inventory folder move request from the client. | ||
603 | /// </summary> | ||
604 | /// <param name="remoteClient"></param> | ||
605 | /// <param name="folderID"></param> | ||
606 | /// <param name="parentID"></param> | ||
607 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) | 536 | public void HandleMoveInventoryFolder(IClientAPI remoteClient, UUID folderID, UUID parentID) |
608 | { | 537 | { |
609 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
610 | |||
611 | if (null == userProfile) | ||
612 | { | ||
613 | m_log.ErrorFormat( | ||
614 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
615 | remoteClient.Name, remoteClient.AgentId); | ||
616 | return; | ||
617 | } | ||
618 | |||
619 | if (!userProfile.MoveFolder(folderID, parentID)) | ||
620 | { | ||
621 | m_log.ErrorFormat( | ||
622 | "[AGENT INVENTORY]: Failed to move folder {0} to {1} for user {2}", | ||
623 | folderID, parentID, remoteClient.Name); | ||
624 | } | ||
625 | } | ||
626 | |||
627 | public void HandleMoveInventoryFolder2(IClientAPI remoteClient, UUID folderID, UUID parentID) | ||
628 | { | ||
629 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 538 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
630 | folder = InventoryService.QueryFolder(folder); | 539 | folder = InventoryService.GetFolder(folder); |
631 | if (folder != null) | 540 | if (folder != null) |
632 | { | 541 | { |
633 | folder.ParentID = parentID; | 542 | folder.ParentID = parentID; |
@@ -647,27 +556,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
647 | /// </summary> | 556 | /// </summary> |
648 | /// <param name="remoteClient"></param> | 557 | /// <param name="remoteClient"></param> |
649 | /// <param name="folderID"></param> | 558 | /// <param name="folderID"></param> |
650 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) | ||
651 | { | ||
652 | CachedUserInfo userProfile = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
653 | |||
654 | if (null == userProfile) | ||
655 | { | ||
656 | m_log.ErrorFormat( | ||
657 | "[AGENT INVENTORY]: Could not find user profile for {0} {1}", | ||
658 | remoteClient.Name, remoteClient.AgentId); | ||
659 | return; | ||
660 | } | ||
661 | 559 | ||
662 | if (!userProfile.PurgeFolder(folderID)) | 560 | public void HandlePurgeInventoryDescendents(IClientAPI remoteClient, UUID folderID) |
663 | { | ||
664 | m_log.ErrorFormat( | ||
665 | "[AGENT INVENTORY]: Failed to purge folder for user {0} {1}", | ||
666 | remoteClient.Name, remoteClient.AgentId); | ||
667 | } | ||
668 | } | ||
669 | |||
670 | public void HandlePurgeInventoryDescendents2(IClientAPI remoteClient, UUID folderID) | ||
671 | { | 561 | { |
672 | InventoryFolderBase folder = new InventoryFolderBase(folderID); | 562 | InventoryFolderBase folder = new InventoryFolderBase(folderID); |
673 | 563 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 18d7bad..d1f7a4b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1962,7 +1962,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1962 | m_log.DebugFormat("[ATTACHMENT]: Received " + | 1962 | m_log.DebugFormat("[ATTACHMENT]: Received " + |
1963 | "attachment {0}, inworld asset id {1}", | 1963 | "attachment {0}, inworld asset id {1}", |
1964 | //grp.RootPart.LastOwnerID.ToString(), | 1964 | //grp.RootPart.LastOwnerID.ToString(), |
1965 | grp.GetFromAssetID(), | 1965 | grp.GetFromItemID(), |
1966 | grp.UUID.ToString()); | 1966 | grp.UUID.ToString()); |
1967 | 1967 | ||
1968 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); | 1968 | //grp.SetFromAssetID(grp.RootPart.LastOwnerID); |
@@ -2042,13 +2042,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
2042 | } | 2042 | } |
2043 | else | 2043 | else |
2044 | { | 2044 | { |
2045 | AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); | ||
2046 | |||
2045 | m_log.DebugFormat( | 2047 | m_log.DebugFormat( |
2046 | "[SCENE]: Adding new child agent for {0} in {1}", | 2048 | "[SCENE]: Adding new {0} agent for {1} in {2}", |
2047 | client.Name, RegionInfo.RegionName); | 2049 | ((aCircuit.child == true) ? "child" : "root"), client.Name, RegionInfo.RegionName); |
2048 | 2050 | ||
2049 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); | 2051 | CommsManager.UserProfileCacheService.AddNewUser(client.AgentId); |
2050 | 2052 | ||
2051 | CreateAndAddScenePresence(client); | 2053 | ScenePresence sp = CreateAndAddScenePresence(client); |
2054 | |||
2055 | // HERE!!! Do the initial attachments right here | ||
2056 | // first agent upon login is a root agent by design. | ||
2057 | // All other AddNewClient calls find aCircuit.child to be true | ||
2058 | if (aCircuit.child == false) | ||
2059 | { | ||
2060 | sp.IsChildAgent = false; | ||
2061 | sp.RezAttachments(); | ||
2062 | } | ||
2052 | } | 2063 | } |
2053 | 2064 | ||
2054 | m_LastLogin = Environment.TickCount; | 2065 | m_LastLogin = Environment.TickCount; |
@@ -2076,6 +2087,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2076 | client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; | 2087 | client.OnUpdatePrimTexture += m_sceneGraph.UpdatePrimTexture; |
2077 | client.OnTeleportLocationRequest += RequestTeleportLocation; | 2088 | client.OnTeleportLocationRequest += RequestTeleportLocation; |
2078 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; | 2089 | client.OnTeleportLandmarkRequest += RequestTeleportLandmark; |
2090 | client.OnObjectRequest += RequestPrim; | ||
2079 | client.OnObjectSelect += SelectPrim; | 2091 | client.OnObjectSelect += SelectPrim; |
2080 | client.OnObjectDeselect += DeselectPrim; | 2092 | client.OnObjectDeselect += DeselectPrim; |
2081 | client.OnGrabUpdate += m_sceneGraph.MoveObject; | 2093 | client.OnGrabUpdate += m_sceneGraph.MoveObject; |
@@ -3672,59 +3684,53 @@ namespace OpenSim.Region.Framework.Scenes | |||
3672 | case 2: // Sell a copy | 3684 | case 2: // Sell a copy |
3673 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); | 3685 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(group); |
3674 | 3686 | ||
3675 | CachedUserInfo userInfo = | 3687 | uint perms=group.GetEffectivePermissions(); |
3676 | CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId); | ||
3677 | 3688 | ||
3678 | if (userInfo != null) | 3689 | if ((perms & (uint)PermissionMask.Transfer) == 0) |
3679 | { | 3690 | { |
3680 | uint perms=group.GetEffectivePermissions(); | 3691 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); |
3681 | 3692 | return false; | |
3682 | if ((perms & (uint)PermissionMask.Transfer) == 0) | 3693 | } |
3683 | { | ||
3684 | m_dialogModule.SendAlertToUser(remoteClient, "This item doesn't appear to be for sale"); | ||
3685 | return false; | ||
3686 | } | ||
3687 | 3694 | ||
3688 | AssetBase asset = CreateAsset( | 3695 | AssetBase asset = CreateAsset( |
3689 | group.GetPartName(localID), | 3696 | group.GetPartName(localID), |
3690 | group.GetPartDescription(localID), | 3697 | group.GetPartDescription(localID), |
3691 | (sbyte)AssetType.Object, | 3698 | (sbyte)AssetType.Object, |
3692 | Utils.StringToBytes(sceneObjectXml)); | 3699 | Utils.StringToBytes(sceneObjectXml)); |
3693 | AssetService.Store(asset); | 3700 | AssetService.Store(asset); |
3694 | 3701 | ||
3695 | InventoryItemBase item = new InventoryItemBase(); | 3702 | InventoryItemBase item = new InventoryItemBase(); |
3696 | item.CreatorId = part.CreatorID.ToString(); | 3703 | item.CreatorId = part.CreatorID.ToString(); |
3697 | 3704 | ||
3698 | item.ID = UUID.Random(); | 3705 | item.ID = UUID.Random(); |
3699 | item.Owner = remoteClient.AgentId; | 3706 | item.Owner = remoteClient.AgentId; |
3700 | item.AssetID = asset.FullID; | 3707 | item.AssetID = asset.FullID; |
3701 | item.Description = asset.Description; | 3708 | item.Description = asset.Description; |
3702 | item.Name = asset.Name; | 3709 | item.Name = asset.Name; |
3703 | item.AssetType = asset.Type; | 3710 | item.AssetType = asset.Type; |
3704 | item.InvType = (int)InventoryType.Object; | 3711 | item.InvType = (int)InventoryType.Object; |
3705 | item.Folder = categoryID; | 3712 | item.Folder = categoryID; |
3706 | 3713 | ||
3707 | uint nextPerms=(perms & 7) << 13; | 3714 | uint nextPerms=(perms & 7) << 13; |
3708 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) | 3715 | if ((nextPerms & (uint)PermissionMask.Copy) == 0) |
3709 | perms &= ~(uint)PermissionMask.Copy; | 3716 | perms &= ~(uint)PermissionMask.Copy; |
3710 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) | 3717 | if ((nextPerms & (uint)PermissionMask.Transfer) == 0) |
3711 | perms &= ~(uint)PermissionMask.Transfer; | 3718 | perms &= ~(uint)PermissionMask.Transfer; |
3712 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) | 3719 | if ((nextPerms & (uint)PermissionMask.Modify) == 0) |
3713 | perms &= ~(uint)PermissionMask.Modify; | 3720 | perms &= ~(uint)PermissionMask.Modify; |
3714 | 3721 | ||
3715 | item.BasePermissions = perms & part.NextOwnerMask; | 3722 | item.BasePermissions = perms & part.NextOwnerMask; |
3716 | item.CurrentPermissions = perms & part.NextOwnerMask; | 3723 | item.CurrentPermissions = perms & part.NextOwnerMask; |
3717 | item.NextPermissions = part.NextOwnerMask; | 3724 | item.NextPermissions = part.NextOwnerMask; |
3718 | item.EveryOnePermissions = part.EveryoneMask & | 3725 | item.EveryOnePermissions = part.EveryoneMask & |
3719 | part.NextOwnerMask; | 3726 | part.NextOwnerMask; |
3720 | item.GroupPermissions = part.GroupMask & | 3727 | item.GroupPermissions = part.GroupMask & |
3721 | part.NextOwnerMask; | 3728 | part.NextOwnerMask; |
3722 | item.CurrentPermissions |= 8; // Slam! | 3729 | item.CurrentPermissions |= 8; // Slam! |
3723 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 3730 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
3724 | 3731 | ||
3725 | userInfo.AddItem(item); | 3732 | if (InventoryService.AddItem(item)) |
3726 | remoteClient.SendInventoryItemCreateUpdate(item, 0); | 3733 | remoteClient.SendInventoryItemCreateUpdate(item, 0); |
3727 | } | ||
3728 | else | 3734 | else |
3729 | { | 3735 | { |
3730 | m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); | 3736 | m_dialogModule.SendAlertToUser(remoteClient, "Cannot buy now. Your inventory is unavailable"); |
@@ -3739,8 +3745,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
3739 | 3745 | ||
3740 | foreach (UUID invID in invList) | 3746 | foreach (UUID invID in invList) |
3741 | { | 3747 | { |
3742 | TaskInventoryItem item = part.Inventory.GetInventoryItem(invID); | 3748 | TaskInventoryItem item1 = part.Inventory.GetInventoryItem(invID); |
3743 | if ((item.CurrentPermissions & | 3749 | if ((item1.CurrentPermissions & |
3744 | (uint)PermissionMask.Transfer) == 0) | 3750 | (uint)PermissionMask.Transfer) == 0) |
3745 | { | 3751 | { |
3746 | okToSell = false; | 3752 | okToSell = false; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c1e39a9..65c97e8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs | |||
@@ -1086,11 +1086,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1086 | 1086 | ||
1087 | public bool WaitForCallback(UUID id) | 1087 | public bool WaitForCallback(UUID id) |
1088 | { | 1088 | { |
1089 | int count = 20; | 1089 | int count = 200; |
1090 | while (m_agentsInTransit.Contains(id) && count-- > 0) | 1090 | while (m_agentsInTransit.Contains(id) && count-- > 0) |
1091 | { | 1091 | { |
1092 | //m_log.Debug(" >>> Waiting... " + count); | 1092 | //m_log.Debug(" >>> Waiting... " + count); |
1093 | Thread.Sleep(1000); | 1093 | Thread.Sleep(100); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | if (count > 0) | 1096 | if (count > 0) |
@@ -1207,16 +1207,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1207 | { | 1207 | { |
1208 | pos = pos + (agent.Velocity); | 1208 | pos = pos + (agent.Velocity); |
1209 | 1209 | ||
1210 | CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); | 1210 | //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); |
1211 | if (userInfo != null) | 1211 | //if (userInfo != null) |
1212 | { | 1212 | //{ |
1213 | userInfo.DropInventory(); | 1213 | // userInfo.DropInventory(); |
1214 | } | 1214 | //} |
1215 | else | 1215 | //else |
1216 | { | 1216 | //{ |
1217 | m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}", | 1217 | // m_log.WarnFormat("[SCENE COMM]: No cached user info found for {0} {1} on leaving region {2}", |
1218 | agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName); | 1218 | // agent.Name, agent.UUID, agent.Scene.RegionInfo.RegionName); |
1219 | } | 1219 | //} |
1220 | 1220 | ||
1221 | //bool crossingSuccessful = | 1221 | //bool crossingSuccessful = |
1222 | // CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos, | 1222 | // CrossToNeighbouringRegion(neighbourHandle, agent.ControllingClient.AgentId, pos, |
@@ -1315,11 +1315,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1315 | } | 1315 | } |
1316 | else // Not successful | 1316 | else // Not successful |
1317 | { | 1317 | { |
1318 | CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); | 1318 | //CachedUserInfo userInfo = m_commsProvider.UserProfileCacheService.GetUserDetails(agent.UUID); |
1319 | if (userInfo != null) | 1319 | //if (userInfo != null) |
1320 | { | 1320 | //{ |
1321 | userInfo.FetchInventory(); | 1321 | // userInfo.FetchInventory(); |
1322 | } | 1322 | //} |
1323 | agent.RestoreInCurrentScene(); | 1323 | agent.RestoreInCurrentScene(); |
1324 | } | 1324 | } |
1325 | // In any case | 1325 | // In any case |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 0e0999a..3007598 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -442,7 +442,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
442 | if (group != null) | 442 | if (group != null) |
443 | { | 443 | { |
444 | //group.DetachToGround(); | 444 | //group.DetachToGround(); |
445 | m_parentScene.DetachSingleAttachmentToInv(group.GetFromAssetID(), remoteClient); | 445 | m_parentScene.DetachSingleAttachmentToInv(group.GetFromItemID(), remoteClient); |
446 | } | 446 | } |
447 | } | 447 | } |
448 | 448 | ||
@@ -489,7 +489,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
489 | // Calls attach with a Zero position | 489 | // Calls attach with a Zero position |
490 | // | 490 | // |
491 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); | 491 | AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false); |
492 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromAssetID(), remoteClient.AgentId); | 492 | m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); |
493 | } | 493 | } |
494 | 494 | ||
495 | public SceneObjectGroup RezSingleAttachment( | 495 | public SceneObjectGroup RezSingleAttachment( |
@@ -536,14 +536,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
536 | if (entity is SceneObjectGroup) | 536 | if (entity is SceneObjectGroup) |
537 | { | 537 | { |
538 | group = (SceneObjectGroup)entity; | 538 | group = (SceneObjectGroup)entity; |
539 | if (group.GetFromAssetID() == itemID) | 539 | if (group.GetFromItemID() == itemID) |
540 | { | 540 | { |
541 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); | 541 | m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); |
542 | group.DetachToInventoryPrep(); | 542 | group.DetachToInventoryPrep(); |
543 | m_log.Debug("[DETACH]: Saving attachpoint: " + | 543 | m_log.Debug("[DETACH]: Saving attachpoint: " + |
544 | ((uint)group.GetAttachmentPoint()).ToString()); | 544 | ((uint)group.GetAttachmentPoint()).ToString()); |
545 | m_parentScene.updateKnownAsset(remoteClient, group, | 545 | m_parentScene.UpdateKnownItem(remoteClient, group, |
546 | group.GetFromAssetID(), group.OwnerID); | 546 | group.GetFromItemID(), group.OwnerID); |
547 | m_parentScene.DeleteSceneObject(group, false); | 547 | m_parentScene.DeleteSceneObject(group, false); |
548 | return; | 548 | return; |
549 | } | 549 | } |
@@ -572,7 +572,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
572 | { | 572 | { |
573 | // Check object for stored attachment point | 573 | // Check object for stored attachment point |
574 | AttachmentPt = (uint)group.GetAttachmentPoint(); | 574 | AttachmentPt = (uint)group.GetAttachmentPoint(); |
575 | } | 575 | } |
576 | 576 | ||
577 | // if we still didn't find a suitable attachment point....... | 577 | // if we still didn't find a suitable attachment point....... |
578 | if (AttachmentPt == 0) | 578 | if (AttachmentPt == 0) |
@@ -580,21 +580,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
580 | // Stick it on left hand with Zero Offset from the attachment point. | 580 | // Stick it on left hand with Zero Offset from the attachment point. |
581 | AttachmentPt = (uint)AttachmentPoint.LeftHand; | 581 | AttachmentPt = (uint)AttachmentPoint.LeftHand; |
582 | attachPos = Vector3.Zero; | 582 | attachPos = Vector3.Zero; |
583 | |||
583 | } | 584 | } |
584 | 585 | ||
586 | |||
585 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); | 587 | group.SetAttachmentPoint(Convert.ToByte(AttachmentPt)); |
586 | group.AbsolutePosition = attachPos; | 588 | group.AbsolutePosition = attachPos; |
587 | 589 | ||
588 | // Saves and gets assetID | 590 | // Saves and gets itemID |
589 | UUID itemId; | 591 | UUID itemId; |
590 | 592 | ||
591 | if (group.GetFromAssetID() == UUID.Zero) | 593 | if (group.GetFromItemID() == UUID.Zero) |
592 | { | 594 | { |
593 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); | 595 | m_parentScene.attachObjectAssetStore(remoteClient, group, remoteClient.AgentId, out itemId); |
594 | } | 596 | } |
595 | else | 597 | else |
596 | { | 598 | { |
597 | itemId = group.GetFromAssetID(); | 599 | itemId = group.GetFromItemID(); |
598 | } | 600 | } |
599 | 601 | ||
600 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); | 602 | m_parentScene.AttachObject(remoteClient, AttachmentPt, itemId, group); |
@@ -611,6 +613,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
611 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); | 613 | remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false); |
612 | } | 614 | } |
613 | } | 615 | } |
616 | else | ||
617 | m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID); | ||
614 | } | 618 | } |
615 | 619 | ||
616 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) | 620 | protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance) |
@@ -928,25 +932,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
928 | { | 932 | { |
929 | // Primitive Ray Tracing | 933 | // Primitive Ray Tracing |
930 | float closestDistance = 280f; | 934 | float closestDistance = 280f; |
931 | EntityIntersection returnResult = new EntityIntersection(); | 935 | EntityIntersection result = new EntityIntersection(); |
932 | List<EntityBase> EntityList = GetEntities(); | 936 | List<EntityBase> EntityList = GetEntities(); |
933 | foreach (EntityBase ent in EntityList) | 937 | foreach (EntityBase ent in EntityList) |
934 | { | 938 | { |
935 | if (ent is SceneObjectGroup) | 939 | if (ent is SceneObjectGroup) |
936 | { | 940 | { |
937 | SceneObjectGroup reportingG = (SceneObjectGroup)ent; | 941 | SceneObjectGroup reportingG = (SceneObjectGroup)ent; |
938 | EntityIntersection result = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); | 942 | EntityIntersection inter = reportingG.TestIntersection(hray, frontFacesOnly, faceCenters); |
939 | if (result.HitTF) | 943 | if (inter.HitTF && inter.distance < closestDistance) |
940 | { | 944 | { |
941 | if (result.distance < closestDistance) | 945 | closestDistance = inter.distance; |
942 | { | 946 | result = inter; |
943 | closestDistance = result.distance; | ||
944 | returnResult = result; | ||
945 | } | ||
946 | } | 947 | } |
947 | } | 948 | } |
948 | } | 949 | } |
949 | return returnResult; | 950 | return result; |
950 | } | 951 | } |
951 | 952 | ||
952 | /// <summary> | 953 | /// <summary> |
@@ -979,7 +980,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
979 | { | 980 | { |
980 | foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) | 981 | foreach (SceneObjectPart p in ((SceneObjectGroup) ent).GetParts()) |
981 | { | 982 | { |
982 | if (p.Name==name) | 983 | if (p.Name == name) |
983 | { | 984 | { |
984 | return p; | 985 | return p; |
985 | } | 986 | } |
@@ -1307,7 +1308,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1307 | group.UpdateGroupPosition(pos); | 1308 | group.UpdateGroupPosition(pos); |
1308 | group.RootPart.IsAttachment = false; | 1309 | group.RootPart.IsAttachment = false; |
1309 | group.AbsolutePosition = group.RootPart.AttachedPos; | 1310 | group.AbsolutePosition = group.RootPart.AttachedPos; |
1310 | m_parentScene.updateKnownAsset(remoteClient, group, group.GetFromAssetID(), group.OwnerID); | 1311 | m_parentScene.UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); |
1311 | group.SetAttachmentPoint(attachmentPoint); | 1312 | group.SetAttachmentPoint(attachmentPoint); |
1312 | 1313 | ||
1313 | } | 1314 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c86e4a1..1b541c4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -447,22 +447,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
447 | } | 447 | } |
448 | } | 448 | } |
449 | 449 | ||
450 | public void SetFromAssetID(UUID AssetId) | 450 | public void SetFromItemID(UUID AssetId) |
451 | { | 451 | { |
452 | lock (m_parts) | 452 | lock (m_parts) |
453 | { | 453 | { |
454 | foreach (SceneObjectPart part in m_parts.Values) | 454 | foreach (SceneObjectPart part in m_parts.Values) |
455 | { | 455 | { |
456 | part.FromAssetID = AssetId; | 456 | part.FromItemID = AssetId; |
457 | } | 457 | } |
458 | } | 458 | } |
459 | } | 459 | } |
460 | 460 | ||
461 | public UUID GetFromAssetID() | 461 | public UUID GetFromItemID() |
462 | { | 462 | { |
463 | if (m_rootPart != null) | 463 | if (m_rootPart != null) |
464 | { | 464 | { |
465 | return m_rootPart.FromAssetID; | 465 | return m_rootPart.FromItemID; |
466 | } | 466 | } |
467 | return UUID.Zero; | 467 | return UUID.Zero; |
468 | } | 468 | } |
@@ -555,7 +555,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
555 | // If we get a result, we're going to find the closest result to the origin of the ray | 555 | // If we get a result, we're going to find the closest result to the origin of the ray |
556 | // and send back the intersection information back to the innerscene. | 556 | // and send back the intersection information back to the innerscene. |
557 | 557 | ||
558 | EntityIntersection returnresult = new EntityIntersection(); | 558 | EntityIntersection result = new EntityIntersection(); |
559 | 559 | ||
560 | lock (m_parts) | 560 | lock (m_parts) |
561 | { | 561 | { |
@@ -576,26 +576,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
576 | // when the camera crosses the border. | 576 | // when the camera crosses the border. |
577 | float idist = Constants.RegionSize; | 577 | float idist = Constants.RegionSize; |
578 | 578 | ||
579 | |||
580 | if (inter.HitTF) | 579 | if (inter.HitTF) |
581 | { | 580 | { |
582 | // We need to find the closest prim to return to the testcaller along the ray | 581 | // We need to find the closest prim to return to the testcaller along the ray |
583 | if (inter.distance < idist) | 582 | if (inter.distance < idist) |
584 | { | 583 | { |
585 | returnresult.HitTF = true; | 584 | result.HitTF = true; |
586 | returnresult.ipoint = inter.ipoint; | 585 | result.ipoint = inter.ipoint; |
587 | returnresult.obj = part; | 586 | result.obj = part; |
588 | returnresult.normal = inter.normal; | 587 | result.normal = inter.normal; |
589 | returnresult.distance = inter.distance; | 588 | result.distance = inter.distance; |
590 | } | 589 | } |
591 | } | 590 | } |
592 | } | 591 | } |
593 | } | 592 | } |
594 | return returnresult; | 593 | return result; |
595 | } | 594 | } |
596 | 595 | ||
597 | |||
598 | |||
599 | /// <summary> | 596 | /// <summary> |
600 | /// Gets a vector representing the size of the bounding box containing all the prims in the group | 597 | /// Gets a vector representing the size of the bounding box containing all the prims in the group |
601 | /// Treats all prims as rectangular, so no shape (cut etc) is taken into account | 598 | /// Treats all prims as rectangular, so no shape (cut etc) is taken into account |
@@ -652,7 +649,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
652 | frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); | 649 | frontBottomRight.Y = orig.Y + (part.Scale.Y / 2); |
653 | frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); | 650 | frontBottomRight.Z = orig.Z - (part.Scale.Z / 2); |
654 | 651 | ||
655 | |||
656 | backTopLeft.X = orig.X + (part.Scale.X / 2); | 652 | backTopLeft.X = orig.X + (part.Scale.X / 2); |
657 | backTopLeft.Y = orig.Y - (part.Scale.Y / 2); | 653 | backTopLeft.Y = orig.Y - (part.Scale.Y / 2); |
658 | backTopLeft.Z = orig.Z + (part.Scale.Z / 2); | 654 | backTopLeft.Z = orig.Z + (part.Scale.Z / 2); |
@@ -839,7 +835,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
839 | if (backBottomLeft.Z < minZ) | 835 | if (backBottomLeft.Z < minZ) |
840 | minZ = backBottomLeft.Z; | 836 | minZ = backBottomLeft.Z; |
841 | } | 837 | } |
842 | |||
843 | } | 838 | } |
844 | 839 | ||
845 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); | 840 | Vector3 boundingBox = new Vector3(maxX - minX, maxY - minY, maxZ - minZ); |
@@ -860,6 +855,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
860 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); | 855 | // m_log.InfoFormat("BoundingBox is {0} , {1} , {2} ", boundingBox.X, boundingBox.Y, boundingBox.Z); |
861 | return boundingBox; | 856 | return boundingBox; |
862 | } | 857 | } |
858 | |||
863 | #endregion | 859 | #endregion |
864 | 860 | ||
865 | public void SaveScriptedState(XmlTextWriter writer) | 861 | public void SaveScriptedState(XmlTextWriter writer) |
@@ -939,6 +935,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
939 | SetAttachmentPoint(Convert.ToByte(attachmentpoint)); | 935 | SetAttachmentPoint(Convert.ToByte(attachmentpoint)); |
940 | 936 | ||
941 | avatar.AddAttachment(this); | 937 | avatar.AddAttachment(this); |
938 | m_log.DebugFormat("[SOG]: Added att {0} to avie {1}", UUID, avatar.UUID); | ||
942 | 939 | ||
943 | if (!silent) | 940 | if (!silent) |
944 | { | 941 | { |
@@ -1029,8 +1026,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1029 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); | 1026 | //m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_scene.m_physicalPrim); |
1030 | //AttachToBackup(); | 1027 | //AttachToBackup(); |
1031 | //m_rootPart.ScheduleFullUpdate(); | 1028 | //m_rootPart.ScheduleFullUpdate(); |
1032 | |||
1033 | } | 1029 | } |
1030 | |||
1034 | /// <summary> | 1031 | /// <summary> |
1035 | /// | 1032 | /// |
1036 | /// </summary> | 1033 | /// </summary> |
@@ -1130,6 +1127,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1130 | } | 1127 | } |
1131 | } | 1128 | } |
1132 | } | 1129 | } |
1130 | |||
1133 | // helper provided for parts. | 1131 | // helper provided for parts. |
1134 | public int GetSceneMaxUndo() | 1132 | public int GetSceneMaxUndo() |
1135 | { | 1133 | { |
@@ -1183,7 +1181,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1183 | { | 1181 | { |
1184 | SceneObjectPart part = GetChildPart(localId); | 1182 | SceneObjectPart part = GetChildPart(localId); |
1185 | OnGrabPart(part, offsetPos, remoteClient); | 1183 | OnGrabPart(part, offsetPos, remoteClient); |
1186 | |||
1187 | } | 1184 | } |
1188 | } | 1185 | } |
1189 | 1186 | ||
@@ -1267,28 +1264,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1267 | } | 1264 | } |
1268 | } | 1265 | } |
1269 | 1266 | ||
1270 | if ((aggregateScriptEvents & scriptEvents.at_target) != 0) | 1267 | m_scriptListens_atTarget = ((aggregateScriptEvents & scriptEvents.at_target) != 0); |
1271 | { | 1268 | m_scriptListens_notAtTarget = ((aggregateScriptEvents & scriptEvents.not_at_target) != 0); |
1272 | m_scriptListens_atTarget = true; | ||
1273 | } | ||
1274 | else | ||
1275 | { | ||
1276 | m_scriptListens_atTarget = false; | ||
1277 | } | ||
1278 | |||
1279 | if ((aggregateScriptEvents & scriptEvents.not_at_target) != 0) | ||
1280 | { | ||
1281 | m_scriptListens_notAtTarget = true; | ||
1282 | } | ||
1283 | else | ||
1284 | { | ||
1285 | m_scriptListens_notAtTarget = false; | ||
1286 | } | ||
1287 | 1269 | ||
1288 | if (m_scriptListens_atTarget || m_scriptListens_notAtTarget) | 1270 | if (!m_scriptListens_atTarget && !m_scriptListens_notAtTarget) |
1289 | { | ||
1290 | } | ||
1291 | else | ||
1292 | { | 1271 | { |
1293 | lock (m_targets) | 1272 | lock (m_targets) |
1294 | m_targets.Clear(); | 1273 | m_targets.Clear(); |
@@ -1787,9 +1766,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1787 | } | 1766 | } |
1788 | } | 1767 | } |
1789 | 1768 | ||
1790 | |||
1791 | |||
1792 | |||
1793 | /// <summary> | 1769 | /// <summary> |
1794 | /// Set the owner of the root part. | 1770 | /// Set the owner of the root part. |
1795 | /// </summary> | 1771 | /// </summary> |
@@ -3374,19 +3350,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3374 | 3350 | ||
3375 | public virtual string ExtraToXmlString() | 3351 | public virtual string ExtraToXmlString() |
3376 | { | 3352 | { |
3377 | return "<ExtraFromAssetID>" + GetFromAssetID().ToString() + "</ExtraFromAssetID>"; | 3353 | return "<ExtraFromItemID>" + GetFromItemID().ToString() + "</ExtraFromItemID>"; |
3378 | } | 3354 | } |
3379 | 3355 | ||
3380 | public virtual void ExtraFromXmlString(string xmlstr) | 3356 | public virtual void ExtraFromXmlString(string xmlstr) |
3381 | { | 3357 | { |
3382 | string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromAssetID>")); | 3358 | string id = xmlstr.Substring(xmlstr.IndexOf("<ExtraFromItemID>")); |
3383 | id = xmlstr.Replace("<ExtraFromAssetID>", ""); | 3359 | id = xmlstr.Replace("<ExtraFromItemID>", ""); |
3384 | id = id.Replace("</ExtraFromAssetID>", ""); | 3360 | id = id.Replace("</ExtraFromItemID>", ""); |
3385 | 3361 | ||
3386 | UUID uuid = UUID.Zero; | 3362 | UUID uuid = UUID.Zero; |
3387 | UUID.TryParse(id, out uuid); | 3363 | UUID.TryParse(id, out uuid); |
3388 | 3364 | ||
3389 | SetFromAssetID(uuid); | 3365 | SetFromItemID(uuid); |
3390 | } | 3366 | } |
3391 | #endregion | 3367 | #endregion |
3392 | 3368 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3646811..cf716e8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -139,7 +139,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
139 | public uint TimeStampTerse = 0; | 139 | public uint TimeStampTerse = 0; |
140 | 140 | ||
141 | [XmlIgnore] | 141 | [XmlIgnore] |
142 | public UUID FromAssetID = UUID.Zero; | 142 | public UUID FromItemID = UUID.Zero; |
143 | 143 | ||
144 | /// <value> | 144 | /// <value> |
145 | /// The UUID of the user inventory item from which this object was rezzed if this is a root part. | 145 | /// The UUID of the user inventory item from which this object was rezzed if this is a root part. |
@@ -2389,7 +2389,7 @@ if (m_shape != null) { | |||
2389 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, | 2389 | remoteClient.SendPrimitiveToClient(m_regionHandle, (ushort)(m_parentGroup.GetTimeDilation() * (float)ushort.MaxValue), LocalId, m_shape, |
2390 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, | 2390 | lPos, Velocity, Acceleration, RotationOffset, RotationalVelocity, clientFlags, m_uuid, _ownerID, |
2391 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, | 2391 | m_text, color, _parentID, m_particleSystem, m_clickAction, (byte)m_material, m_TextureAnimation, IsAttachment, |
2392 | AttachmentPoint,FromAssetID, Sound, SoundGain, SoundFlags, SoundRadius); | 2392 | AttachmentPoint,FromItemID, Sound, SoundGain, SoundFlags, SoundRadius); |
2393 | } | 2393 | } |
2394 | 2394 | ||
2395 | /// <summary> | 2395 | /// <summary> |
@@ -2710,11 +2710,10 @@ if (m_shape != null) { | |||
2710 | 2710 | ||
2711 | public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) | 2711 | public EntityIntersection TestIntersection(Ray iray, Quaternion parentrot) |
2712 | { | 2712 | { |
2713 | // In this case we're using a sphere with a radius of the largest dimention of the prim | 2713 | // In this case we're using a sphere with a radius of the largest dimension of the prim |
2714 | // TODO: Change to take shape into account | 2714 | // TODO: Change to take shape into account |
2715 | 2715 | ||
2716 | 2716 | EntityIntersection result = new EntityIntersection(); | |
2717 | EntityIntersection returnresult = new EntityIntersection(); | ||
2718 | Vector3 vAbsolutePosition = AbsolutePosition; | 2717 | Vector3 vAbsolutePosition = AbsolutePosition; |
2719 | Vector3 vScale = Scale; | 2718 | Vector3 vScale = Scale; |
2720 | Vector3 rOrigin = iray.Origin; | 2719 | Vector3 rOrigin = iray.Origin; |
@@ -2738,8 +2737,7 @@ if (m_shape != null) { | |||
2738 | 2737 | ||
2739 | Vector3 tmVal6 = vAbsolutePosition*rOrigin; | 2738 | Vector3 tmVal6 = vAbsolutePosition*rOrigin; |
2740 | 2739 | ||
2741 | 2740 | // Set Radius to the largest dimension of the prim | |
2742 | // Set Radius to the largest dimention of the prim | ||
2743 | float radius = 0f; | 2741 | float radius = 0f; |
2744 | if (vScale.X > radius) | 2742 | if (vScale.X > radius) |
2745 | radius = vScale.X; | 2743 | radius = vScale.X; |
@@ -2765,7 +2763,7 @@ if (m_shape != null) { | |||
2765 | if (rootsqr < 0.0f) | 2763 | if (rootsqr < 0.0f) |
2766 | { | 2764 | { |
2767 | // No intersection | 2765 | // No intersection |
2768 | return returnresult; | 2766 | return result; |
2769 | } | 2767 | } |
2770 | float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); | 2768 | float root = ((-itestPart2) - (float) Math.Sqrt((double) rootsqr))/(itestPart1*2.0f); |
2771 | 2769 | ||
@@ -2778,7 +2776,7 @@ if (m_shape != null) { | |||
2778 | if (root < 0.0f) | 2776 | if (root < 0.0f) |
2779 | { | 2777 | { |
2780 | // nope, no intersection | 2778 | // nope, no intersection |
2781 | return returnresult; | 2779 | return result; |
2782 | } | 2780 | } |
2783 | } | 2781 | } |
2784 | 2782 | ||
@@ -2788,12 +2786,12 @@ if (m_shape != null) { | |||
2788 | new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), | 2786 | new Vector3(iray.Origin.X + (iray.Direction.X*root), iray.Origin.Y + (iray.Direction.Y*root), |
2789 | iray.Origin.Z + (iray.Direction.Z*root)); | 2787 | iray.Origin.Z + (iray.Direction.Z*root)); |
2790 | 2788 | ||
2791 | returnresult.HitTF = true; | 2789 | result.HitTF = true; |
2792 | returnresult.ipoint = ipoint; | 2790 | result.ipoint = ipoint; |
2793 | 2791 | ||
2794 | // Normal is calculated by the difference and then normalizing the result | 2792 | // Normal is calculated by the difference and then normalizing the result |
2795 | Vector3 normalpart = ipoint - vAbsolutePosition; | 2793 | Vector3 normalpart = ipoint - vAbsolutePosition; |
2796 | returnresult.normal = normalpart / normalpart.Length(); | 2794 | result.normal = normalpart / normalpart.Length(); |
2797 | 2795 | ||
2798 | // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. | 2796 | // It's funny how the Vector3 object has a Distance function, but the Axiom.Math object doesn't. |
2799 | // I can write a function to do it.. but I like the fact that this one is Static. | 2797 | // I can write a function to do it.. but I like the fact that this one is Static. |
@@ -2802,9 +2800,9 @@ if (m_shape != null) { | |||
2802 | Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); | 2800 | Vector3 distanceConvert2 = new Vector3(ipoint.X, ipoint.Y, ipoint.Z); |
2803 | float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); | 2801 | float distance = (float) Util.GetDistanceTo(distanceConvert1, distanceConvert2); |
2804 | 2802 | ||
2805 | returnresult.distance = distance; | 2803 | result.distance = distance; |
2806 | 2804 | ||
2807 | return returnresult; | 2805 | return result; |
2808 | } | 2806 | } |
2809 | 2807 | ||
2810 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) | 2808 | public EntityIntersection TestIntersectionOBB(Ray iray, Quaternion parentrot, bool frontFacesOnly, bool faceCenters) |
@@ -3008,9 +3006,9 @@ if (m_shape != null) { | |||
3008 | //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1; | 3006 | //distance[i] = (normals[i].X * AmBa.X + normals[i].Y * AmBa.Y + normals[i].Z * AmBa.Z) * -1; |
3009 | } | 3007 | } |
3010 | 3008 | ||
3011 | EntityIntersection returnresult = new EntityIntersection(); | 3009 | EntityIntersection result = new EntityIntersection(); |
3012 | 3010 | ||
3013 | returnresult.distance = 1024; | 3011 | result.distance = 1024; |
3014 | float c = 0; | 3012 | float c = 0; |
3015 | float a = 0; | 3013 | float a = 0; |
3016 | float d = 0; | 3014 | float d = 0; |
@@ -3030,7 +3028,7 @@ if (m_shape != null) { | |||
3030 | //{ | 3028 | //{ |
3031 | //if (iray.Origin.Dot(normals[i]) > d) | 3029 | //if (iray.Origin.Dot(normals[i]) > d) |
3032 | //{ | 3030 | //{ |
3033 | //return returnresult; | 3031 | //return result; |
3034 | //} | 3032 | //} |
3035 | // else | 3033 | // else |
3036 | //{ | 3034 | //{ |
@@ -3044,7 +3042,7 @@ if (m_shape != null) { | |||
3044 | //{ | 3042 | //{ |
3045 | //if (a > fmin) | 3043 | //if (a > fmin) |
3046 | //{ | 3044 | //{ |
3047 | //return returnresult; | 3045 | //return result; |
3048 | //} | 3046 | //} |
3049 | //fmax = a; | 3047 | //fmax = a; |
3050 | //} | 3048 | //} |
@@ -3056,7 +3054,7 @@ if (m_shape != null) { | |||
3056 | //{ | 3054 | //{ |
3057 | //if (a < 0 || a < fmax) | 3055 | //if (a < 0 || a < fmax) |
3058 | //{ | 3056 | //{ |
3059 | //return returnresult; | 3057 | //return result; |
3060 | //} | 3058 | //} |
3061 | //fmin = a; | 3059 | //fmin = a; |
3062 | //} | 3060 | //} |
@@ -3112,17 +3110,17 @@ if (m_shape != null) { | |||
3112 | // distance2 = (float)GetDistanceTo(q, iray.Origin); | 3110 | // distance2 = (float)GetDistanceTo(q, iray.Origin); |
3113 | //} | 3111 | //} |
3114 | 3112 | ||
3115 | if (distance2 < returnresult.distance) | 3113 | if (distance2 < result.distance) |
3116 | { | 3114 | { |
3117 | returnresult.distance = distance2; | 3115 | result.distance = distance2; |
3118 | returnresult.HitTF = true; | 3116 | result.HitTF = true; |
3119 | returnresult.ipoint = q; | 3117 | result.ipoint = q; |
3120 | //m_log.Info("[FACE]:" + i.ToString()); | 3118 | //m_log.Info("[FACE]:" + i.ToString()); |
3121 | //m_log.Info("[POINT]: " + q.ToString()); | 3119 | //m_log.Info("[POINT]: " + q.ToString()); |
3122 | //m_log.Info("[DIST]: " + distance2.ToString()); | 3120 | //m_log.Info("[DIST]: " + distance2.ToString()); |
3123 | if (faceCenters) | 3121 | if (faceCenters) |
3124 | { | 3122 | { |
3125 | returnresult.normal = AAfacenormals[i] * AXrot; | 3123 | result.normal = AAfacenormals[i] * AXrot; |
3126 | 3124 | ||
3127 | Vector3 scaleComponent = AAfacenormals[i]; | 3125 | Vector3 scaleComponent = AAfacenormals[i]; |
3128 | float ScaleOffset = 0.5f; | 3126 | float ScaleOffset = 0.5f; |
@@ -3130,20 +3128,20 @@ if (m_shape != null) { | |||
3130 | if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y; | 3128 | if (scaleComponent.Y != 0) ScaleOffset = AXscale.Y; |
3131 | if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z; | 3129 | if (scaleComponent.Z != 0) ScaleOffset = AXscale.Z; |
3132 | ScaleOffset = Math.Abs(ScaleOffset); | 3130 | ScaleOffset = Math.Abs(ScaleOffset); |
3133 | Vector3 offset = returnresult.normal * ScaleOffset; | 3131 | Vector3 offset = result.normal * ScaleOffset; |
3134 | returnresult.ipoint = AXpos + offset; | 3132 | result.ipoint = AXpos + offset; |
3135 | 3133 | ||
3136 | ///pos = (intersectionpoint + offset); | 3134 | ///pos = (intersectionpoint + offset); |
3137 | } | 3135 | } |
3138 | else | 3136 | else |
3139 | { | 3137 | { |
3140 | returnresult.normal = normals[i]; | 3138 | result.normal = normals[i]; |
3141 | } | 3139 | } |
3142 | returnresult.AAfaceNormal = AAfacenormals[i]; | 3140 | result.AAfaceNormal = AAfacenormals[i]; |
3143 | } | 3141 | } |
3144 | } | 3142 | } |
3145 | } | 3143 | } |
3146 | return returnresult; | 3144 | return result; |
3147 | } | 3145 | } |
3148 | 3146 | ||
3149 | /// <summary> | 3147 | /// <summary> |
@@ -3767,7 +3765,7 @@ if (m_shape != null) { | |||
3767 | (ushort)(m_parentGroup.GetTimeDilation() * | 3765 | (ushort)(m_parentGroup.GetTimeDilation() * |
3768 | (float)ushort.MaxValue), LocalId, lPos, | 3766 | (float)ushort.MaxValue), LocalId, lPos, |
3769 | RotationOffset, Velocity, | 3767 | RotationOffset, Velocity, |
3770 | RotationalVelocity, state, FromAssetID, | 3768 | RotationalVelocity, state, FromItemID, |
3771 | OwnerID, (int)AttachmentPoint); | 3769 | OwnerID, (int)AttachmentPoint); |
3772 | } | 3770 | } |
3773 | 3771 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4695df7..ff97183 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -652,9 +652,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
652 | RegisterToEvents(); | 652 | RegisterToEvents(); |
653 | SetDirectionVectors(); | 653 | SetDirectionVectors(); |
654 | 654 | ||
655 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); | ||
656 | if (userInfo != null) | ||
657 | userInfo.OnItemReceived += ItemReceived; | ||
658 | } | 655 | } |
659 | 656 | ||
660 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, | 657 | public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, |
@@ -833,11 +830,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
833 | 830 | ||
834 | m_scene.SwapRootAgentCount(false); | 831 | m_scene.SwapRootAgentCount(false); |
835 | 832 | ||
836 | CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); | 833 | //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); |
837 | if (userInfo != null) | 834 | //if (userInfo != null) |
838 | userInfo.FetchInventory(); | 835 | // userInfo.FetchInventory(); |
839 | else | 836 | //else |
840 | m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); | 837 | // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); |
841 | 838 | ||
842 | // On the next prim update, all objects will be sent | 839 | // On the next prim update, all objects will be sent |
843 | // | 840 | // |
@@ -1021,7 +1018,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1021 | } | 1018 | } |
1022 | 1019 | ||
1023 | /// <summary> | 1020 | /// <summary> |
1024 | /// Complete Avatar's movement into the region | 1021 | /// Complete Avatar's movement into the region. |
1022 | /// This is called upon a very important packet sent from the client, | ||
1023 | /// so it's client-controlled. Never call this method directly. | ||
1025 | /// </summary> | 1024 | /// </summary> |
1026 | public void CompleteMovement() | 1025 | public void CompleteMovement() |
1027 | { | 1026 | { |
@@ -1042,22 +1041,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
1042 | AbsolutePosition = pos; | 1041 | AbsolutePosition = pos; |
1043 | } | 1042 | } |
1044 | 1043 | ||
1045 | if (m_isChildAgent) | 1044 | m_isChildAgent = false; |
1046 | { | 1045 | bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); |
1047 | m_isChildAgent = false; | 1046 | MakeRootAgent(AbsolutePosition, m_flying); |
1048 | bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); | ||
1049 | MakeRootAgent(AbsolutePosition, m_flying); | ||
1050 | |||
1051 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) | ||
1052 | { | ||
1053 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | ||
1054 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | ||
1055 | m_callbackURI = null; | ||
1056 | } | ||
1057 | 1047 | ||
1058 | //m_log.DebugFormat("Completed movement"); | 1048 | if ((m_callbackURI != null) && !m_callbackURI.Equals("")) |
1049 | { | ||
1050 | m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); | ||
1051 | Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); | ||
1052 | m_callbackURI = null; | ||
1059 | } | 1053 | } |
1060 | 1054 | ||
1055 | //m_log.DebugFormat("Completed movement"); | ||
1056 | |||
1061 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); | 1057 | m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); |
1062 | SendInitialData(); | 1058 | SendInitialData(); |
1063 | 1059 | ||
@@ -3154,6 +3150,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
3154 | m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); | 3150 | m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); |
3155 | } | 3151 | } |
3156 | 3152 | ||
3153 | //Attachments | ||
3154 | List<int> attPoints = m_appearance.GetAttachedPoints(); | ||
3155 | if (attPoints != null) | ||
3156 | { | ||
3157 | m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); | ||
3158 | int i = 0; | ||
3159 | AttachmentData[] attachs = new AttachmentData[attPoints.Count]; | ||
3160 | foreach (int point in attPoints) | ||
3161 | { | ||
3162 | attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); | ||
3163 | } | ||
3164 | cAgent.Attachments = attachs; | ||
3165 | } | ||
3166 | |||
3157 | // Animations | 3167 | // Animations |
3158 | try | 3168 | try |
3159 | { | 3169 | { |
@@ -3219,6 +3229,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
3219 | m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); | 3229 | m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); |
3220 | } | 3230 | } |
3221 | 3231 | ||
3232 | // Attachments | ||
3233 | try | ||
3234 | { | ||
3235 | if (cAgent.Attachments != null) | ||
3236 | { | ||
3237 | foreach (AttachmentData att in cAgent.Attachments) | ||
3238 | { | ||
3239 | m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); | ||
3240 | } | ||
3241 | } | ||
3242 | } | ||
3243 | catch { } | ||
3244 | |||
3222 | // Animations | 3245 | // Animations |
3223 | try | 3246 | try |
3224 | { | 3247 | { |
@@ -3729,69 +3752,49 @@ namespace OpenSim.Region.Framework.Scenes | |||
3729 | return flags; | 3752 | return flags; |
3730 | } | 3753 | } |
3731 | 3754 | ||
3732 | private void ItemReceived(UUID itemID) | 3755 | /// <summary> |
3756 | /// RezAttachments. This should only be called upon login on the first region. | ||
3757 | /// Attachment rezzings on crossings and TPs are done in a different way. | ||
3758 | /// </summary> | ||
3759 | public void RezAttachments() | ||
3733 | { | 3760 | { |
3734 | if (IsChildAgent) | ||
3735 | return; | ||
3736 | |||
3737 | if (null == m_appearance) | 3761 | if (null == m_appearance) |
3738 | { | 3762 | { |
3739 | m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); | 3763 | m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); |
3740 | return; | 3764 | return; |
3741 | } | 3765 | } |
3742 | 3766 | ||
3743 | int attachpoint = m_appearance.GetAttachpoint(itemID); | 3767 | List<int> attPoints = m_appearance.GetAttachedPoints(); |
3744 | if (attachpoint == 0) | 3768 | foreach (int p in attPoints) |
3745 | return; | ||
3746 | |||
3747 | UUID asset = m_appearance.GetAttachedAsset(attachpoint); | ||
3748 | if (UUID.Zero == asset) // We have just logged in | ||
3749 | { | 3769 | { |
3770 | UUID itemID = m_appearance.GetAttachedItem(p); | ||
3771 | UUID assetID = m_appearance.GetAttachedAsset(p); | ||
3772 | |||
3773 | // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down | ||
3774 | // But they're not used anyway, the item is being looked up for now, so let's proceed. | ||
3775 | //if (UUID.Zero == assetID) | ||
3776 | //{ | ||
3777 | // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); | ||
3778 | // continue; | ||
3779 | //} | ||
3780 | |||
3750 | try | 3781 | try |
3751 | { | 3782 | { |
3752 | // Rez from inventory | 3783 | // Rez from inventory |
3753 | asset = m_scene.RezSingleAttachment(ControllingClient, | 3784 | UUID asset = m_scene.RezSingleAttachment(ControllingClient, |
3754 | itemID, (uint)attachpoint); | 3785 | itemID, (uint)p); |
3755 | // Corner case: We are not yet a Scene Entity | 3786 | |
3756 | // Setting attachment info in RezSingleAttachment will fail | 3787 | m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", |
3757 | // Set it here | 3788 | p, itemID, assetID, asset); |
3758 | // | ||
3759 | m_appearance.SetAttachment((int)attachpoint, itemID, | ||
3760 | asset); | ||
3761 | m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}", | ||
3762 | itemID.ToString(), asset); | ||
3763 | 3789 | ||
3764 | } | 3790 | } |
3765 | catch (Exception e) | 3791 | catch (Exception e) |
3766 | { | 3792 | { |
3767 | m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); | 3793 | m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); |
3768 | } | 3794 | } |
3769 | 3795 | ||
3770 | return; | ||
3771 | } | 3796 | } |
3772 | 3797 | ||
3773 | SceneObjectPart att = m_scene.GetSceneObjectPart(asset); | ||
3774 | |||
3775 | // If this is null, then the asset has not yet appeared in world | ||
3776 | // so we revisit this when it does | ||
3777 | // | ||
3778 | if (att != null && att.UUID != asset) // Yes. It's really needed | ||
3779 | { | ||
3780 | m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); | ||
3781 | |||
3782 | // This will throw if crossing katty-korner | ||
3783 | // So catch it here to avoid the noid | ||
3784 | // | ||
3785 | try | ||
3786 | { | ||
3787 | // Attach from world, if not already attached | ||
3788 | if (att.ParentGroup != null && !att.IsAttachment) | ||
3789 | m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); | ||
3790 | } | ||
3791 | catch (NullReferenceException) | ||
3792 | { | ||
3793 | } | ||
3794 | } | ||
3795 | } | 3798 | } |
3796 | } | 3799 | } |
3797 | } | 3800 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs index 88452d2..ce6f3d6 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTests.cs | |||
@@ -114,6 +114,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
114 | agent.startpos = Vector3.Zero; | 114 | agent.startpos = Vector3.Zero; |
115 | agent.CapsPath = GetRandomCapsObjectPath(); | 115 | agent.CapsPath = GetRandomCapsObjectPath(); |
116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); | 116 | agent.ChildrenCapSeeds = new Dictionary<ulong, string>(); |
117 | agent.child = true; | ||
117 | 118 | ||
118 | string reason; | 119 | string reason; |
119 | scene.NewUserConnection(agent, out reason); | 120 | scene.NewUserConnection(agent, out reason); |
@@ -205,7 +206,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
205 | */ | 206 | */ |
206 | } | 207 | } |
207 | 208 | ||
208 | [Test] | 209 | // I'm commenting this test, because this is not supposed to happen here |
210 | //[Test] | ||
209 | public void T020_TestMakeRootAgent() | 211 | public void T020_TestMakeRootAgent() |
210 | { | 212 | { |
211 | TestHelper.InMethod(); | 213 | TestHelper.InMethod(); |
@@ -228,21 +230,24 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
228 | { | 230 | { |
229 | TestHelper.InMethod(); | 231 | TestHelper.InMethod(); |
230 | 232 | ||
233 | scene.RegisterRegionWithGrid(); | ||
234 | scene2.RegisterRegionWithGrid(); | ||
235 | |||
231 | // Adding child agent to region 1001 | 236 | // Adding child agent to region 1001 |
232 | string reason; | 237 | string reason; |
233 | scene2.NewUserConnection(acd1, out reason); | 238 | scene2.NewUserConnection(acd1, out reason); |
234 | scene2.AddNewClient(testclient); | 239 | scene2.AddNewClient(testclient); |
235 | 240 | ||
236 | ScenePresence presence = scene.GetScenePresence(agent1); | 241 | ScenePresence presence = scene.GetScenePresence(agent1); |
242 | presence.MakeRootAgent(new Vector3(0,Constants.RegionSize-1,0), true); | ||
243 | |||
237 | ScenePresence presence2 = scene2.GetScenePresence(agent1); | 244 | ScenePresence presence2 = scene2.GetScenePresence(agent1); |
238 | 245 | ||
239 | // Adding neighbour region caps info to presence2 | 246 | // Adding neighbour region caps info to presence2 |
247 | |||
240 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; | 248 | string cap = presence.ControllingClient.RequestClientInfo().CapsPath; |
241 | presence2.AddNeighbourRegion(region1, cap); | 249 | presence2.AddNeighbourRegion(region1, cap); |
242 | 250 | ||
243 | scene.RegisterRegionWithGrid(); | ||
244 | scene2.RegisterRegionWithGrid(); | ||
245 | |||
246 | Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); | 251 | Assert.That(presence.IsChildAgent, Is.False, "Did not start root in origin region."); |
247 | Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); | 252 | Assert.That(presence2.IsChildAgent, Is.True, "Is not a child on destination region."); |
248 | 253 | ||
@@ -343,7 +348,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests | |||
343 | Assert.That(presence.HasAttachments(), Is.False); | 348 | Assert.That(presence.HasAttachments(), Is.False); |
344 | } | 349 | } |
345 | 350 | ||
346 | [Test] | 351 | // I'm commenting this test because scene setup NEEDS InventoryService to |
352 | // be non-null | ||
353 | //[Test] | ||
347 | public void T032_CrossAttachments() | 354 | public void T032_CrossAttachments() |
348 | { | 355 | { |
349 | TestHelper.InMethod(); | 356 | TestHelper.InMethod(); |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 08fc61f..4a2d7b5 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -634,7 +634,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
634 | { | 634 | { |
635 | get { return (uint)Util.RandomClass.Next(0,int.MaxValue); } | 635 | get { return (uint)Util.RandomClass.Next(0,int.MaxValue); } |
636 | } | 636 | } |
637 | 637 | #pragma warning disable 67 | |
638 | public event GenericMessage OnGenericMessage; | 638 | public event GenericMessage OnGenericMessage; |
639 | public event ImprovedInstantMessage OnInstantMessage; | 639 | public event ImprovedInstantMessage OnInstantMessage; |
640 | public event ChatMessage OnChatFromClient; | 640 | public event ChatMessage OnChatFromClient; |
@@ -686,6 +686,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
686 | public event SpinStop OnSpinStop; | 686 | public event SpinStop OnSpinStop; |
687 | public event UpdateShape OnUpdatePrimShape; | 687 | public event UpdateShape OnUpdatePrimShape; |
688 | public event ObjectExtraParams OnUpdateExtraParams; | 688 | public event ObjectExtraParams OnUpdateExtraParams; |
689 | public event ObjectRequest OnObjectRequest; | ||
689 | public event ObjectSelect OnObjectSelect; | 690 | public event ObjectSelect OnObjectSelect; |
690 | public event ObjectDeselect OnObjectDeselect; | 691 | public event ObjectDeselect OnObjectDeselect; |
691 | public event GenericCall7 OnObjectDescription; | 692 | public event GenericCall7 OnObjectDescription; |
@@ -825,6 +826,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
825 | public event AvatarNotesUpdate OnAvatarNotesUpdate; | 826 | public event AvatarNotesUpdate OnAvatarNotesUpdate; |
826 | public event MuteListRequest OnMuteListRequest; | 827 | public event MuteListRequest OnMuteListRequest; |
827 | public event PlacesQuery OnPlacesQuery; | 828 | public event PlacesQuery OnPlacesQuery; |
829 | #pragma warning restore 67 | ||
828 | 830 | ||
829 | public void SetDebugPacketLevel(int newDebug) | 831 | public void SetDebugPacketLevel(int newDebug) |
830 | { | 832 | { |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs index f03e5fc..b61959f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/ChannelState.cs | |||
@@ -83,6 +83,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
83 | 83 | ||
84 | internal string _accessPassword = String.Empty; | 84 | internal string _accessPassword = String.Empty; |
85 | internal Regex AccessPasswordRegex = null; | 85 | internal Regex AccessPasswordRegex = null; |
86 | internal List<string> ExcludeList = new List<string>(); | ||
86 | internal string AccessPassword | 87 | internal string AccessPassword |
87 | { | 88 | { |
88 | get { return _accessPassword; } | 89 | get { return _accessPassword; } |
@@ -210,8 +211,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
210 | m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay); | 211 | m_log.DebugFormat("[IRC-Channel-{0}] PingDelay : <{1}>", cs.idn, cs.PingDelay); |
211 | cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword)); | 212 | cs.AccessPassword = Substitute(rs, config.GetString("access_password", cs.AccessPassword)); |
212 | m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); | 213 | m_log.DebugFormat("[IRC-Channel-{0}] AccessPassword : <{1}>", cs.idn, cs.AccessPassword); |
213 | 214 | string[] excludes = config.GetString("exclude_list", "").Trim().Split(new Char[] { ',' }); | |
214 | 215 | cs.ExcludeList = new List<string>(excludes.Length); | |
216 | foreach(string name in excludes) | ||
217 | { | ||
218 | cs.ExcludeList.Add(name.Trim().ToLower()); | ||
219 | } | ||
220 | |||
215 | // Fail if fundamental information is still missing | 221 | // Fail if fundamental information is still missing |
216 | 222 | ||
217 | if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) | 223 | if (cs.Server == null || cs.IrcChannel == null || cs.BaseNickname == null || cs.User == null) |
diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index 203948e..c49d942 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs | |||
@@ -145,7 +145,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
145 | if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting)) | 145 | if (enabled && (cs.irc.Enabled) && (cs.irc.Connected) && (cs.ClientReporting)) |
146 | { | 146 | { |
147 | m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name); | 147 | m_log.InfoFormat("[IRC-Region {0}]: {1} has left", Region, client.Name); |
148 | cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); | 148 | //Check if this person is excluded from IRC |
149 | if (!cs.ExcludeList.Contains(client.Name.ToLower())) | ||
150 | { | ||
151 | cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has left", client.Name)); | ||
152 | } | ||
149 | } | 153 | } |
150 | client.OnLogout -= OnClientLoggedOut; | 154 | client.OnLogout -= OnClientLoggedOut; |
151 | client.OnConnectionClosed -= OnClientLoggedOut; | 155 | client.OnConnectionClosed -= OnClientLoggedOut; |
@@ -209,7 +213,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat | |||
209 | { | 213 | { |
210 | string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); | 214 | string clientName = String.Format("{0} {1}", presence.Firstname, presence.Lastname); |
211 | m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName); | 215 | m_log.DebugFormat("[IRC-Region {0}] {1} has arrived", Region, clientName); |
212 | cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); | 216 | //Check if this person is excluded from IRC |
217 | if (!cs.ExcludeList.Contains(clientName.ToLower())) | ||
218 | { | ||
219 | cs.irc.PrivMsg(cs.NoticeMessageFormat, cs.irc.Nick, Region, String.Format("{0} has arrived", clientName)); | ||
220 | } | ||
213 | } | 221 | } |
214 | } | 222 | } |
215 | } | 223 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs new file mode 100644 index 0000000..533d176 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ISecurityCredential.cs | |||
@@ -0,0 +1,36 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
29 | { | ||
30 | public interface ISecurityCredential | ||
31 | { | ||
32 | ISocialEntity owner { get; } | ||
33 | bool CanEditObject(IObject target); | ||
34 | bool CanEditTerrain(int x, int y); | ||
35 | } | ||
36 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs index 849e3ca..03c1e95 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatar.cs | |||
@@ -32,19 +32,6 @@ using OpenMetaverse; | |||
32 | 32 | ||
33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 33 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
34 | { | 34 | { |
35 | public interface IAvatarAttachment | ||
36 | { | ||
37 | //// <value> | ||
38 | /// Describes where on the avatar the attachment is located | ||
39 | /// </value> | ||
40 | int Location { get ; } | ||
41 | |||
42 | //// <value> | ||
43 | /// Accessor to the rez'ed asset, representing the attachment | ||
44 | /// </value> | ||
45 | IObject Asset { get; } | ||
46 | } | ||
47 | |||
48 | public interface IAvatar : IEntity | 35 | public interface IAvatar : IEntity |
49 | { | 36 | { |
50 | //// <value> | 37 | //// <value> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs new file mode 100644 index 0000000..1993948 --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IAvatarAttachment.cs | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
29 | { | ||
30 | public interface IAvatarAttachment | ||
31 | { | ||
32 | //// <value> | ||
33 | /// Describes where on the avatar the attachment is located | ||
34 | /// </value> | ||
35 | int Location { get ; } | ||
36 | |||
37 | //// <value> | ||
38 | /// Accessor to the rez'ed asset, representing the attachment | ||
39 | /// </value> | ||
40 | IObject Asset { get; } | ||
41 | } | ||
42 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs index 6415250..19f7210 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IObject.cs | |||
@@ -212,6 +212,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
212 | bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) | 212 | bool Bright { get; set; } // SetPrimParms(FULLBRIGHT) |
213 | double Bloom { get; set; } // SetPrimParms(GLOW) | 213 | double Bloom { get; set; } // SetPrimParms(GLOW) |
214 | bool Shiny { get; set; } // SetPrimParms(SHINY) | 214 | bool Shiny { get; set; } // SetPrimParms(SHINY) |
215 | bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECIATE IN FAVOUR OF UUID?] | 215 | bool BumpMap { get; set; } // SetPrimParms(BUMPMAP) [DEPRECATE IN FAVOUR OF UUID?] |
216 | } | 216 | } |
217 | } | 217 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs index 5ed9af3..bf523dd 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MRMModule.cs | |||
@@ -27,9 +27,14 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.CodeDom.Compiler; | 29 | using System.CodeDom.Compiler; |
30 | using System.Collections; | ||
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
32 | using System.Diagnostics; | ||
31 | using System.IO; | 33 | using System.IO; |
32 | using System.Reflection; | 34 | using System.Reflection; |
35 | using System.Security; | ||
36 | using System.Security.Permissions; | ||
37 | using System.Security.Policy; | ||
33 | using System.Text; | 38 | using System.Text; |
34 | using log4net; | 39 | using log4net; |
35 | using Microsoft.CSharp; | 40 | using Microsoft.CSharp; |
@@ -54,6 +59,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
54 | 59 | ||
55 | private readonly MicroScheduler m_microthreads = new MicroScheduler(); | 60 | private readonly MicroScheduler m_microthreads = new MicroScheduler(); |
56 | 61 | ||
62 | |||
63 | private IConfig m_config; | ||
64 | |||
57 | public void RegisterExtension<T>(T instance) | 65 | public void RegisterExtension<T>(T instance) |
58 | { | 66 | { |
59 | m_extensions[typeof (T)] = instance; | 67 | m_extensions[typeof (T)] = instance; |
@@ -63,6 +71,8 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
63 | { | 71 | { |
64 | if (source.Configs["MRM"] != null) | 72 | if (source.Configs["MRM"] != null) |
65 | { | 73 | { |
74 | m_config = source.Configs["MRM"]; | ||
75 | |||
66 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) | 76 | if (source.Configs["MRM"].GetBoolean("Enabled", false)) |
67 | { | 77 | { |
68 | m_log.Info("[MRM] Enabling MRM Module"); | 78 | m_log.Info("[MRM] Enabling MRM Module"); |
@@ -112,25 +122,128 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
112 | return script; | 122 | return script; |
113 | } | 123 | } |
114 | 124 | ||
125 | /// <summary> | ||
126 | /// Create an AppDomain that contains policy restricting code to execute | ||
127 | /// with only the permissions granted by a named permission set | ||
128 | /// </summary> | ||
129 | /// <param name="permissionSetName">name of the permission set to restrict to</param> | ||
130 | /// <param name="appDomainName">'friendly' name of the appdomain to be created</param> | ||
131 | /// <exception cref="ArgumentNullException"> | ||
132 | /// if <paramref name="permissionSetName"/> is null | ||
133 | /// </exception> | ||
134 | /// <exception cref="ArgumentOutOfRangeException"> | ||
135 | /// if <paramref name="permissionSetName"/> is empty | ||
136 | /// </exception> | ||
137 | /// <returns>AppDomain with a restricted security policy</returns> | ||
138 | /// <remarks>Substantial portions of this function from: http://blogs.msdn.com/shawnfa/archive/2004/10/25/247379.aspx | ||
139 | /// Valid permissionSetName values are: | ||
140 | /// * FullTrust | ||
141 | /// * SkipVerification | ||
142 | /// * Execution | ||
143 | /// * Nothing | ||
144 | /// * LocalIntranet | ||
145 | /// * Internet | ||
146 | /// * Everything | ||
147 | /// </remarks> | ||
148 | public static AppDomain CreateRestrictedDomain(string permissionSetName, string appDomainName) | ||
149 | { | ||
150 | if (permissionSetName == null) | ||
151 | throw new ArgumentNullException("permissionSetName"); | ||
152 | if (permissionSetName.Length == 0) | ||
153 | throw new ArgumentOutOfRangeException("permissionSetName", permissionSetName, | ||
154 | "Cannot have an empty permission set name"); | ||
155 | |||
156 | // Default to all code getting nothing | ||
157 | PolicyStatement emptyPolicy = new PolicyStatement(new PermissionSet(PermissionState.None)); | ||
158 | UnionCodeGroup policyRoot = new UnionCodeGroup(new AllMembershipCondition(), emptyPolicy); | ||
159 | |||
160 | bool foundName = false; | ||
161 | PermissionSet setIntersection = new PermissionSet(PermissionState.Unrestricted); | ||
162 | |||
163 | // iterate over each policy level | ||
164 | IEnumerator levelEnumerator = SecurityManager.PolicyHierarchy(); | ||
165 | while (levelEnumerator.MoveNext()) | ||
166 | { | ||
167 | PolicyLevel level = levelEnumerator.Current as PolicyLevel; | ||
168 | |||
169 | // if this level has defined a named permission set with the | ||
170 | // given name, then intersect it with what we've retrieved | ||
171 | // from all the previous levels | ||
172 | if (level != null) | ||
173 | { | ||
174 | PermissionSet levelSet = level.GetNamedPermissionSet(permissionSetName); | ||
175 | if (levelSet != null) | ||
176 | { | ||
177 | foundName = true; | ||
178 | if (setIntersection != null) | ||
179 | setIntersection = setIntersection.Intersect(levelSet); | ||
180 | } | ||
181 | } | ||
182 | } | ||
183 | |||
184 | // Intersect() can return null for an empty set, so convert that | ||
185 | // to an empty set object. Also return an empty set if we didn't find | ||
186 | // the named permission set we were looking for | ||
187 | if (setIntersection == null || !foundName) | ||
188 | setIntersection = new PermissionSet(PermissionState.None); | ||
189 | else | ||
190 | setIntersection = new NamedPermissionSet(permissionSetName, setIntersection); | ||
191 | |||
192 | // if no named permission sets were found, return an empty set, | ||
193 | // otherwise return the set that was found | ||
194 | PolicyStatement permissions = new PolicyStatement(setIntersection); | ||
195 | policyRoot.AddChild(new UnionCodeGroup(new AllMembershipCondition(), permissions)); | ||
196 | |||
197 | // create an AppDomain policy level for the policy tree | ||
198 | PolicyLevel appDomainLevel = PolicyLevel.CreateAppDomainLevel(); | ||
199 | appDomainLevel.RootCodeGroup = policyRoot; | ||
200 | |||
201 | // create an AppDomain where this policy will be in effect | ||
202 | string domainName = appDomainName; | ||
203 | AppDomain restrictedDomain = AppDomain.CreateDomain(domainName); | ||
204 | restrictedDomain.SetAppDomainPolicy(appDomainLevel); | ||
205 | |||
206 | return restrictedDomain; | ||
207 | } | ||
208 | |||
209 | |||
115 | void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) | 210 | void EventManager_OnRezScript(uint localID, UUID itemID, string script, int startParam, bool postOnRez, string engine, int stateSource) |
116 | { | 211 | { |
117 | if (script.StartsWith("//MRM:C#")) | 212 | if (script.StartsWith("//MRM:C#")) |
118 | { | 213 | { |
119 | if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID | 214 | if (m_config.GetBoolean("OwnerOnly", true)) |
120 | || | 215 | if (m_scene.GetSceneObjectPart(localID).OwnerID != m_scene.RegionInfo.MasterAvatarAssignedUUID |
121 | m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) | 216 | || m_scene.GetSceneObjectPart(localID).CreatorID != m_scene.RegionInfo.MasterAvatarAssignedUUID) |
122 | return; | 217 | return; |
123 | 218 | ||
124 | script = ConvertMRMKeywords(script); | 219 | script = ConvertMRMKeywords(script); |
125 | 220 | ||
126 | try | 221 | try |
127 | { | 222 | { |
128 | m_log.Info("[MRM] Found C# MRM"); | 223 | AppDomain target; |
224 | if (m_config.GetBoolean("Sandboxed", true)) | ||
225 | { | ||
226 | m_log.Info("[MRM] Found C# MRM - Starting in AppDomain with " + | ||
227 | m_config.GetString("SandboxLevel", "Internet") + "-level security."); | ||
228 | |||
229 | string domainName = UUID.Random().ToString(); | ||
230 | target = CreateRestrictedDomain(m_config.GetString("SandboxLevel", "Internet"), | ||
231 | domainName); | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | m_log.Info("[MRM] Found C# MRM - Starting in current AppDomain"); | ||
236 | m_log.Warn( | ||
237 | "[MRM] Security Risk: AppDomain is run in current context. Use only in trusted environments."); | ||
238 | target = AppDomain.CurrentDomain; | ||
239 | } | ||
129 | 240 | ||
130 | MRMBase mmb = (MRMBase)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap( | 241 | m_log.Info("[MRM] Unwrapping into target AppDomain"); |
242 | MRMBase mmb = (MRMBase) target.CreateInstanceFromAndUnwrap( | ||
131 | CompileFromDotNetText(script, itemID.ToString()), | 243 | CompileFromDotNetText(script, itemID.ToString()), |
132 | "OpenSim.MiniModule"); | 244 | "OpenSim.MiniModule"); |
133 | 245 | ||
246 | m_log.Info("[MRM] Initialising MRM Globals"); | ||
134 | InitializeMRM(mmb, localID, itemID); | 247 | InitializeMRM(mmb, localID, itemID); |
135 | 248 | ||
136 | m_scripts[itemID] = mmb; | 249 | m_scripts[itemID] = mmb; |
@@ -166,8 +279,14 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
166 | 279 | ||
167 | public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host) | 280 | public void GetGlobalEnvironment(uint localID, out IWorld world, out IHost host) |
168 | { | 281 | { |
169 | world = new World(m_scene); | 282 | // UUID should be changed to object owner. |
170 | host = new Host(new SOPObject(m_scene, localID), m_scene, new ExtensionHandler(m_extensions), m_microthreads); | 283 | UUID owner = m_scene.RegionInfo.MasterAvatarAssignedUUID; |
284 | SEUser securityUser = new SEUser(owner, "Name Unassigned"); | ||
285 | SecurityCredential creds = new SecurityCredential(securityUser, m_scene); | ||
286 | |||
287 | world = new World(m_scene, creds); | ||
288 | host = new Host(new SOPObject(m_scene, localID, creds), m_scene, new ExtensionHandler(m_extensions), | ||
289 | m_microthreads); | ||
171 | } | 290 | } |
172 | 291 | ||
173 | public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) | 292 | public void InitializeMRM(MRMBase mmb, uint localID, UUID itemID) |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs index 4638ad0..6ba5ccf 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/ObjectAccessor.cs | |||
@@ -40,10 +40,12 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
40 | { | 40 | { |
41 | private readonly Scene m_scene; | 41 | private readonly Scene m_scene; |
42 | private readonly IEnumerator<EntityBase> m_sogEnum; | 42 | private readonly IEnumerator<EntityBase> m_sogEnum; |
43 | private readonly ISecurityCredential m_security; | ||
43 | 44 | ||
44 | public IObjEnum(Scene scene) | 45 | public IObjEnum(Scene scene, ISecurityCredential security) |
45 | { | 46 | { |
46 | m_scene = scene; | 47 | m_scene = scene; |
48 | m_security = security; | ||
47 | m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); | 49 | m_sogEnum = m_scene.Entities.GetAllByType<SceneObjectGroup>().GetEnumerator(); |
48 | } | 50 | } |
49 | 51 | ||
@@ -66,7 +68,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
66 | { | 68 | { |
67 | get | 69 | get |
68 | { | 70 | { |
69 | return new SOPObject(m_scene, m_sogEnum.Current.LocalId); | 71 | return new SOPObject(m_scene, m_sogEnum.Current.LocalId, m_security); |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
@@ -79,17 +81,19 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
79 | public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor | 81 | public class ObjectAccessor : System.MarshalByRefObject, IObjectAccessor |
80 | { | 82 | { |
81 | private readonly Scene m_scene; | 83 | private readonly Scene m_scene; |
84 | private readonly ISecurityCredential m_security; | ||
82 | 85 | ||
83 | public ObjectAccessor(Scene scene) | 86 | public ObjectAccessor(Scene scene, ISecurityCredential security) |
84 | { | 87 | { |
85 | m_scene = scene; | 88 | m_scene = scene; |
89 | m_security = security; | ||
86 | } | 90 | } |
87 | 91 | ||
88 | public IObject this[int index] | 92 | public IObject this[int index] |
89 | { | 93 | { |
90 | get | 94 | get |
91 | { | 95 | { |
92 | return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId); | 96 | return new SOPObject(m_scene, m_scene.Entities[(uint)index].LocalId, m_security); |
93 | } | 97 | } |
94 | } | 98 | } |
95 | 99 | ||
@@ -97,7 +101,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
97 | { | 101 | { |
98 | get | 102 | get |
99 | { | 103 | { |
100 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); | 104 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); |
101 | } | 105 | } |
102 | } | 106 | } |
103 | 107 | ||
@@ -105,7 +109,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
105 | { | 109 | { |
106 | get | 110 | get |
107 | { | 111 | { |
108 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId); | 112 | return new SOPObject(m_scene, m_scene.Entities[index].LocalId, m_security); |
109 | } | 113 | } |
110 | } | 114 | } |
111 | 115 | ||
@@ -117,20 +121,20 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
117 | public IObject Create(Vector3 position, Quaternion rotation) | 121 | public IObject Create(Vector3 position, Quaternion rotation) |
118 | { | 122 | { |
119 | 123 | ||
120 | SceneObjectGroup sog = m_scene.AddNewPrim(m_scene.RegionInfo.MasterAvatarAssignedUUID, | 124 | SceneObjectGroup sog = m_scene.AddNewPrim(m_security.owner.GlobalID, |
121 | UUID.Zero, | 125 | UUID.Zero, |
122 | position, | 126 | position, |
123 | rotation, | 127 | rotation, |
124 | PrimitiveBaseShape.CreateBox()); | 128 | PrimitiveBaseShape.CreateBox()); |
125 | 129 | ||
126 | IObject ret = new SOPObject(m_scene, sog.LocalId); | 130 | IObject ret = new SOPObject(m_scene, sog.LocalId, m_security); |
127 | 131 | ||
128 | return ret; | 132 | return ret; |
129 | } | 133 | } |
130 | 134 | ||
131 | public IEnumerator<IObject> GetEnumerator() | 135 | public IEnumerator<IObject> GetEnumerator() |
132 | { | 136 | { |
133 | return new IObjEnum(m_scene); | 137 | return new IObjEnum(m_scene, m_security); |
134 | } | 138 | } |
135 | 139 | ||
136 | IEnumerator IEnumerable.GetEnumerator() | 140 | IEnumerator IEnumerable.GetEnumerator() |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs index bc26389..292e345 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObject.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Security; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
32 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
@@ -42,13 +43,22 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
42 | { | 43 | { |
43 | private readonly Scene m_rootScene; | 44 | private readonly Scene m_rootScene; |
44 | private readonly uint m_localID; | 45 | private readonly uint m_localID; |
46 | private readonly ISecurityCredential m_security; | ||
45 | 47 | ||
48 | [Obsolete("Replace with 'credential' constructor [security]")] | ||
46 | public SOPObject(Scene rootScene, uint localID) | 49 | public SOPObject(Scene rootScene, uint localID) |
47 | { | 50 | { |
48 | m_rootScene = rootScene; | 51 | m_rootScene = rootScene; |
49 | m_localID = localID; | 52 | m_localID = localID; |
50 | } | 53 | } |
51 | 54 | ||
55 | public SOPObject(Scene rootScene, uint localID, ISecurityCredential credential) | ||
56 | { | ||
57 | m_rootScene = rootScene; | ||
58 | m_localID = localID; | ||
59 | m_security = credential; | ||
60 | } | ||
61 | |||
52 | /// <summary> | 62 | /// <summary> |
53 | /// This needs to run very, very quickly. | 63 | /// This needs to run very, very quickly. |
54 | /// It is utilized in nearly every property and method. | 64 | /// It is utilized in nearly every property and method. |
@@ -59,6 +69,15 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
59 | return m_rootScene.GetSceneObjectPart(m_localID); | 69 | return m_rootScene.GetSceneObjectPart(m_localID); |
60 | } | 70 | } |
61 | 71 | ||
72 | private bool CanEdit() | ||
73 | { | ||
74 | if (!m_security.CanEditObject(this)) | ||
75 | { | ||
76 | throw new SecurityException("Insufficient Permission to edit object with UUID [" + GetSOP().UUID + "]"); | ||
77 | } | ||
78 | return true; | ||
79 | } | ||
80 | |||
62 | #region OnTouch | 81 | #region OnTouch |
63 | 82 | ||
64 | private event OnTouchDelegate _OnTouch; | 83 | private event OnTouchDelegate _OnTouch; |
@@ -68,14 +87,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
68 | { | 87 | { |
69 | add | 88 | add |
70 | { | 89 | { |
71 | if (!_OnTouchActive) | 90 | if (CanEdit()) |
72 | { | 91 | { |
73 | GetSOP().Flags |= PrimFlags.Touch; | 92 | if (!_OnTouchActive) |
74 | _OnTouchActive = true; | 93 | { |
75 | m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; | 94 | GetSOP().Flags |= PrimFlags.Touch; |
95 | _OnTouchActive = true; | ||
96 | m_rootScene.EventManager.OnObjectGrab += EventManager_OnObjectGrab; | ||
97 | } | ||
98 | |||
99 | _OnTouch += value; | ||
76 | } | 100 | } |
77 | |||
78 | _OnTouch += value; | ||
79 | } | 101 | } |
80 | remove | 102 | remove |
81 | { | 103 | { |
@@ -95,7 +117,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
95 | if (_OnTouchActive && m_localID == localID) | 117 | if (_OnTouchActive && m_localID == localID) |
96 | { | 118 | { |
97 | TouchEventArgs e = new TouchEventArgs(); | 119 | TouchEventArgs e = new TouchEventArgs(); |
98 | e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId); | 120 | e.Avatar = new SPAvatar(m_rootScene, remoteClient.AgentId, m_security); |
99 | e.TouchBiNormal = surfaceArgs.Binormal; | 121 | e.TouchBiNormal = surfaceArgs.Binormal; |
100 | e.TouchMaterialIndex = surfaceArgs.FaceIndex; | 122 | e.TouchMaterialIndex = surfaceArgs.FaceIndex; |
101 | e.TouchNormal = surfaceArgs.Normal; | 123 | e.TouchNormal = surfaceArgs.Normal; |
@@ -130,13 +152,21 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
130 | public string Name | 152 | public string Name |
131 | { | 153 | { |
132 | get { return GetSOP().Name; } | 154 | get { return GetSOP().Name; } |
133 | set { GetSOP().Name = value; } | 155 | set |
156 | { | ||
157 | if (CanEdit()) | ||
158 | GetSOP().Name = value; | ||
159 | } | ||
134 | } | 160 | } |
135 | 161 | ||
136 | public string Description | 162 | public string Description |
137 | { | 163 | { |
138 | get { return GetSOP().Description; } | 164 | get { return GetSOP().Description; } |
139 | set { GetSOP().Description = value; } | 165 | set |
166 | { | ||
167 | if (CanEdit()) | ||
168 | GetSOP().Description = value; | ||
169 | } | ||
140 | } | 170 | } |
141 | 171 | ||
142 | public IObject[] Children | 172 | public IObject[] Children |
@@ -151,7 +181,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
151 | int i = 0; | 181 | int i = 0; |
152 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) | 182 | foreach (KeyValuePair<UUID, SceneObjectPart> pair in my.ParentGroup.Children) |
153 | { | 183 | { |
154 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId); | 184 | rets[i++] = new SOPObject(m_rootScene, pair.Value.LocalId, m_security); |
155 | } | 185 | } |
156 | 186 | ||
157 | return rets; | 187 | return rets; |
@@ -160,7 +190,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
160 | 190 | ||
161 | public IObject Root | 191 | public IObject Root |
162 | { | 192 | { |
163 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId); } | 193 | get { return new SOPObject(m_rootScene, GetSOP().ParentGroup.RootPart.LocalId, m_security); } |
164 | } | 194 | } |
165 | 195 | ||
166 | public IObjectMaterial[] Materials | 196 | public IObjectMaterial[] Materials |
@@ -182,7 +212,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
182 | public Vector3 Scale | 212 | public Vector3 Scale |
183 | { | 213 | { |
184 | get { return GetSOP().Scale; } | 214 | get { return GetSOP().Scale; } |
185 | set { GetSOP().Scale = value; } | 215 | set |
216 | { | ||
217 | if (CanEdit()) | ||
218 | GetSOP().Scale = value; | ||
219 | } | ||
186 | } | 220 | } |
187 | 221 | ||
188 | public Quaternion WorldRotation | 222 | public Quaternion WorldRotation |
@@ -202,15 +236,24 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
202 | get { return GetSOP().AbsolutePosition; } | 236 | get { return GetSOP().AbsolutePosition; } |
203 | set | 237 | set |
204 | { | 238 | { |
205 | SceneObjectPart pos = GetSOP(); | 239 | if (CanEdit()) |
206 | pos.UpdateOffSet(value - pos.AbsolutePosition); | 240 | { |
241 | SceneObjectPart pos = GetSOP(); | ||
242 | pos.UpdateOffSet(value - pos.AbsolutePosition); | ||
243 | } | ||
207 | } | 244 | } |
208 | } | 245 | } |
209 | 246 | ||
210 | public Vector3 OffsetPosition | 247 | public Vector3 OffsetPosition |
211 | { | 248 | { |
212 | get { return GetSOP().OffsetPosition; } | 249 | get { return GetSOP().OffsetPosition; } |
213 | set { GetSOP().OffsetPosition = value; } | 250 | set |
251 | { | ||
252 | if (CanEdit()) | ||
253 | { | ||
254 | GetSOP().OffsetPosition = value; | ||
255 | } | ||
256 | } | ||
214 | } | 257 | } |
215 | 258 | ||
216 | public Vector3 SitTarget | 259 | public Vector3 SitTarget |
@@ -310,8 +353,10 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
310 | 353 | ||
311 | public void Say(string msg) | 354 | public void Say(string msg) |
312 | { | 355 | { |
313 | SceneObjectPart sop = GetSOP(); | 356 | if (!CanEdit()) |
357 | return; | ||
314 | 358 | ||
359 | SceneObjectPart sop = GetSOP(); | ||
315 | m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); | 360 | m_rootScene.SimChat(msg, ChatTypeEnum.Say, sop.AbsolutePosition, sop.Name, sop.UUID, false); |
316 | } | 361 | } |
317 | 362 | ||
@@ -503,6 +548,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
503 | } | 548 | } |
504 | set | 549 | set |
505 | { | 550 | { |
551 | if (!CanEdit()) | ||
552 | return; | ||
553 | |||
506 | GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); | 554 | GetSOP().PhysActor.RotationalVelocity = new PhysicsVector(value.X, value.Y, value.Z); |
507 | } | 555 | } |
508 | } | 556 | } |
@@ -516,6 +564,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
516 | } | 564 | } |
517 | set | 565 | set |
518 | { | 566 | { |
567 | if (!CanEdit()) | ||
568 | return; | ||
569 | |||
519 | GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); | 570 | GetSOP().PhysActor.Velocity = new PhysicsVector(value.X, value.Y, value.Z); |
520 | } | 571 | } |
521 | } | 572 | } |
@@ -529,6 +580,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
529 | } | 580 | } |
530 | set | 581 | set |
531 | { | 582 | { |
583 | if (!CanEdit()) | ||
584 | return; | ||
585 | |||
532 | GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); | 586 | GetSOP().PhysActor.Torque = new PhysicsVector(value.X, value.Y, value.Z); |
533 | } | 587 | } |
534 | } | 588 | } |
@@ -551,27 +605,44 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
551 | } | 605 | } |
552 | set | 606 | set |
553 | { | 607 | { |
608 | if (!CanEdit()) | ||
609 | return; | ||
610 | |||
554 | GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); | 611 | GetSOP().PhysActor.Force = new PhysicsVector(value.X, value.Y, value.Z); |
555 | } | 612 | } |
556 | } | 613 | } |
557 | 614 | ||
558 | public bool FloatOnWater | 615 | public bool FloatOnWater |
559 | { | 616 | { |
560 | set { GetSOP().PhysActor.FloatOnWater = value; } | 617 | set |
618 | { | ||
619 | if (!CanEdit()) | ||
620 | return; | ||
621 | GetSOP().PhysActor.FloatOnWater = value; | ||
622 | } | ||
561 | } | 623 | } |
562 | 624 | ||
563 | public void AddForce(Vector3 force, bool pushforce) | 625 | public void AddForce(Vector3 force, bool pushforce) |
564 | { | 626 | { |
627 | if (!CanEdit()) | ||
628 | return; | ||
629 | |||
565 | GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); | 630 | GetSOP().PhysActor.AddForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); |
566 | } | 631 | } |
567 | 632 | ||
568 | public void AddAngularForce(Vector3 force, bool pushforce) | 633 | public void AddAngularForce(Vector3 force, bool pushforce) |
569 | { | 634 | { |
635 | if (!CanEdit()) | ||
636 | return; | ||
637 | |||
570 | GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); | 638 | GetSOP().PhysActor.AddAngularForce(new PhysicsVector(force.X, force.Y, force.Z), pushforce); |
571 | } | 639 | } |
572 | 640 | ||
573 | public void SetMomentum(Vector3 momentum) | 641 | public void SetMomentum(Vector3 momentum) |
574 | { | 642 | { |
643 | if (!CanEdit()) | ||
644 | return; | ||
645 | |||
575 | GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); | 646 | GetSOP().PhysActor.SetMomentum(new PhysicsVector(momentum.X, momentum.Y, momentum.Z)); |
576 | } | 647 | } |
577 | 648 | ||
@@ -586,6 +657,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
586 | get { return m_sculptMap; } | 657 | get { return m_sculptMap; } |
587 | set | 658 | set |
588 | { | 659 | { |
660 | if (!CanEdit()) | ||
661 | return; | ||
662 | |||
589 | m_sculptMap = value; | 663 | m_sculptMap = value; |
590 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | 664 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); |
591 | } | 665 | } |
@@ -598,6 +672,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
598 | get { return m_sculptType; } | 672 | get { return m_sculptType; } |
599 | set | 673 | set |
600 | { | 674 | { |
675 | if (!CanEdit()) | ||
676 | return; | ||
677 | |||
601 | m_sculptType = value; | 678 | m_sculptType = value; |
602 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); | 679 | SetPrimitiveSculpted(SculptMap, (byte) SculptType); |
603 | } | 680 | } |
@@ -654,6 +731,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
654 | 731 | ||
655 | public void Play(UUID asset, double volume) | 732 | public void Play(UUID asset, double volume) |
656 | { | 733 | { |
734 | if (!CanEdit()) | ||
735 | return; | ||
736 | |||
657 | GetSOP().SendSound(asset.ToString(), volume, true, 0); | 737 | GetSOP().SendSound(asset.ToString(), volume, true, 0); |
658 | } | 738 | } |
659 | 739 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs index 68f2f52..0cba6af 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SOPObjectMaterial.cs | |||
@@ -91,24 +91,45 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
91 | public bool Bright | 91 | public bool Bright |
92 | { | 92 | { |
93 | get { return GetTexface().Fullbright; } | 93 | get { return GetTexface().Fullbright; } |
94 | set { throw new System.NotImplementedException(); } | 94 | set |
95 | { | ||
96 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
97 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
98 | texface.Fullbright = value; | ||
99 | tex.FaceTextures[m_face] = texface; | ||
100 | m_parent.UpdateTexture(tex); | ||
101 | } | ||
95 | } | 102 | } |
96 | 103 | ||
97 | public double Bloom | 104 | public double Bloom |
98 | { | 105 | { |
99 | get { return GetTexface().Glow; } | 106 | get { return GetTexface().Glow; } |
100 | set { throw new System.NotImplementedException(); } | 107 | set |
108 | { | ||
109 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
110 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
111 | texface.Glow = (float) value; | ||
112 | tex.FaceTextures[m_face] = texface; | ||
113 | m_parent.UpdateTexture(tex); | ||
114 | } | ||
101 | } | 115 | } |
102 | 116 | ||
103 | public bool Shiny | 117 | public bool Shiny |
104 | { | 118 | { |
105 | get { return GetTexface().Shiny != Shininess.None; } | 119 | get { return GetTexface().Shiny != Shininess.None; } |
106 | set { throw new System.NotImplementedException(); } | 120 | set |
121 | { | ||
122 | Primitive.TextureEntry tex = m_parent.Shape.Textures; | ||
123 | Primitive.TextureEntryFace texface = tex.CreateFace((uint)m_face); | ||
124 | texface.Shiny = value ? Shininess.High : Shininess.None; | ||
125 | tex.FaceTextures[m_face] = texface; | ||
126 | m_parent.UpdateTexture(tex); | ||
127 | } | ||
107 | } | 128 | } |
108 | 129 | ||
109 | public bool BumpMap | 130 | public bool BumpMap |
110 | { | 131 | { |
111 | get { throw new System.NotImplementedException(); } | 132 | get { return GetTexface().Bump == Bumpiness.None; } |
112 | set { throw new System.NotImplementedException(); } | 133 | set { throw new System.NotImplementedException(); } |
113 | } | 134 | } |
114 | } | 135 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs index ce2d339..4427426 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatar.cs | |||
@@ -25,28 +25,26 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using System.Collections; | 28 | using System.Collections; |
31 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
32 | 30 | using System.Security; | |
33 | using OpenMetaverse; | 31 | using OpenMetaverse; |
34 | using OpenSim.Region.Framework.Scenes; | 32 | using OpenSim.Region.Framework.Scenes; |
35 | using OpenSim.Region.Framework.Interfaces; | 33 | using OpenSim.Region.Framework.Interfaces; |
36 | 34 | ||
37 | using log4net; | ||
38 | |||
39 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 35 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule |
40 | { | 36 | { |
41 | class SPAvatar : System.MarshalByRefObject, IAvatar | 37 | class SPAvatar : System.MarshalByRefObject, IAvatar |
42 | { | 38 | { |
43 | private readonly Scene m_rootScene; | 39 | private readonly Scene m_rootScene; |
44 | private readonly UUID m_ID; | 40 | private readonly UUID m_ID; |
41 | private readonly ISecurityCredential m_security; | ||
45 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 42 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
46 | 43 | ||
47 | public SPAvatar(Scene scene, UUID ID) | 44 | public SPAvatar(Scene scene, UUID ID, ISecurityCredential security) |
48 | { | 45 | { |
49 | m_rootScene = scene; | 46 | m_rootScene = scene; |
47 | m_security = security; | ||
50 | m_ID = ID; | 48 | m_ID = ID; |
51 | } | 49 | } |
52 | 50 | ||
@@ -58,7 +56,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
58 | public string Name | 56 | public string Name |
59 | { | 57 | { |
60 | get { return GetSP().Name; } | 58 | get { return GetSP().Name; } |
61 | set { throw new InvalidOperationException("Avatar Names are a read-only property."); } | 59 | set { throw new SecurityException("Avatar Names are a read-only property."); } |
62 | } | 60 | } |
63 | 61 | ||
64 | public UUID GlobalID | 62 | public UUID GlobalID |
@@ -84,7 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
84 | foreach (DictionaryEntry element in internalAttachments) | 82 | foreach (DictionaryEntry element in internalAttachments) |
85 | { | 83 | { |
86 | Hashtable attachInfo = (Hashtable)element.Value; | 84 | Hashtable attachInfo = (Hashtable)element.Value; |
87 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int)element.Key, new UUID((string)attachInfo["item"]), new UUID((string)attachInfo["asset"]))); | 85 | attachments.Add(new SPAvatarAttachment(m_rootScene, this, (int) element.Key, |
86 | new UUID((string) attachInfo["item"]), | ||
87 | new UUID((string) attachInfo["asset"]), m_security)); | ||
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs index 9b684fe..570459a 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SPAvatarAttachment.cs | |||
@@ -39,10 +39,13 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | private readonly int m_location; | 39 | private readonly int m_location; |
40 | //private readonly UUID m_itemId; | 40 | //private readonly UUID m_itemId; |
41 | private readonly UUID m_assetId; | 41 | private readonly UUID m_assetId; |
42 | |||
43 | private readonly ISecurityCredential m_security; | ||
42 | 44 | ||
43 | public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId) | 45 | public SPAvatarAttachment(Scene rootScene, IAvatar self, int location, UUID itemId, UUID assetId, ISecurityCredential security) |
44 | { | 46 | { |
45 | m_rootScene = rootScene; | 47 | m_rootScene = rootScene; |
48 | m_security = security; | ||
46 | //m_parent = self; | 49 | //m_parent = self; |
47 | m_location = location; | 50 | m_location = location; |
48 | //m_itemId = itemId; | 51 | //m_itemId = itemId; |
@@ -55,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
55 | { | 58 | { |
56 | get | 59 | get |
57 | { | 60 | { |
58 | return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId); | 61 | return new SOPObject(m_rootScene, m_rootScene.GetSceneObjectPart(m_assetId).LocalId, m_security); |
59 | } | 62 | } |
60 | } | 63 | } |
61 | } | 64 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs new file mode 100644 index 0000000..bc7f6cb --- /dev/null +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/SecurityCredential.cs | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Collections.Generic; | ||
30 | using System.Text; | ||
31 | using OpenMetaverse; | ||
32 | using OpenSim.Region.Framework.Scenes; | ||
33 | |||
34 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | ||
35 | { | ||
36 | class SecurityCredential : ISecurityCredential | ||
37 | { | ||
38 | private readonly ISocialEntity m_owner; | ||
39 | private readonly Scene m_scene; | ||
40 | |||
41 | public SecurityCredential(ISocialEntity m_owner, Scene m_scene) | ||
42 | { | ||
43 | this.m_owner = m_owner; | ||
44 | this.m_scene = m_scene; | ||
45 | } | ||
46 | |||
47 | public ISocialEntity owner | ||
48 | { | ||
49 | get { return m_owner; } | ||
50 | } | ||
51 | |||
52 | public bool CanEditObject(IObject target) | ||
53 | { | ||
54 | return m_scene.Permissions.CanEditObject(target.GlobalID, m_owner.GlobalID); | ||
55 | } | ||
56 | |||
57 | public bool CanEditTerrain(int x, int y) | ||
58 | { | ||
59 | return m_scene.Permissions.CanTerraformLand(m_owner.GlobalID, new Vector3(x, y, 0)); | ||
60 | } | ||
61 | } | ||
62 | } | ||
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs index 1ec4a33..da5ea0d 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/World.cs | |||
@@ -37,15 +37,17 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
37 | public class World : System.MarshalByRefObject, IWorld, IWorldAudio | 37 | public class World : System.MarshalByRefObject, IWorld, IWorldAudio |
38 | { | 38 | { |
39 | private readonly Scene m_internalScene; | 39 | private readonly Scene m_internalScene; |
40 | private readonly ISecurityCredential m_security; | ||
40 | private readonly Heightmap m_heights; | 41 | private readonly Heightmap m_heights; |
41 | 42 | ||
42 | private readonly ObjectAccessor m_objs; | 43 | private readonly ObjectAccessor m_objs; |
43 | 44 | ||
44 | public World(Scene internalScene) | 45 | public World(Scene internalScene, ISecurityCredential securityCredential) |
45 | { | 46 | { |
47 | m_security = securityCredential; | ||
46 | m_internalScene = internalScene; | 48 | m_internalScene = internalScene; |
47 | m_heights = new Heightmap(m_internalScene); | 49 | m_heights = new Heightmap(m_internalScene); |
48 | m_objs = new ObjectAccessor(m_internalScene); | 50 | m_objs = new ObjectAccessor(m_internalScene, securityCredential); |
49 | } | 51 | } |
50 | 52 | ||
51 | #region Events | 53 | #region Events |
@@ -84,7 +86,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
84 | if (_OnNewUser != null) | 86 | if (_OnNewUser != null) |
85 | { | 87 | { |
86 | NewUserEventArgs e = new NewUserEventArgs(); | 88 | NewUserEventArgs e = new NewUserEventArgs(); |
87 | e.Avatar = new SPAvatar(m_internalScene, presence.UUID); | 89 | e.Avatar = new SPAvatar(m_internalScene, presence.UUID, m_security); |
88 | _OnNewUser(this, e); | 90 | _OnNewUser(this, e); |
89 | } | 91 | } |
90 | } | 92 | } |
@@ -144,7 +146,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
144 | if (chat.Sender == null && chat.SenderObject != null) | 146 | if (chat.Sender == null && chat.SenderObject != null) |
145 | { | 147 | { |
146 | ChatEventArgs e = new ChatEventArgs(); | 148 | ChatEventArgs e = new ChatEventArgs(); |
147 | e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId); | 149 | e.Sender = new SOPObject(m_internalScene, ((SceneObjectPart) chat.SenderObject).LocalId, m_security); |
148 | e.Text = chat.Message; | 150 | e.Text = chat.Message; |
149 | 151 | ||
150 | _OnChat(this, e); | 152 | _OnChat(this, e); |
@@ -154,7 +156,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
154 | if (chat.Sender != null && chat.SenderObject == null) | 156 | if (chat.Sender != null && chat.SenderObject == null) |
155 | { | 157 | { |
156 | ChatEventArgs e = new ChatEventArgs(); | 158 | ChatEventArgs e = new ChatEventArgs(); |
157 | e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID); | 159 | e.Sender = new SPAvatar(m_internalScene, chat.SenderUUID, m_security); |
158 | e.Text = chat.Message; | 160 | e.Text = chat.Message; |
159 | 161 | ||
160 | _OnChat(this, e); | 162 | _OnChat(this, e); |
@@ -207,7 +209,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
207 | for (int i = 0; i < ents.Count; i++) | 209 | for (int i = 0; i < ents.Count; i++) |
208 | { | 210 | { |
209 | EntityBase ent = ents[i]; | 211 | EntityBase ent = ents[i]; |
210 | rets[i] = new SPAvatar(m_internalScene, ent.UUID); | 212 | rets[i] = new SPAvatar(m_internalScene, ent.UUID, m_security); |
211 | } | 213 | } |
212 | 214 | ||
213 | return rets; | 215 | return rets; |
diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index 4a8ba8c..f0bdf3b 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs | |||
@@ -213,6 +213,7 @@ namespace OpenSim.Region.OptionalModules.World.NPC | |||
213 | public event UpdateShape OnUpdatePrimShape; | 213 | public event UpdateShape OnUpdatePrimShape; |
214 | public event ObjectExtraParams OnUpdateExtraParams; | 214 | public event ObjectExtraParams OnUpdateExtraParams; |
215 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; | 215 | public event RequestObjectPropertiesFamily OnRequestObjectPropertiesFamily; |
216 | public event ObjectRequest OnObjectRequest; | ||
216 | public event ObjectSelect OnObjectSelect; | 217 | public event ObjectSelect OnObjectSelect; |
217 | public event GenericCall7 OnObjectDescription; | 218 | public event GenericCall7 OnObjectDescription; |
218 | public event GenericCall7 OnObjectName; | 219 | public event GenericCall7 OnObjectName; |
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 3d25acd..f97b49b 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | |||
@@ -350,18 +350,13 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
350 | #endif | 350 | #endif |
351 | } | 351 | } |
352 | 352 | ||
353 | // zero out a heightmap array float array (single dimention [flattened])) | 353 | // zero out a heightmap array float array (single dimension [flattened])) |
354 | if ((int)WorldExtents.X == 256 && (int)m_worldOffset.Y == 256) | 354 | if ((int)WorldExtents.X == 256 && (int)m_worldOffset.Y == 256) |
355 | _heightmap = new float[514*514]; | 355 | _heightmap = new float[514*514]; |
356 | else | 356 | else |
357 | _heightmap = new float[(((int)WorldExtents.Y + 2) * ((int)WorldExtents.X + 2))]; | 357 | _heightmap = new float[(((int)WorldExtents.Y + 2) * ((int)WorldExtents.X + 2))]; |
358 | _watermap = new float[258 * 258]; | 358 | _watermap = new float[258 * 258]; |
359 | 359 | ||
360 | |||
361 | |||
362 | |||
363 | |||
364 | |||
365 | // Zero out the prim spaces array (we split our space into smaller spaces so | 360 | // Zero out the prim spaces array (we split our space into smaller spaces so |
366 | // we can hit test less. | 361 | // we can hit test less. |
367 | } | 362 | } |
@@ -2206,7 +2201,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2206 | } | 2201 | } |
2207 | 2202 | ||
2208 | /// <summary> | 2203 | /// <summary> |
2209 | /// Called when a static prim moves. Allocates a space for the prim based on it's position | 2204 | /// Called when a static prim moves. Allocates a space for the prim based on its position |
2210 | /// </summary> | 2205 | /// </summary> |
2211 | /// <param name="geom">the pointer to the geom that moved</param> | 2206 | /// <param name="geom">the pointer to the geom that moved</param> |
2212 | /// <param name="pos">the position that the geom moved to</param> | 2207 | /// <param name="pos">the position that the geom moved to</param> |
@@ -3025,7 +3020,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3025 | float[] returnarr = new float[262144]; | 3020 | float[] returnarr = new float[262144]; |
3026 | float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; | 3021 | float[,] resultarr = new float[(int)WorldExtents.X, (int)WorldExtents.Y]; |
3027 | 3022 | ||
3028 | // Filling out the array into it's multi-dimentional components | 3023 | // Filling out the array into its multi-dimensional components |
3029 | for (int y = 0; y < WorldExtents.Y; y++) | 3024 | for (int y = 0; y < WorldExtents.Y; y++) |
3030 | { | 3025 | { |
3031 | for (int x = 0; x < WorldExtents.X; x++) | 3026 | for (int x = 0; x < WorldExtents.X; x++) |
@@ -3138,7 +3133,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
3138 | float[] returnarr = new float[262144]; | 3133 | float[] returnarr = new float[262144]; |
3139 | float[,] resultarr = new float[(int)WorldExtents.X,(int)WorldExtents.Y]; | 3134 | float[,] resultarr = new float[(int)WorldExtents.X,(int)WorldExtents.Y]; |
3140 | 3135 | ||
3141 | // Filling out the array into it's multi-dimentional components | 3136 | // Filling out the array into its multi-dimensional components |
3142 | for (int y = 0; y < WorldExtents.Y; y++) | 3137 | for (int y = 0; y < WorldExtents.Y; y++) |
3143 | { | 3138 | { |
3144 | for (int x = 0; x < WorldExtents.X; x++) | 3139 | for (int x = 0; x < WorldExtents.X; x++) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 691732a..2dbbf70 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2801,7 +2801,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2801 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) | 2801 | if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) |
2802 | { | 2802 | { |
2803 | SceneObjectGroup grp = m_host.ParentGroup; | 2803 | SceneObjectGroup grp = m_host.ParentGroup; |
2804 | UUID itemID = grp.GetFromAssetID(); | 2804 | UUID itemID = grp.GetFromItemID(); |
2805 | 2805 | ||
2806 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); | 2806 | ScenePresence presence = World.GetScenePresence(m_host.OwnerID); |
2807 | 2807 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs index f290dd7..358ce22 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs | |||
@@ -35,6 +35,7 @@ using Nini.Config; | |||
35 | using OpenSim.Region.ScriptEngine.Shared.Api; | 35 | using OpenSim.Region.ScriptEngine.Shared.Api; |
36 | using OpenMetaverse; | 36 | using OpenMetaverse; |
37 | using System; | 37 | using System; |
38 | using OpenSim.Tests.Common.Mock; | ||
38 | 39 | ||
39 | namespace OpenSim.Region.ScriptEngine.Shared.Tests | 40 | namespace OpenSim.Region.ScriptEngine.Shared.Tests |
40 | { | 41 | { |
@@ -52,7 +53,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests | |||
52 | public void SetUp() | 53 | public void SetUp() |
53 | { | 54 | { |
54 | 55 | ||
55 | IniConfigSource initConfigSource = new IniConfigSource(); | 56 | IConfigSource initConfigSource = new IniConfigSource(); |
56 | IConfig config = initConfigSource.AddConfig("XEngine"); | 57 | IConfig config = initConfigSource.AddConfig("XEngine"); |
57 | config.Set("Enabled", "true"); | 58 | config.Set("Enabled", "true"); |
58 | 59 | ||
diff --git a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs index 7142c8c..8195f33 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/EventManager.cs | |||
@@ -70,6 +70,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
70 | } | 70 | } |
71 | } | 71 | } |
72 | 72 | ||
73 | /// <summary> | ||
74 | /// When an object gets paid by an avatar and generates the paid event, | ||
75 | /// this will pipe it to the script engine | ||
76 | /// </summary> | ||
77 | /// <param name="objectID">Object ID that got paid</param> | ||
78 | /// <param name="agentID">Agent Id that did the paying</param> | ||
79 | /// <param name="amount">Amount paid</param> | ||
73 | private void HandleObjectPaid(UUID objectID, UUID agentID, | 80 | private void HandleObjectPaid(UUID objectID, UUID agentID, |
74 | int amount) | 81 | int amount) |
75 | { | 82 | { |
@@ -93,6 +100,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
93 | } | 100 | } |
94 | } | 101 | } |
95 | 102 | ||
103 | /// <summary> | ||
104 | /// Handles piping the proper stuff to The script engine for touching | ||
105 | /// Including DetectedParams | ||
106 | /// </summary> | ||
107 | /// <param name="localID"></param> | ||
108 | /// <param name="originalID"></param> | ||
109 | /// <param name="offsetPos"></param> | ||
110 | /// <param name="remoteClient"></param> | ||
111 | /// <param name="surfaceArgs"></param> | ||
96 | public void touch_start(uint localID, uint originalID, Vector3 offsetPos, | 112 | public void touch_start(uint localID, uint originalID, Vector3 offsetPos, |
97 | IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) | 113 | IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) |
98 | { | 114 | { |