diff options
Diffstat (limited to '')
17 files changed, 1096 insertions, 83 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index d7120a5..1f3582c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -6151,7 +6151,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
6151 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; | 6151 | DelinkObjects handlerDelinkObjects = OnDelinkObjects; |
6152 | if (handlerDelinkObjects != null) | 6152 | if (handlerDelinkObjects != null) |
6153 | { | 6153 | { |
6154 | handlerDelinkObjects(prims); | 6154 | handlerDelinkObjects(prims, this); |
6155 | } | 6155 | } |
6156 | 6156 | ||
6157 | return true; | 6157 | return true; |
@@ -11820,4 +11820,4 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
11820 | OutPacket(dialog, ThrottleOutPacketType.Task); | 11820 | OutPacket(dialog, ThrottleOutPacketType.Task); |
11821 | } | 11821 | } |
11822 | } | 11822 | } |
11823 | } \ No newline at end of file | 11823 | } |
diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 312db38..23d5b3c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs | |||
@@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends | |||
149 | 149 | ||
150 | if (m_FriendsService == null) | 150 | if (m_FriendsService == null) |
151 | { | 151 | { |
152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or filed to load, cannot continue"); | 152 | m_log.Error("[FRIENDS]: No Connector defined in section Friends, or failed to load, cannot continue"); |
153 | throw new Exception("Connector load error"); | 153 | throw new Exception("Connector load error"); |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index aaa318c..0a5ff3f 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | |||
@@ -45,6 +45,7 @@ | |||
45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> | 45 | <RegionModule id="HGAssetBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset.HGAssetBroker" /> |
46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> | 46 | <RegionModule id="LocalInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.LocalInventoryServicesConnector" /> |
47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> | 47 | <RegionModule id="RemoteInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteInventoryServicesConnector" /> |
48 | <RegionModule id="RemoteXInventoryServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.RemoteXInventoryServicesConnector" /> | ||
48 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> | 49 | <RegionModule id="HGInventoryBroker" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory.HGInventoryBroker" /> |
49 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> | 50 | <RegionModule id="LocalNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.LocalNeighbourServicesConnector" /> |
50 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> | 51 | <RegionModule id="RemoteNeighbourServicesConnector" type="OpenSim.Region.CoreModules.ServiceConnectorsOut.Neighbour.RemoteNeighbourServicesConnector" /> |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs new file mode 100644 index 0000000..3509161 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/HGInventoryBroker2.cs | |||
@@ -0,0 +1,618 @@ | |||
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 log4net; | ||
29 | using Nini.Config; | ||
30 | using System; | ||
31 | using System.Collections.Generic; | ||
32 | using System.Reflection; | ||
33 | using OpenSim.Framework; | ||
34 | |||
35 | using OpenSim.Server.Base; | ||
36 | using OpenSim.Region.Framework.Interfaces; | ||
37 | using OpenSim.Region.Framework.Scenes; | ||
38 | using OpenSim.Services.Interfaces; | ||
39 | using OpenSim.Services.Connectors; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class HGInventoryBroker2 : INonSharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger( | ||
48 | MethodBase.GetCurrentMethod().DeclaringType); | ||
49 | |||
50 | private static bool m_Initialized = false; | ||
51 | private static bool m_Enabled = false; | ||
52 | |||
53 | private static IInventoryService m_LocalGridInventoryService; | ||
54 | private static ISessionAuthInventoryService m_HGService; // obsolete | ||
55 | private Dictionary<string, IInventoryService> m_connectors = new Dictionary<string, IInventoryService>(); | ||
56 | |||
57 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
58 | protected Dictionary<UUID, string> m_InventoryURLs; | ||
59 | |||
60 | private Scene m_Scene; | ||
61 | private List<Scene> m_Scenes = new List<Scene>(); | ||
62 | |||
63 | private IUserAccountService m_UserAccountService; | ||
64 | |||
65 | public Type ReplaceableInterface | ||
66 | { | ||
67 | get { return null; } | ||
68 | } | ||
69 | |||
70 | public string Name | ||
71 | { | ||
72 | get { return "HGInventoryBroker2"; } | ||
73 | } | ||
74 | |||
75 | public void Initialise(IConfigSource source) | ||
76 | { | ||
77 | if (!m_Initialized) | ||
78 | { | ||
79 | IConfig moduleConfig = source.Configs["Modules"]; | ||
80 | if (moduleConfig != null) | ||
81 | { | ||
82 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
83 | if (name == Name) | ||
84 | { | ||
85 | IConfig inventoryConfig = source.Configs["InventoryService"]; | ||
86 | if (inventoryConfig == null) | ||
87 | { | ||
88 | m_log.Error("[HG INVENTORY CONNECTOR]: InventoryService missing from OpenSim.ini"); | ||
89 | return; | ||
90 | } | ||
91 | |||
92 | string localDll = inventoryConfig.GetString("LocalGridInventoryService", | ||
93 | String.Empty); | ||
94 | string HGDll = inventoryConfig.GetString("HypergridInventoryService", | ||
95 | String.Empty); | ||
96 | |||
97 | if (localDll == String.Empty) | ||
98 | { | ||
99 | m_log.Error("[HG INVENTORY CONNECTOR]: No LocalGridInventoryService named in section InventoryService"); | ||
100 | //return; | ||
101 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
102 | } | ||
103 | |||
104 | if (HGDll == String.Empty) | ||
105 | { | ||
106 | m_log.Error("[HG INVENTORY CONNECTOR]: No HypergridInventoryService named in section InventoryService"); | ||
107 | //return; | ||
108 | throw new Exception("Unable to proceed. Please make sure your ini files in config-include are updated according to .example's"); | ||
109 | } | ||
110 | |||
111 | Object[] args = new Object[] { source }; | ||
112 | m_LocalGridInventoryService = | ||
113 | ServerUtils.LoadPlugin<IInventoryService>(localDll, | ||
114 | args); | ||
115 | |||
116 | m_HGService = | ||
117 | ServerUtils.LoadPlugin<ISessionAuthInventoryService>(HGDll, | ||
118 | args); | ||
119 | |||
120 | if (m_LocalGridInventoryService == null) | ||
121 | { | ||
122 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load local inventory service"); | ||
123 | return; | ||
124 | } | ||
125 | if (m_HGService == null) | ||
126 | { | ||
127 | m_log.Error("[HG INVENTORY CONNECTOR]: Can't load hypergrid inventory service"); | ||
128 | return; | ||
129 | } | ||
130 | |||
131 | m_Enabled = true; | ||
132 | m_log.Info("[HG INVENTORY CONNECTOR]: HG inventory broker enabled"); | ||
133 | } | ||
134 | } | ||
135 | m_Initialized = true; | ||
136 | } | ||
137 | } | ||
138 | |||
139 | public void PostInitialise() | ||
140 | { | ||
141 | } | ||
142 | |||
143 | public void Close() | ||
144 | { | ||
145 | } | ||
146 | |||
147 | public void AddRegion(Scene scene) | ||
148 | { | ||
149 | if (!m_Enabled) | ||
150 | return; | ||
151 | |||
152 | m_Scene = scene; | ||
153 | m_Scenes.Add(scene); | ||
154 | m_UserAccountService = m_Scene.UserAccountService; | ||
155 | |||
156 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
157 | |||
158 | scene.EventManager.OnMakeRootAgent += OnMakeRootAgent; | ||
159 | scene.EventManager.OnClientClosed += OnClientClosed; | ||
160 | |||
161 | } | ||
162 | |||
163 | public void RemoveRegion(Scene scene) | ||
164 | { | ||
165 | if (!m_Enabled) | ||
166 | return; | ||
167 | |||
168 | m_Scenes.Remove(scene); | ||
169 | } | ||
170 | |||
171 | public void RegionLoaded(Scene scene) | ||
172 | { | ||
173 | if (!m_Enabled) | ||
174 | return; | ||
175 | |||
176 | m_log.InfoFormat("[HG INVENTORY CONNECTOR]: Enabled HG inventory for region {0}", scene.RegionInfo.RegionName); | ||
177 | |||
178 | } | ||
179 | |||
180 | #region Cache | ||
181 | |||
182 | void OnMakeRootAgent(ScenePresence presence) | ||
183 | { | ||
184 | if (!m_InventoryURLs.ContainsKey(presence.UUID)) | ||
185 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
186 | } | ||
187 | |||
188 | void OnClientClosed(UUID clientID, Scene scene) | ||
189 | { | ||
190 | if (m_InventoryURLs.ContainsKey(clientID)) // if it's in cache | ||
191 | { | ||
192 | ScenePresence sp = null; | ||
193 | foreach (Scene s in m_Scenes) | ||
194 | { | ||
195 | s.TryGetScenePresence(clientID, out sp); | ||
196 | if ((sp != null) && !sp.IsChildAgent && (s != scene)) | ||
197 | { | ||
198 | m_log.DebugFormat("[INVENTORY CACHE]: OnClientClosed in {0}, but user {1} still in sim. Keeping inventoryURL in cache", | ||
199 | scene.RegionInfo.RegionName, clientID); | ||
200 | return; | ||
201 | } | ||
202 | } | ||
203 | |||
204 | m_log.DebugFormat( | ||
205 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping inventory URL", | ||
206 | scene.RegionInfo.RegionName, clientID); | ||
207 | DropInventoryServiceURL(clientID); | ||
208 | } | ||
209 | } | ||
210 | |||
211 | /// <summary> | ||
212 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
213 | /// and sticks it in the cache | ||
214 | /// </summary> | ||
215 | /// <param name="userID"></param> | ||
216 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
217 | { | ||
218 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
219 | { | ||
220 | // The user does not have a local account; let's cache its service URL | ||
221 | string inventoryURL = string.Empty; | ||
222 | ScenePresence sp = null; | ||
223 | scene.TryGetScenePresence(userID, out sp); | ||
224 | if (sp != null) | ||
225 | { | ||
226 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
227 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
228 | { | ||
229 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
230 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
231 | { | ||
232 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
233 | m_InventoryURLs.Add(userID, inventoryURL); | ||
234 | } | ||
235 | } | ||
236 | } | ||
237 | } | ||
238 | } | ||
239 | |||
240 | private void DropInventoryServiceURL(UUID userID) | ||
241 | { | ||
242 | lock (m_InventoryURLs) | ||
243 | if (m_InventoryURLs.ContainsKey(userID)) | ||
244 | m_InventoryURLs.Remove(userID); | ||
245 | } | ||
246 | |||
247 | public string GetInventoryServiceURL(UUID userID) | ||
248 | { | ||
249 | if (m_InventoryURLs.ContainsKey(userID)) | ||
250 | return m_InventoryURLs[userID]; | ||
251 | |||
252 | return null; | ||
253 | } | ||
254 | #endregion | ||
255 | |||
256 | #region IInventoryService | ||
257 | |||
258 | public bool CreateUserInventory(UUID userID) | ||
259 | { | ||
260 | return m_LocalGridInventoryService.CreateUserInventory(userID); | ||
261 | } | ||
262 | |||
263 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
264 | { | ||
265 | return m_LocalGridInventoryService.GetInventorySkeleton(userId); | ||
266 | } | ||
267 | |||
268 | public InventoryCollection GetUserInventory(UUID userID) | ||
269 | { | ||
270 | return null; | ||
271 | } | ||
272 | |||
273 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
274 | { | ||
275 | } | ||
276 | |||
277 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
278 | { | ||
279 | m_log.DebugFormat("[HGInventory]: GetRootFolder for {0}", userID); | ||
280 | |||
281 | string invURL = GetInventoryServiceURL(userID); | ||
282 | |||
283 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
284 | return m_LocalGridInventoryService.GetRootFolder(userID); | ||
285 | |||
286 | IInventoryService connector = GetConnector(invURL); | ||
287 | |||
288 | return connector.GetRootFolder(userID); | ||
289 | } | ||
290 | |||
291 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
292 | { | ||
293 | m_log.DebugFormat("[HGInventory]: GetFolderForType {0} type {1}", userID, type); | ||
294 | |||
295 | string invURL = GetInventoryServiceURL(userID); | ||
296 | |||
297 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
298 | return m_LocalGridInventoryService.GetFolderForType(userID, type); | ||
299 | |||
300 | IInventoryService connector = GetConnector(invURL); | ||
301 | |||
302 | return connector.GetFolderForType(userID, type); | ||
303 | } | ||
304 | |||
305 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
306 | { | ||
307 | m_log.Debug("[HGInventory]: GetFolderContent " + folderID); | ||
308 | |||
309 | string invURL = GetInventoryServiceURL(userID); | ||
310 | |||
311 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
312 | return m_LocalGridInventoryService.GetFolderContent(userID, folderID); | ||
313 | |||
314 | IInventoryService connector = GetConnector(invURL); | ||
315 | |||
316 | return connector.GetFolderContent(userID, folderID); | ||
317 | |||
318 | } | ||
319 | |||
320 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
321 | { | ||
322 | m_log.Debug("[HGInventory]: GetFolderItems " + folderID); | ||
323 | |||
324 | string invURL = GetInventoryServiceURL(userID); | ||
325 | |||
326 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
327 | return m_LocalGridInventoryService.GetFolderItems(userID, folderID); | ||
328 | |||
329 | IInventoryService connector = GetConnector(invURL); | ||
330 | |||
331 | return connector.GetFolderItems(userID, folderID); | ||
332 | |||
333 | } | ||
334 | |||
335 | public bool AddFolder(InventoryFolderBase folder) | ||
336 | { | ||
337 | if (folder == null) | ||
338 | return false; | ||
339 | |||
340 | m_log.Debug("[HGInventory]: AddFolder " + folder.ID); | ||
341 | |||
342 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
343 | |||
344 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
345 | return m_LocalGridInventoryService.AddFolder(folder); | ||
346 | |||
347 | IInventoryService connector = GetConnector(invURL); | ||
348 | |||
349 | return connector.AddFolder(folder); | ||
350 | } | ||
351 | |||
352 | public bool UpdateFolder(InventoryFolderBase folder) | ||
353 | { | ||
354 | if (folder == null) | ||
355 | return false; | ||
356 | |||
357 | m_log.Debug("[HGInventory]: UpdateFolder " + folder.ID); | ||
358 | |||
359 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
360 | |||
361 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
362 | return m_LocalGridInventoryService.UpdateFolder(folder); | ||
363 | |||
364 | IInventoryService connector = GetConnector(invURL); | ||
365 | |||
366 | return connector.UpdateFolder(folder); | ||
367 | } | ||
368 | |||
369 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
370 | { | ||
371 | if (folderIDs == null) | ||
372 | return false; | ||
373 | if (folderIDs.Count == 0) | ||
374 | return false; | ||
375 | |||
376 | m_log.Debug("[HGInventory]: DeleteFolders for " + ownerID); | ||
377 | |||
378 | string invURL = GetInventoryServiceURL(ownerID); | ||
379 | |||
380 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
381 | return m_LocalGridInventoryService.DeleteFolders(ownerID, folderIDs); | ||
382 | |||
383 | IInventoryService connector = GetConnector(invURL); | ||
384 | |||
385 | return connector.DeleteFolders(ownerID, folderIDs); | ||
386 | } | ||
387 | |||
388 | public bool MoveFolder(InventoryFolderBase folder) | ||
389 | { | ||
390 | if (folder == null) | ||
391 | return false; | ||
392 | |||
393 | m_log.Debug("[HGInventory]: MoveFolder for " + folder.Owner); | ||
394 | |||
395 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
396 | |||
397 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
398 | return m_LocalGridInventoryService.MoveFolder(folder); | ||
399 | |||
400 | IInventoryService connector = GetConnector(invURL); | ||
401 | |||
402 | return connector.MoveFolder(folder); | ||
403 | } | ||
404 | |||
405 | public bool PurgeFolder(InventoryFolderBase folder) | ||
406 | { | ||
407 | if (folder == null) | ||
408 | return false; | ||
409 | |||
410 | m_log.Debug("[HGInventory]: PurgeFolder for " + folder.Owner); | ||
411 | |||
412 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
413 | |||
414 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
415 | return m_LocalGridInventoryService.PurgeFolder(folder); | ||
416 | |||
417 | IInventoryService connector = GetConnector(invURL); | ||
418 | |||
419 | return connector.PurgeFolder(folder); | ||
420 | } | ||
421 | |||
422 | public bool AddItem(InventoryItemBase item) | ||
423 | { | ||
424 | if (item == null) | ||
425 | return false; | ||
426 | |||
427 | m_log.Debug("[HGInventory]: AddItem " + item.ID); | ||
428 | |||
429 | string invURL = GetInventoryServiceURL(item.Owner); | ||
430 | |||
431 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
432 | return m_LocalGridInventoryService.AddItem(item); | ||
433 | |||
434 | IInventoryService connector = GetConnector(invURL); | ||
435 | |||
436 | return connector.AddItem(item); | ||
437 | } | ||
438 | |||
439 | public bool UpdateItem(InventoryItemBase item) | ||
440 | { | ||
441 | if (item == null) | ||
442 | return false; | ||
443 | |||
444 | m_log.Debug("[HGInventory]: UpdateItem " + item.ID); | ||
445 | |||
446 | string invURL = GetInventoryServiceURL(item.Owner); | ||
447 | |||
448 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
449 | return m_LocalGridInventoryService.UpdateItem(item); | ||
450 | |||
451 | IInventoryService connector = GetConnector(invURL); | ||
452 | |||
453 | return connector.UpdateItem(item); | ||
454 | } | ||
455 | |||
456 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
457 | { | ||
458 | if (items == null) | ||
459 | return false; | ||
460 | if (items.Count == 0) | ||
461 | return true; | ||
462 | |||
463 | m_log.Debug("[HGInventory]: MoveItems for " + ownerID); | ||
464 | |||
465 | string invURL = GetInventoryServiceURL(ownerID); | ||
466 | |||
467 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
468 | return m_LocalGridInventoryService.MoveItems(ownerID, items); | ||
469 | |||
470 | IInventoryService connector = GetConnector(invURL); | ||
471 | |||
472 | return connector.MoveItems(ownerID, items); | ||
473 | } | ||
474 | |||
475 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
476 | { | ||
477 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: Delete {0} items for user {1}", itemIDs.Count, ownerID); | ||
478 | |||
479 | if (itemIDs == null) | ||
480 | return false; | ||
481 | if (itemIDs.Count == 0) | ||
482 | return true; | ||
483 | |||
484 | m_log.Debug("[HGInventory]: DeleteItems for " + ownerID); | ||
485 | |||
486 | string invURL = GetInventoryServiceURL(ownerID); | ||
487 | |||
488 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
489 | return m_LocalGridInventoryService.DeleteItems(ownerID, itemIDs); | ||
490 | |||
491 | IInventoryService connector = GetConnector(invURL); | ||
492 | |||
493 | return connector.DeleteItems(ownerID, itemIDs); | ||
494 | } | ||
495 | |||
496 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
497 | { | ||
498 | if (item == null) | ||
499 | return null; | ||
500 | m_log.Debug("[HGInventory]: GetItem " + item.ID); | ||
501 | |||
502 | string invURL = GetInventoryServiceURL(item.Owner); | ||
503 | |||
504 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
505 | return m_LocalGridInventoryService.GetItem(item); | ||
506 | |||
507 | IInventoryService connector = GetConnector(invURL); | ||
508 | |||
509 | return connector.GetItem(item); | ||
510 | } | ||
511 | |||
512 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
513 | { | ||
514 | if (folder == null) | ||
515 | return null; | ||
516 | |||
517 | m_log.Debug("[HGInventory]: GetFolder " + folder.ID); | ||
518 | |||
519 | string invURL = GetInventoryServiceURL(folder.Owner); | ||
520 | |||
521 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
522 | return m_LocalGridInventoryService.GetFolder(folder); | ||
523 | |||
524 | IInventoryService connector = GetConnector(invURL); | ||
525 | |||
526 | return connector.GetFolder(folder); | ||
527 | } | ||
528 | |||
529 | public bool HasInventoryForUser(UUID userID) | ||
530 | { | ||
531 | return false; | ||
532 | } | ||
533 | |||
534 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
535 | { | ||
536 | return new List<InventoryItemBase>(); | ||
537 | } | ||
538 | |||
539 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
540 | { | ||
541 | m_log.Debug("[HGInventory]: GetAssetPermissions " + assetID); | ||
542 | |||
543 | string invURL = GetInventoryServiceURL(userID); | ||
544 | |||
545 | if (invURL == null) // not there, forward to local inventory connector to resolve | ||
546 | return m_LocalGridInventoryService.GetAssetPermissions(userID, assetID); | ||
547 | |||
548 | IInventoryService connector = GetConnector(invURL); | ||
549 | |||
550 | return connector.GetAssetPermissions(userID, assetID); | ||
551 | } | ||
552 | |||
553 | #endregion | ||
554 | |||
555 | private IInventoryService GetConnector(string url) | ||
556 | { | ||
557 | IInventoryService connector = null; | ||
558 | lock (m_connectors) | ||
559 | { | ||
560 | if (m_connectors.ContainsKey(url)) | ||
561 | { | ||
562 | connector = m_connectors[url]; | ||
563 | } | ||
564 | else | ||
565 | { | ||
566 | // We're instantiating this class explicitly, but this won't | ||
567 | // work in general, because the remote grid may be running | ||
568 | // an inventory server that has a different protocol. | ||
569 | // Eventually we will want a piece of protocol asking | ||
570 | // the remote server about its kind. Definitely cool thing to do! | ||
571 | connector = new RemoteXInventoryServicesConnector(url); | ||
572 | m_connectors.Add(url, connector); | ||
573 | } | ||
574 | } | ||
575 | return connector; | ||
576 | } | ||
577 | |||
578 | |||
579 | private UUID GetSessionID(UUID userID) | ||
580 | { | ||
581 | ScenePresence sp = null; | ||
582 | if (m_Scene.TryGetScenePresence(userID, out sp)) | ||
583 | { | ||
584 | return sp.ControllingClient.SessionId; | ||
585 | } | ||
586 | |||
587 | m_log.DebugFormat("[HG INVENTORY CONNECTOR]: scene presence for {0} not found", userID); | ||
588 | return UUID.Zero; | ||
589 | } | ||
590 | |||
591 | private bool IsForeignUser(UUID userID, out string inventoryURL) | ||
592 | { | ||
593 | inventoryURL = string.Empty; | ||
594 | UserAccount account = null; | ||
595 | if (m_Scene.UserAccountService != null) | ||
596 | account = m_Scene.UserAccountService.GetUserAccount(m_Scene.RegionInfo.ScopeID, userID); | ||
597 | |||
598 | if (account == null) // foreign user | ||
599 | { | ||
600 | ScenePresence sp = null; | ||
601 | m_Scene.TryGetScenePresence(userID, out sp); | ||
602 | if (sp != null) | ||
603 | { | ||
604 | AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
605 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
606 | { | ||
607 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
608 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
609 | return true; | ||
610 | } | ||
611 | } | ||
612 | } | ||
613 | return false; | ||
614 | } | ||
615 | |||
616 | |||
617 | } | ||
618 | } | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs index 5e06580..9c6e1cd 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/InventoryCache.cs | |||
@@ -51,6 +51,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
51 | // The cache proper | 51 | // The cache proper |
52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; | 52 | protected Dictionary<UUID, Dictionary<AssetType, InventoryFolderBase>> m_InventoryCache; |
53 | 53 | ||
54 | // A cache of userIDs --> ServiceURLs, for HGBroker only | ||
55 | protected Dictionary<UUID, string> m_InventoryURLs; | ||
56 | |||
54 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) | 57 | public virtual void Init(IConfigSource source, BaseInventoryConnector connector) |
55 | { | 58 | { |
56 | m_Scenes = new List<Scene>(); | 59 | m_Scenes = new List<Scene>(); |
@@ -89,8 +92,11 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
89 | 92 | ||
90 | // If not, go get them and place them in the cache | 93 | // If not, go get them and place them in the cache |
91 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); | 94 | Dictionary<AssetType, InventoryFolderBase> folders = CacheSystemFolders(presence.UUID); |
95 | CacheInventoryServiceURL(presence.Scene, presence.UUID); | ||
96 | |||
92 | m_log.DebugFormat("[INVENTORY CACHE]: OnMakeRootAgent in {0}, fetched system folders for {1} {2}: count {3}", | 97 | 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); | 98 | presence.Scene.RegionInfo.RegionName, presence.Firstname, presence.Lastname, folders.Count); |
99 | |||
94 | } | 100 | } |
95 | 101 | ||
96 | void OnClientClosed(UUID clientID, Scene scene) | 102 | void OnClientClosed(UUID clientID, Scene scene) |
@@ -113,6 +119,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
113 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", | 119 | "[INVENTORY CACHE]: OnClientClosed in {0}, user {1} out of sim. Dropping system folders", |
114 | scene.RegionInfo.RegionName, clientID); | 120 | scene.RegionInfo.RegionName, clientID); |
115 | DropCachedSystemFolders(clientID); | 121 | DropCachedSystemFolders(clientID); |
122 | DropInventoryServiceURL(clientID); | ||
116 | } | 123 | } |
117 | } | 124 | } |
118 | 125 | ||
@@ -174,5 +181,49 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | |||
174 | 181 | ||
175 | return null; | 182 | return null; |
176 | } | 183 | } |
184 | |||
185 | /// <summary> | ||
186 | /// Gets the user's inventory URL from its serviceURLs, if the user is foreign, | ||
187 | /// and sticks it in the cache | ||
188 | /// </summary> | ||
189 | /// <param name="userID"></param> | ||
190 | private void CacheInventoryServiceURL(Scene scene, UUID userID) | ||
191 | { | ||
192 | if (scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, userID) == null) | ||
193 | { | ||
194 | // The user does not have a local account; let's cache its service URL | ||
195 | string inventoryURL = string.Empty; | ||
196 | ScenePresence sp = null; | ||
197 | scene.TryGetScenePresence(userID, out sp); | ||
198 | if (sp != null) | ||
199 | { | ||
200 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); | ||
201 | if (aCircuit.ServiceURLs.ContainsKey("InventoryServerURI")) | ||
202 | { | ||
203 | inventoryURL = aCircuit.ServiceURLs["InventoryServerURI"].ToString(); | ||
204 | if (inventoryURL != null && inventoryURL != string.Empty) | ||
205 | { | ||
206 | inventoryURL = inventoryURL.Trim(new char[] { '/' }); | ||
207 | m_InventoryURLs.Add(userID, inventoryURL); | ||
208 | } | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | } | ||
213 | |||
214 | private void DropInventoryServiceURL(UUID userID) | ||
215 | { | ||
216 | lock (m_InventoryURLs) | ||
217 | if (m_InventoryURLs.ContainsKey(userID)) | ||
218 | m_InventoryURLs.Remove(userID); | ||
219 | } | ||
220 | |||
221 | public string GetInventoryServiceURL(UUID userID) | ||
222 | { | ||
223 | if (m_InventoryURLs.ContainsKey(userID)) | ||
224 | return m_InventoryURLs[userID]; | ||
225 | |||
226 | return null; | ||
227 | } | ||
177 | } | 228 | } |
178 | } | 229 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs new file mode 100644 index 0000000..ac9e792 --- /dev/null +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Inventory/RemoteXInventoryServiceConnector.cs | |||
@@ -0,0 +1,305 @@ | |||
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 log4net; | ||
29 | using System; | ||
30 | using System.Collections.Generic; | ||
31 | using System.Reflection; | ||
32 | using Nini.Config; | ||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Statistics; | ||
35 | |||
36 | using OpenSim.Services.Connectors; | ||
37 | using OpenSim.Region.Framework.Interfaces; | ||
38 | using OpenSim.Region.Framework.Scenes; | ||
39 | using OpenSim.Services.Interfaces; | ||
40 | using OpenMetaverse; | ||
41 | |||
42 | namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Inventory | ||
43 | { | ||
44 | public class RemoteXInventoryServicesConnector : ISharedRegionModule, IInventoryService | ||
45 | { | ||
46 | private static readonly ILog m_log = | ||
47 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
48 | |||
49 | private bool m_Enabled = false; | ||
50 | private bool m_Initialized = false; | ||
51 | private Scene m_Scene; | ||
52 | private XInventoryServicesConnector m_RemoteConnector; | ||
53 | |||
54 | public Type ReplaceableInterface | ||
55 | { | ||
56 | get { return null; } | ||
57 | } | ||
58 | |||
59 | public string Name | ||
60 | { | ||
61 | get { return "RemoteXInventoryServicesConnector"; } | ||
62 | } | ||
63 | |||
64 | public RemoteXInventoryServicesConnector() | ||
65 | { | ||
66 | } | ||
67 | |||
68 | public RemoteXInventoryServicesConnector(string url) | ||
69 | { | ||
70 | m_RemoteConnector = new XInventoryServicesConnector(url); | ||
71 | } | ||
72 | |||
73 | public RemoteXInventoryServicesConnector(IConfigSource source) | ||
74 | { | ||
75 | Init(source); | ||
76 | } | ||
77 | |||
78 | protected void Init(IConfigSource source) | ||
79 | { | ||
80 | m_RemoteConnector = new XInventoryServicesConnector(source); | ||
81 | } | ||
82 | |||
83 | |||
84 | #region ISharedRegionModule | ||
85 | |||
86 | public void Initialise(IConfigSource source) | ||
87 | { | ||
88 | IConfig moduleConfig = source.Configs["Modules"]; | ||
89 | if (moduleConfig != null) | ||
90 | { | ||
91 | string name = moduleConfig.GetString("InventoryServices", ""); | ||
92 | if (name == Name) | ||
93 | { | ||
94 | Init(source); | ||
95 | m_Enabled = true; | ||
96 | |||
97 | m_log.Info("[XINVENTORY CONNECTOR]: Remote XInventory enabled"); | ||
98 | } | ||
99 | } | ||
100 | } | ||
101 | |||
102 | public void PostInitialise() | ||
103 | { | ||
104 | } | ||
105 | |||
106 | public void Close() | ||
107 | { | ||
108 | } | ||
109 | |||
110 | public void AddRegion(Scene scene) | ||
111 | { | ||
112 | m_Scene = scene; | ||
113 | //m_log.Debug("[XXXX] Adding scene " + m_Scene.RegionInfo.RegionName); | ||
114 | |||
115 | if (!m_Enabled) | ||
116 | return; | ||
117 | |||
118 | if (!m_Initialized) | ||
119 | { | ||
120 | m_Initialized = true; | ||
121 | } | ||
122 | |||
123 | scene.RegisterModuleInterface<IInventoryService>(this); | ||
124 | } | ||
125 | |||
126 | public void RemoveRegion(Scene scene) | ||
127 | { | ||
128 | if (!m_Enabled) | ||
129 | return; | ||
130 | |||
131 | } | ||
132 | |||
133 | public void RegionLoaded(Scene scene) | ||
134 | { | ||
135 | if (!m_Enabled) | ||
136 | return; | ||
137 | |||
138 | m_log.InfoFormat("[XINVENTORY CONNECTOR]: Enabled remote XInventory for region {0}", scene.RegionInfo.RegionName); | ||
139 | |||
140 | } | ||
141 | |||
142 | #endregion ISharedRegionModule | ||
143 | |||
144 | #region IInventoryService | ||
145 | |||
146 | public bool CreateUserInventory(UUID user) | ||
147 | { | ||
148 | return false; | ||
149 | } | ||
150 | |||
151 | public List<InventoryFolderBase> GetInventorySkeleton(UUID userId) | ||
152 | { | ||
153 | return new List<InventoryFolderBase>(); | ||
154 | } | ||
155 | |||
156 | public InventoryCollection GetUserInventory(UUID userID) | ||
157 | { | ||
158 | return null; | ||
159 | } | ||
160 | |||
161 | public void GetUserInventory(UUID userID, InventoryReceiptCallback callback) | ||
162 | { | ||
163 | } | ||
164 | |||
165 | public InventoryFolderBase GetRootFolder(UUID userID) | ||
166 | { | ||
167 | return m_RemoteConnector.GetRootFolder(userID); | ||
168 | } | ||
169 | |||
170 | public InventoryFolderBase GetFolderForType(UUID userID, AssetType type) | ||
171 | { | ||
172 | return m_RemoteConnector.GetFolderForType(userID, type); | ||
173 | } | ||
174 | |||
175 | public Dictionary<AssetType, InventoryFolderBase> GetSystemFolders(UUID userID) | ||
176 | { | ||
177 | return m_RemoteConnector.GetSystemFolders(userID); | ||
178 | } | ||
179 | |||
180 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | ||
181 | { | ||
182 | return m_RemoteConnector.GetFolderContent(userID, folderID); | ||
183 | } | ||
184 | |||
185 | public List<InventoryItemBase> GetFolderItems(UUID userID, UUID folderID) | ||
186 | { | ||
187 | return m_RemoteConnector.GetFolderItems(userID, folderID); | ||
188 | } | ||
189 | |||
190 | public bool AddFolder(InventoryFolderBase folder) | ||
191 | { | ||
192 | if (folder == null) | ||
193 | return false; | ||
194 | |||
195 | return m_RemoteConnector.AddFolder(folder); | ||
196 | } | ||
197 | |||
198 | public bool UpdateFolder(InventoryFolderBase folder) | ||
199 | { | ||
200 | if (folder == null) | ||
201 | return false; | ||
202 | |||
203 | return m_RemoteConnector.UpdateFolder(folder); | ||
204 | } | ||
205 | |||
206 | public bool MoveFolder(InventoryFolderBase folder) | ||
207 | { | ||
208 | if (folder == null) | ||
209 | return false; | ||
210 | |||
211 | return m_RemoteConnector.MoveFolder(folder); | ||
212 | } | ||
213 | |||
214 | public bool DeleteFolders(UUID ownerID, List<UUID> folderIDs) | ||
215 | { | ||
216 | if (folderIDs == null) | ||
217 | return false; | ||
218 | if (folderIDs.Count == 0) | ||
219 | return false; | ||
220 | |||
221 | return m_RemoteConnector.DeleteFolders(ownerID, folderIDs); | ||
222 | } | ||
223 | |||
224 | |||
225 | public bool PurgeFolder(InventoryFolderBase folder) | ||
226 | { | ||
227 | if (folder == null) | ||
228 | return false; | ||
229 | |||
230 | return m_RemoteConnector.PurgeFolder(folder); | ||
231 | } | ||
232 | |||
233 | public bool AddItem(InventoryItemBase item) | ||
234 | { | ||
235 | if (item == null) | ||
236 | return false; | ||
237 | |||
238 | return m_RemoteConnector.AddItem(item); | ||
239 | } | ||
240 | |||
241 | public bool UpdateItem(InventoryItemBase item) | ||
242 | { | ||
243 | if (item == null) | ||
244 | return false; | ||
245 | |||
246 | return m_RemoteConnector.UpdateItem(item); | ||
247 | } | ||
248 | |||
249 | public bool MoveItems(UUID ownerID, List<InventoryItemBase> items) | ||
250 | { | ||
251 | if (items == null) | ||
252 | return false; | ||
253 | |||
254 | return m_RemoteConnector.MoveItems(ownerID, items); | ||
255 | } | ||
256 | |||
257 | |||
258 | public bool DeleteItems(UUID ownerID, List<UUID> itemIDs) | ||
259 | { | ||
260 | if (itemIDs == null) | ||
261 | return false; | ||
262 | if (itemIDs.Count == 0) | ||
263 | return true; | ||
264 | |||
265 | return m_RemoteConnector.DeleteItems(ownerID, itemIDs); | ||
266 | } | ||
267 | |||
268 | public InventoryItemBase GetItem(InventoryItemBase item) | ||
269 | { | ||
270 | if (item == null) | ||
271 | return null; | ||
272 | |||
273 | return m_RemoteConnector.GetItem(item); | ||
274 | } | ||
275 | |||
276 | public InventoryFolderBase GetFolder(InventoryFolderBase folder) | ||
277 | { | ||
278 | m_log.DebugFormat("[XINVENTORY CONNECTOR]: GetFolder {0}", folder.ID); | ||
279 | if (folder == null) | ||
280 | return null; | ||
281 | |||
282 | return m_RemoteConnector.GetFolder(folder); | ||
283 | } | ||
284 | |||
285 | public bool HasInventoryForUser(UUID userID) | ||
286 | { | ||
287 | return false; | ||
288 | } | ||
289 | |||
290 | public List<InventoryItemBase> GetActiveGestures(UUID userId) | ||
291 | { | ||
292 | return new List<InventoryItemBase>(); | ||
293 | } | ||
294 | |||
295 | public int GetAssetPermissions(UUID userID, UUID assetID) | ||
296 | { | ||
297 | return m_RemoteConnector.GetAssetPermissions(userID, assetID); | ||
298 | } | ||
299 | |||
300 | |||
301 | #endregion | ||
302 | |||
303 | |||
304 | } | ||
305 | } | ||
diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index 01359f0..69b247c 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs | |||
@@ -1721,7 +1721,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1721 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1721 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1722 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1722 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1723 | 1723 | ||
1724 | return true; | 1724 | return GenericObjectPermission(userID, objectID, false); |
1725 | } | 1725 | } |
1726 | 1726 | ||
1727 | private bool CanDelinkObject(UUID userID, UUID objectID) | 1727 | private bool CanDelinkObject(UUID userID, UUID objectID) |
@@ -1729,7 +1729,7 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1729 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); | 1729 | DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); |
1730 | if (m_bypassPermissions) return m_bypassPermissionsValue; | 1730 | if (m_bypassPermissions) return m_bypassPermissionsValue; |
1731 | 1731 | ||
1732 | return true; | 1732 | return GenericObjectPermission(userID, objectID, false); |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) | 1735 | private bool CanBuyLand(UUID userID, ILandObject parcel, Scene scene) |
@@ -1894,4 +1894,4 @@ namespace OpenSim.Region.CoreModules.World.Permissions | |||
1894 | return(false); | 1894 | return(false); |
1895 | } | 1895 | } |
1896 | } | 1896 | } |
1897 | } \ No newline at end of file | 1897 | } |
diff --git a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs index f441aa9..6e69902 100644 --- a/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs +++ b/OpenSim/Region/DataSnapshot/ObjectSnapshot.cs | |||
@@ -69,7 +69,7 @@ namespace OpenSim.Region.DataSnapshot.Providers | |||
69 | byte RayEndIsIntersection) { this.Stale = true; }; | 69 | byte RayEndIsIntersection) { this.Stale = true; }; |
70 | client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children) | 70 | client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children) |
71 | { this.Stale = true; }; | 71 | { this.Stale = true; }; |
72 | client.OnDelinkObjects += delegate(List<uint> primIds) { this.Stale = true; }; | 72 | client.OnDelinkObjects += delegate(List<uint> primIds, IClientAPI clientApi) { this.Stale = true; }; |
73 | client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, | 73 | client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos, |
74 | IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; | 74 | IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; }; |
75 | client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, | 75 | client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, |
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2b90960..fd43923 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
161 | /// in this prim's inventory.</param> | 161 | /// in this prim's inventory.</param> |
162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
163 | bool UpdateInventoryItem(TaskInventoryItem item); | 163 | bool UpdateInventoryItem(TaskInventoryItem item); |
164 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); | ||
164 | 165 | ||
165 | /// <summary> | 166 | /// <summary> |
166 | /// Remove an item from this entity's inventory | 167 | /// Remove an item from this entity's inventory |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs index 8365fe3..e25a6e8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs | |||
@@ -30,8 +30,8 @@ using OpenSim.Region.Framework.Scenes; | |||
30 | 30 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead | 34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead |
35 | /// </summary> | 35 | /// </summary> |
36 | public interface IRegionModule | 36 | public interface IRegionModule |
37 | { | 37 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 15b5230..6ebfd31 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1941,5 +1941,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
1941 | part.GetProperties(remoteClient); | 1941 | part.GetProperties(remoteClient); |
1942 | } | 1942 | } |
1943 | } | 1943 | } |
1944 | |||
1945 | public void DelinkObjects(List<uint> primIds, IClientAPI client) | ||
1946 | { | ||
1947 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
1948 | |||
1949 | foreach (uint localID in primIds) | ||
1950 | { | ||
1951 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1952 | |||
1953 | if (part == null) | ||
1954 | continue; | ||
1955 | |||
1956 | if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1957 | parts.Add(part); | ||
1958 | } | ||
1959 | |||
1960 | m_sceneGraph.DelinkObjects(parts); | ||
1961 | } | ||
1962 | |||
1963 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | ||
1964 | { | ||
1965 | List<UUID> owners = new List<UUID>(); | ||
1966 | |||
1967 | List<SceneObjectPart> children = new List<SceneObjectPart>(); | ||
1968 | SceneObjectPart root = GetSceneObjectPart(parentPrimId); | ||
1969 | |||
1970 | if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) | ||
1971 | return; | ||
1972 | |||
1973 | foreach (uint localID in childPrimIds) | ||
1974 | { | ||
1975 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1976 | |||
1977 | if (part == null) | ||
1978 | continue; | ||
1979 | |||
1980 | if (!owners.Contains(part.OwnerID)) | ||
1981 | owners.Add(part.OwnerID); | ||
1982 | |||
1983 | if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1984 | children.Add(part); | ||
1985 | } | ||
1986 | |||
1987 | // Must be all one owner | ||
1988 | // | ||
1989 | if (owners.Count > 1) | ||
1990 | return; | ||
1991 | |||
1992 | m_sceneGraph.LinkObjects(root, children); | ||
1993 | } | ||
1944 | } | 1994 | } |
1945 | } | 1995 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 57587be..61a2956 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -2721,8 +2721,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2721 | client.OnObjectName += m_sceneGraph.PrimName; | 2721 | client.OnObjectName += m_sceneGraph.PrimName; |
2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; | 2722 | client.OnObjectClickAction += m_sceneGraph.PrimClickAction; |
2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; | 2723 | client.OnObjectMaterial += m_sceneGraph.PrimMaterial; |
2724 | client.OnLinkObjects += m_sceneGraph.LinkObjects; | 2724 | client.OnLinkObjects += LinkObjects; |
2725 | client.OnDelinkObjects += m_sceneGraph.DelinkObjects; | 2725 | client.OnDelinkObjects += DelinkObjects; |
2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; | 2726 | client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; |
2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; | 2727 | client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; |
2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; | 2728 | client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; |
@@ -2878,8 +2878,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2878 | client.OnObjectName -= m_sceneGraph.PrimName; | 2878 | client.OnObjectName -= m_sceneGraph.PrimName; |
2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | 2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; |
2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | 2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; |
2881 | client.OnLinkObjects -= m_sceneGraph.LinkObjects; | 2881 | client.OnLinkObjects -= LinkObjects; |
2882 | client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; | 2882 | client.OnDelinkObjects -= DelinkObjects; |
2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | 2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; |
2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | 2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; |
2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | 2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1421d0e..ce11267 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1463,20 +1463,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | /// <param name="client"></param> | 1463 | /// <param name="client"></param> |
1464 | /// <param name="parentPrim"></param> | 1464 | /// <param name="parentPrim"></param> |
1465 | /// <param name="childPrims"></param> | 1465 | /// <param name="childPrims"></param> |
1466 | protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | 1466 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) |
1467 | { | 1467 | { |
1468 | Monitor.Enter(m_updateLock); | 1468 | Monitor.Enter(m_updateLock); |
1469 | try | 1469 | try |
1470 | { | 1470 | { |
1471 | SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); | 1471 | SceneObjectGroup parentGroup = root.ParentGroup; |
1472 | 1472 | ||
1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1474 | if (parentGroup != null) | 1474 | if (parentGroup != null) |
1475 | { | 1475 | { |
1476 | // We do this in reverse to get the link order of the prims correct | 1476 | // We do this in reverse to get the link order of the prims correct |
1477 | for (int i = childPrimIds.Count - 1; i >= 0; i--) | 1477 | for (int i = children.Count - 1; i >= 0; i--) |
1478 | { | 1478 | { |
1479 | SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); | 1479 | SceneObjectGroup child = children[i].ParentGroup; |
1480 | |||
1480 | if (child != null) | 1481 | if (child != null) |
1481 | { | 1482 | { |
1482 | // Make sure no child prim is set for sale | 1483 | // Make sure no child prim is set for sale |
@@ -1509,17 +1510,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | parentGroup.HasGroupChanged = true; | 1510 | parentGroup.HasGroupChanged = true; |
1510 | parentGroup.ScheduleGroupForFullUpdate(); | 1511 | parentGroup.ScheduleGroupForFullUpdate(); |
1511 | 1512 | ||
1512 | // if (client != null) | ||
1513 | // { | ||
1514 | // parentGroup.GetProperties(client); | ||
1515 | // } | ||
1516 | // else | ||
1517 | // { | ||
1518 | // foreach (ScenePresence p in GetScenePresences()) | ||
1519 | // { | ||
1520 | // parentGroup.GetProperties(p.ControllingClient); | ||
1521 | // } | ||
1522 | // } | ||
1523 | } | 1513 | } |
1524 | finally | 1514 | finally |
1525 | { | 1515 | { |
@@ -1531,12 +1521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1531 | /// Delink a linkset | 1521 | /// Delink a linkset |
1532 | /// </summary> | 1522 | /// </summary> |
1533 | /// <param name="prims"></param> | 1523 | /// <param name="prims"></param> |
1534 | protected internal void DelinkObjects(List<uint> primIds) | 1524 | protected internal void DelinkObjects(List<SceneObjectPart> prims) |
1535 | { | ||
1536 | DelinkObjects(primIds, true); | ||
1537 | } | ||
1538 | |||
1539 | protected internal void DelinkObjects(List<uint> primIds, bool sendEvents) | ||
1540 | { | 1525 | { |
1541 | Monitor.Enter(m_updateLock); | 1526 | Monitor.Enter(m_updateLock); |
1542 | try | 1527 | try |
@@ -1546,9 +1531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1546 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); | 1531 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); |
1547 | // Look them all up in one go, since that is comparatively expensive | 1532 | // Look them all up in one go, since that is comparatively expensive |
1548 | // | 1533 | // |
1549 | foreach (uint primID in primIds) | 1534 | foreach (SceneObjectPart part in prims) |
1550 | { | 1535 | { |
1551 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID); | ||
1552 | if (part != null) | 1536 | if (part != null) |
1553 | { | 1537 | { |
1554 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1538 | if (part.ParentGroup.Children.Count != 1) // Skip single |
@@ -1563,17 +1547,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | affectedGroups.Add(group); | 1547 | affectedGroups.Add(group); |
1564 | } | 1548 | } |
1565 | } | 1549 | } |
1566 | else | ||
1567 | { | ||
1568 | m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID); | ||
1569 | } | ||
1570 | } | 1550 | } |
1571 | 1551 | ||
1572 | foreach (SceneObjectPart child in childParts) | 1552 | foreach (SceneObjectPart child in childParts) |
1573 | { | 1553 | { |
1574 | // Unlink all child parts from their groups | 1554 | // Unlink all child parts from their groups |
1575 | // | 1555 | // |
1576 | child.ParentGroup.DelinkFromGroup(child, sendEvents); | 1556 | child.ParentGroup.DelinkFromGroup(child, true); |
1577 | } | 1557 | } |
1578 | 1558 | ||
1579 | foreach (SceneObjectPart root in rootParts) | 1559 | foreach (SceneObjectPart root in rootParts) |
@@ -1628,12 +1608,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | List<uint> linkIDs = new List<uint>(); | 1608 | List<uint> linkIDs = new List<uint>(); |
1629 | 1609 | ||
1630 | foreach (SceneObjectPart newChild in newSet) | 1610 | foreach (SceneObjectPart newChild in newSet) |
1631 | { | ||
1632 | newChild.UpdateFlag = 0; | 1611 | newChild.UpdateFlag = 0; |
1633 | linkIDs.Add(newChild.LocalId); | ||
1634 | } | ||
1635 | 1612 | ||
1636 | LinkObjects(null, newRoot.LocalId, linkIDs); | 1613 | LinkObjects(newRoot, newSet); |
1637 | if (!affectedGroups.Contains(newRoot.ParentGroup)) | 1614 | if (!affectedGroups.Contains(newRoot.ParentGroup)) |
1638 | affectedGroups.Add(newRoot.ParentGroup); | 1615 | affectedGroups.Add(newRoot.ParentGroup); |
1639 | } | 1616 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3b1b567..4da63c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -609,43 +609,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
610 | public bool UpdateInventoryItem(TaskInventoryItem item) | 610 | public bool UpdateInventoryItem(TaskInventoryItem item) |
611 | { | 611 | { |
612 | lock (m_items) | 612 | return UpdateInventoryItem(item, true); |
613 | } | ||
614 | |||
615 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | ||
616 | { | ||
617 | lock(m_items) | ||
613 | { | 618 | { |
614 | if (m_items.ContainsKey(item.ItemID)) | 619 | if (m_items.ContainsKey(item.ItemID)) |
615 | { | 620 | { |
616 | item.ParentID = m_part.UUID; | 621 | if (m_items.ContainsKey(item.ItemID)) |
617 | item.ParentPartID = m_part.UUID; | ||
618 | item.Flags = m_items[item.ItemID].Flags; | ||
619 | |||
620 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
621 | // changed since permissions were last set. | ||
622 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
623 | item.GroupID = m_part.GroupID; | ||
624 | |||
625 | if (item.AssetID == UUID.Zero) | ||
626 | { | 622 | { |
627 | item.AssetID = m_items[item.ItemID].AssetID; | 623 | item.ParentID = m_part.UUID; |
624 | item.ParentPartID = m_part.UUID; | ||
625 | item.Flags = m_items[item.ItemID].Flags; | ||
626 | |||
627 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
628 | // changed since permissions were last set. | ||
629 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
630 | item.GroupID = m_part.GroupID; | ||
631 | |||
632 | if (item.AssetID == UUID.Zero) | ||
633 | { | ||
634 | item.AssetID = m_items[item.ItemID].AssetID; | ||
635 | } | ||
636 | m_items[item.ItemID] = item; | ||
637 | m_inventorySerial++; | ||
638 | if (fireScriptEvents) | ||
639 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
640 | HasInventoryChanged = true; | ||
641 | m_part.ParentGroup.HasGroupChanged = true; | ||
642 | return true; | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | m_log.ErrorFormat( | ||
647 | "[PRIM INVENTORY]: " + | ||
648 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
649 | item.ItemID, m_part.Name, m_part.UUID, | ||
650 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
628 | } | 651 | } |
629 | 652 | ||
630 | m_items[item.ItemID] = item; | ||
631 | m_inventorySerial++; | ||
632 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
633 | HasInventoryChanged = true; | ||
634 | m_part.ParentGroup.HasGroupChanged = true; | ||
635 | |||
636 | return true; | ||
637 | } | ||
638 | else | ||
639 | { | ||
640 | m_log.ErrorFormat( | ||
641 | "[PRIM INVENTORY]: " + | ||
642 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
643 | item.ItemID, m_part.Name, m_part.UUID, | ||
644 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
645 | } | 653 | } |
654 | return false; | ||
646 | } | 655 | } |
647 | |||
648 | return false; | ||
649 | } | 656 | } |
650 | 657 | ||
651 | /// <summary> | 658 | /// <summary> |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs index 5fac189..16cd7e4 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs | |||
@@ -39,6 +39,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | { | 39 | { |
40 | int Type { get; } | 40 | int Type { get; } |
41 | UUID AssetID { get; } | 41 | UUID AssetID { get; } |
42 | T RetreiveAsset<T>() where T : Asset, new(); | 42 | T RetrieveAsset<T>() where T : Asset, new(); |
43 | } | 43 | } |
44 | } | 44 | } |
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs index 5bf29d7..bf85cbc 100644 --- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs +++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/InventoryItem.cs | |||
@@ -39,11 +39,11 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
39 | public class InventoryItem : IInventoryItem | 39 | public class InventoryItem : IInventoryItem |
40 | { | 40 | { |
41 | TaskInventoryItem m_privateItem; | 41 | TaskInventoryItem m_privateItem; |
42 | Scene m_rootSceene; | 42 | Scene m_rootScene; |
43 | 43 | ||
44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) | 44 | public InventoryItem(Scene rootScene, TaskInventoryItem internalItem) |
45 | { | 45 | { |
46 | m_rootSceene = rootScene; | 46 | m_rootScene = rootScene; |
47 | m_privateItem = internalItem; | 47 | m_privateItem = internalItem; |
48 | } | 48 | } |
49 | 49 | ||
@@ -82,9 +82,9 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | |||
82 | public UUID AssetID { get { return m_privateItem.AssetID; } } | 82 | public UUID AssetID { get { return m_privateItem.AssetID; } } |
83 | 83 | ||
84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. | 84 | // This method exposes OpenSim/OpenMetaverse internals and needs to be replaced with a IAsset specific to MRM. |
85 | public T RetreiveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() | 85 | public T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new() |
86 | { | 86 | { |
87 | AssetBase a = m_rootSceene.AssetService.Get(AssetID.ToString()); | 87 | AssetBase a = m_rootScene.AssetService.Get(AssetID.ToString()); |
88 | T result = new T(); | 88 | T result = new T(); |
89 | 89 | ||
90 | if ((sbyte)result.AssetType != a.Type) | 90 | if ((sbyte)result.AssetType != a.Type) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs index d8c0ba5..f719683 100644 --- a/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs +++ b/OpenSim/Region/ScriptEngine/Shared/CodeTools/Compiler.cs | |||
@@ -261,13 +261,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
261 | // } | 261 | // } |
262 | //} | 262 | //} |
263 | 263 | ||
264 | public object GetCompilerOutput(UUID assetID) | 264 | public string GetCompilerOutput(string assetID) |
265 | { | 265 | { |
266 | return Path.Combine(ScriptEnginesPath, Path.Combine( | 266 | return Path.Combine(ScriptEnginesPath, Path.Combine( |
267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | 267 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), |
268 | FilePrefix + "_compiled_" + assetID + ".dll")); | 268 | FilePrefix + "_compiled_" + assetID + ".dll")); |
269 | } | 269 | } |
270 | 270 | ||
271 | public string GetCompilerOutput(UUID assetID) | ||
272 | { | ||
273 | return GetCompilerOutput(assetID.ToString()); | ||
274 | } | ||
275 | |||
271 | /// <summary> | 276 | /// <summary> |
272 | /// Converts script from LSL to CS and calls CompileFromCSText | 277 | /// Converts script from LSL to CS and calls CompileFromCSText |
273 | /// </summary> | 278 | /// </summary> |
@@ -279,9 +284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.CodeTools | |||
279 | linemap = null; | 284 | linemap = null; |
280 | m_warnings.Clear(); | 285 | m_warnings.Clear(); |
281 | 286 | ||
282 | assembly = Path.Combine(ScriptEnginesPath, Path.Combine( | 287 | assembly = GetCompilerOutput(asset); |
283 | m_scriptEngine.World.RegionInfo.RegionID.ToString(), | ||
284 | FilePrefix + "_compiled_" + asset + ".dll")); | ||
285 | 288 | ||
286 | if (!Directory.Exists(ScriptEnginesPath)) | 289 | if (!Directory.Exists(ScriptEnginesPath)) |
287 | { | 290 | { |