diff options
Diffstat (limited to 'OpenSim/Region/Framework')
11 files changed, 440 insertions, 349 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index f8af367..2af2548 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
44 | /// <param name="rot"></param> | 44 | /// <param name="rot"></param> |
45 | /// <param name="silent"></param> | 45 | /// <param name="silent"></param> |
46 | void AttachObject( | 46 | void AttachObject( |
47 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent); | 47 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent); |
48 | 48 | ||
49 | /// <summary> | 49 | /// <summary> |
50 | /// Attach an object to an avatar. | 50 | /// Attach an object to an avatar. |
@@ -57,7 +57,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
57 | /// <param name="silent"></param> | 57 | /// <param name="silent"></param> |
58 | /// <returns>true if the object was successfully attached, false otherwise</returns> | 58 | /// <returns>true if the object was successfully attached, false otherwise</returns> |
59 | bool AttachObject( | 59 | bool AttachObject( |
60 | IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent); | 60 | IClientAPI remoteClient, SceneObjectGroup grp, uint AttachmentPt, bool silent); |
61 | 61 | ||
62 | /// <summary> | 62 | /// <summary> |
63 | /// Rez an attachment from user inventory and change inventory status to match. | 63 | /// Rez an attachment from user inventory and change inventory status to match. |
diff --git a/OpenSim/Region/Framework/Interfaces/IHyperService.cs b/OpenSim/Region/Framework/Interfaces/IHyperService.cs deleted file mode 100644 index 51ea28a..0000000 --- a/OpenSim/Region/Framework/Interfaces/IHyperService.cs +++ /dev/null | |||
@@ -1,37 +0,0 @@ | |||
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 | using System; | ||
28 | using OpenMetaverse; | ||
29 | |||
30 | namespace OpenSim.Region.Framework.Interfaces | ||
31 | { | ||
32 | public interface IHyperAssetService | ||
33 | { | ||
34 | string GetUserAssetServer(UUID userID); | ||
35 | string GetSimAssetServer(); | ||
36 | } | ||
37 | } | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs index 97f4188..05fc2ad 100644 --- a/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IInventoryAccessModule.cs | |||
@@ -43,5 +43,9 @@ namespace OpenSim.Region.Framework.Interfaces | |||
43 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, | 43 | UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, |
44 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); | 44 | bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment); |
45 | void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); | 45 | void TransferInventoryAssets(InventoryItemBase item, UUID sender, UUID receiver); |
46 | bool GetAgentInventoryItem(IClientAPI remoteClient, UUID itemID, UUID requestID); | ||
47 | |||
48 | // Must be here because of textures in user's inventory | ||
49 | bool IsForeignUser(UUID userID, out string assetServerURL); | ||
46 | } | 50 | } |
47 | } | 51 | } |
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index a4dd170..3b8d727 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs | |||
@@ -179,7 +179,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
179 | public event ScriptChangedEvent OnScriptChangedEvent; | 179 | public event ScriptChangedEvent OnScriptChangedEvent; |
180 | public delegate void ScriptChangedEvent(uint localID, uint change); | 180 | public delegate void ScriptChangedEvent(uint localID, uint change); |
181 | 181 | ||
182 | public delegate void ScriptControlEvent(uint localID, UUID item, UUID avatarID, uint held, uint changed); | 182 | public delegate void ScriptControlEvent(UUID item, UUID avatarID, uint held, uint changed); |
183 | public event ScriptControlEvent OnScriptControlEvent; | 183 | public event ScriptControlEvent OnScriptControlEvent; |
184 | 184 | ||
185 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); | 185 | public delegate void ScriptAtTargetEvent(uint localID, uint handle, Vector3 targetpos, Vector3 atpos); |
@@ -1614,7 +1614,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1614 | } | 1614 | } |
1615 | } | 1615 | } |
1616 | 1616 | ||
1617 | internal void TriggerControlEvent(uint p, UUID scriptUUID, UUID avatarID, uint held, uint _changed) | 1617 | internal void TriggerControlEvent(UUID scriptUUID, UUID avatarID, uint held, uint _changed) |
1618 | { | 1618 | { |
1619 | ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; | 1619 | ScriptControlEvent handlerScriptControlEvent = OnScriptControlEvent; |
1620 | if (handlerScriptControlEvent != null) | 1620 | if (handlerScriptControlEvent != null) |
@@ -1623,7 +1623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1623 | { | 1623 | { |
1624 | try | 1624 | try |
1625 | { | 1625 | { |
1626 | d(p, scriptUUID, avatarID, held, _changed); | 1626 | d(scriptUUID, avatarID, held, _changed); |
1627 | } | 1627 | } |
1628 | catch (Exception e) | 1628 | catch (Exception e) |
1629 | { | 1629 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f9da341..01edf51 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
73 | IMoneyModule money=RequestModuleInterface<IMoneyModule>(); | 73 | IMoneyModule money=RequestModuleInterface<IMoneyModule>(); |
74 | if (money != null) | 74 | if (money != null) |
75 | { | 75 | { |
76 | money.ApplyUploadCharge(agentID); | 76 | money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); |
77 | } | 77 | } |
78 | 78 | ||
79 | AddInventoryItem(agentID, item); | 79 | AddInventoryItem(agentID, item); |
@@ -265,6 +265,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
265 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, | 265 | public void UpdateInventoryItemAsset(IClientAPI remoteClient, UUID transactionID, |
266 | UUID itemID, InventoryItemBase itemUpd) | 266 | UUID itemID, InventoryItemBase itemUpd) |
267 | { | 267 | { |
268 | // This one will let people set next perms on items in agent | ||
269 | // inventory. Rut-Roh. Whatever. Make this secure. Yeah. | ||
270 | // | ||
271 | // Passing something to another avatar or a an object will already | ||
268 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); | 272 | InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); |
269 | item = InventoryService.GetItem(item); | 273 | item = InventoryService.GetItem(item); |
270 | 274 | ||
@@ -274,11 +278,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
274 | { | 278 | { |
275 | item.Name = itemUpd.Name; | 279 | item.Name = itemUpd.Name; |
276 | item.Description = itemUpd.Description; | 280 | item.Description = itemUpd.Description; |
277 | item.NextPermissions = itemUpd.NextPermissions; | 281 | item.NextPermissions = itemUpd.NextPermissions & item.BasePermissions; |
278 | item.CurrentPermissions |= 8; // Slam! | 282 | item.EveryOnePermissions = itemUpd.EveryOnePermissions & item.BasePermissions; |
279 | item.EveryOnePermissions = itemUpd.EveryOnePermissions; | 283 | item.GroupPermissions = itemUpd.GroupPermissions & item.BasePermissions; |
280 | item.GroupPermissions = itemUpd.GroupPermissions; | ||
281 | |||
282 | item.GroupID = itemUpd.GroupID; | 284 | item.GroupID = itemUpd.GroupID; |
283 | item.GroupOwned = itemUpd.GroupOwned; | 285 | item.GroupOwned = itemUpd.GroupOwned; |
284 | item.CreationDate = itemUpd.CreationDate; | 286 | item.CreationDate = itemUpd.CreationDate; |
@@ -384,28 +386,103 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | 386 | ||
385 | if (Permissions.PropagatePermissions() && recipient != senderId) | 387 | if (Permissions.PropagatePermissions() && recipient != senderId) |
386 | { | 388 | { |
387 | // First, make sore base is limited to the next perms | 389 | // Trying to do this right this time. This is evil. If |
388 | itemCopy.BasePermissions = item.BasePermissions & (item.NextPermissions | (uint)PermissionMask.Move); | 390 | // you believe in Good, go elsewhere. Vampires and other |
389 | // By default, current equals base | 391 | // evil creatores only beyond this point. You have been |
390 | itemCopy.CurrentPermissions = itemCopy.BasePermissions & item.CurrentPermissions; | 392 | // warned. |
391 | 393 | ||
392 | // If this is an object, replace current perms | 394 | // We're going to mask a lot of things by the next perms |
393 | // with folded perms | 395 | // Tweak the next perms to be nicer to our data |
396 | // | ||
397 | // In this mask, all the bits we do NOT want to mess | ||
398 | // with are set. These are: | ||
399 | // | ||
400 | // Transfer | ||
401 | // Copy | ||
402 | // Modufy | ||
403 | uint permsMask = ~ ((uint)PermissionMask.Copy | | ||
404 | (uint)PermissionMask.Transfer | | ||
405 | (uint)PermissionMask.Modify); | ||
406 | |||
407 | // Now, reduce the next perms to the mask bits | ||
408 | // relevant to the operation | ||
409 | uint nextPerms = permsMask | (item.NextPermissions & | ||
410 | ((uint)PermissionMask.Copy | | ||
411 | (uint)PermissionMask.Transfer | | ||
412 | (uint)PermissionMask.Modify)); | ||
413 | |||
414 | // nextPerms now has all bits set, except for the actual | ||
415 | // next permission bits. | ||
416 | |||
417 | // This checks for no mod, no copy, no trans. | ||
418 | // This indicates an error or messed up item. Do it like | ||
419 | // SL and assume trans | ||
420 | if (nextPerms == permsMask) | ||
421 | nextPerms |= (uint)PermissionMask.Transfer; | ||
422 | |||
423 | // Inventory owner perms are the logical AND of the | ||
424 | // folded perms and the root prim perms, however, if | ||
425 | // the root prim is mod, the inventory perms will be | ||
426 | // mod. This happens on "take" and is of little concern | ||
427 | // here, save for preventing escalation | ||
428 | |||
429 | // This hack ensures that items previously permalocked | ||
430 | // get unlocked when they're passed or rezzed | ||
431 | uint basePerms = item.BasePermissions | | ||
432 | (uint)PermissionMask.Move; | ||
433 | uint ownerPerms = item.CurrentPermissions; | ||
434 | |||
435 | // If this is an object, root prim perms may be more | ||
436 | // permissive than folded perms. Use folded perms as | ||
437 | // a mask | ||
394 | if (item.InvType == (int)InventoryType.Object) | 438 | if (item.InvType == (int)InventoryType.Object) |
395 | { | 439 | { |
396 | itemCopy.CurrentPermissions &= ~(uint)(PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 440 | // Create a safe mask for the current perms |
397 | itemCopy.CurrentPermissions |= (item.CurrentPermissions & 7) << 13; | 441 | uint foldedPerms = (item.CurrentPermissions & 7) << 13; |
442 | foldedPerms |= permsMask; | ||
443 | |||
444 | bool isRootMod = (item.CurrentPermissions & | ||
445 | (uint)PermissionMask.Modify) != 0 ? | ||
446 | true : false; | ||
447 | |||
448 | // Mask the owner perms to the folded perms | ||
449 | ownerPerms &= foldedPerms; | ||
450 | basePerms &= foldedPerms; | ||
451 | |||
452 | // If the root was mod, let the mask reflect that | ||
453 | // We also need to adjust the base here, because | ||
454 | // we should be able to edit in-inventory perms | ||
455 | // for the root prim, if it's mod. | ||
456 | if (isRootMod) | ||
457 | { | ||
458 | ownerPerms |= (uint)PermissionMask.Modify; | ||
459 | basePerms |= (uint)PermissionMask.Modify; | ||
460 | } | ||
398 | } | 461 | } |
399 | 462 | ||
400 | // Ensure there is no escalation | 463 | // These will be applied to the root prim at next rez. |
401 | itemCopy.CurrentPermissions &= (item.NextPermissions | (uint)PermissionMask.Move); | 464 | // The slam bit (bit 3) and folded permission (bits 0-2) |
465 | // are preserved due to the above mangling | ||
466 | ownerPerms &= nextPerms; | ||
402 | 467 | ||
403 | // Need slam bit on xfer | 468 | // Mask the base permissions. This is a conservative |
404 | itemCopy.CurrentPermissions |= 8; | 469 | // approach altering only the three main perms |
470 | basePerms &= nextPerms; | ||
471 | |||
472 | // Assign to the actual item. Make sure the slam bit is | ||
473 | // set, if it wasn't set before. | ||
474 | itemCopy.BasePermissions = basePerms; | ||
475 | itemCopy.CurrentPermissions = ownerPerms | 16; // Slam | ||
405 | 476 | ||
406 | itemCopy.NextPermissions = item.NextPermissions; | 477 | itemCopy.NextPermissions = item.NextPermissions; |
407 | 478 | ||
408 | itemCopy.EveryOnePermissions = 0; | 479 | // This preserves "everyone can move" |
480 | itemCopy.EveryOnePermissions = item.EveryOnePermissions & | ||
481 | nextPerms; | ||
482 | |||
483 | // Intentionally killing "share with group" here, as | ||
484 | // the recipient will not have the group this is | ||
485 | // set to | ||
409 | itemCopy.GroupPermissions = 0; | 486 | itemCopy.GroupPermissions = 0; |
410 | } | 487 | } |
411 | else | 488 | else |
@@ -839,6 +916,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
839 | SceneObjectGroup group = part.ParentGroup; | 916 | SceneObjectGroup group = part.ParentGroup; |
840 | if (group != null) | 917 | if (group != null) |
841 | { | 918 | { |
919 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
920 | return; | ||
921 | |||
842 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); | 922 | TaskInventoryItem item = group.GetInventoryItem(localID, itemID); |
843 | if (item == null) | 923 | if (item == null) |
844 | return; | 924 | return; |
@@ -903,7 +983,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
903 | else | 983 | else |
904 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; | 984 | agentItem.CurrentPermissions = agentItem.BasePermissions & taskItem.CurrentPermissions; |
905 | 985 | ||
906 | agentItem.CurrentPermissions |= 8; | 986 | agentItem.CurrentPermissions |= 16; // Slam |
907 | agentItem.NextPermissions = taskItem.NextPermissions; | 987 | agentItem.NextPermissions = taskItem.NextPermissions; |
908 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); | 988 | agentItem.EveryOnePermissions = taskItem.EveryonePermissions & (taskItem.NextPermissions | (uint)PermissionMask.Move); |
909 | agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; | 989 | agentItem.GroupPermissions = taskItem.GroupPermissions & taskItem.NextPermissions; |
@@ -978,9 +1058,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
978 | return; | 1058 | return; |
979 | } | 1059 | } |
980 | 1060 | ||
981 | // Only owner can copy | 1061 | TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); |
982 | if (remoteClient.AgentId != taskItem.OwnerID) | 1062 | if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) |
983 | return; | 1063 | { |
1064 | // If the item to be moved is no copy, we need to be able to | ||
1065 | // edit the prim. | ||
1066 | if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) | ||
1067 | return; | ||
1068 | } | ||
1069 | else | ||
1070 | { | ||
1071 | // If the item is copiable, then we just need to have perms | ||
1072 | // on it. The delete check is a pure rights check | ||
1073 | if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) | ||
1074 | return; | ||
1075 | } | ||
984 | 1076 | ||
985 | MoveTaskInventoryItem(remoteClient, folderId, part, itemId); | 1077 | MoveTaskInventoryItem(remoteClient, folderId, part, itemId); |
986 | } | 1078 | } |
@@ -1094,7 +1186,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1094 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); | 1186 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); |
1095 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & | 1187 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & |
1096 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); | 1188 | (srcTaskItem.NextPermissions | (uint)PermissionMask.Move); |
1097 | destTaskItem.CurrentPermissions |= 8; // Slam! | 1189 | destTaskItem.CurrentPermissions |= 16; // Slam! |
1098 | } | 1190 | } |
1099 | } | 1191 | } |
1100 | 1192 | ||
@@ -1263,10 +1355,48 @@ namespace OpenSim.Region.Framework.Scenes | |||
1263 | { | 1355 | { |
1264 | agentTransactions.HandleTaskItemUpdateFromTransaction( | 1356 | agentTransactions.HandleTaskItemUpdateFromTransaction( |
1265 | remoteClient, part, transactionID, currentItem); | 1357 | remoteClient, part, transactionID, currentItem); |
1358 | |||
1359 | if ((InventoryType)itemInfo.InvType == InventoryType.Notecard) | ||
1360 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
1361 | else if ((InventoryType)itemInfo.InvType == InventoryType.LSL) | ||
1362 | remoteClient.SendAgentAlertMessage("Script saved", false); | ||
1363 | else | ||
1364 | remoteClient.SendAgentAlertMessage("Item saved", false); | ||
1365 | } | ||
1366 | |||
1367 | // Base ALWAYS has move | ||
1368 | currentItem.BasePermissions |= (uint)PermissionMask.Move; | ||
1369 | |||
1370 | // Check if we're allowed to mess with permissions | ||
1371 | if (!Permissions.IsGod(remoteClient.AgentId)) // Not a god | ||
1372 | { | ||
1373 | if (remoteClient.AgentId != part.OwnerID) // Not owner | ||
1374 | { | ||
1375 | // Friends and group members can't change any perms | ||
1376 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1377 | itemInfo.EveryonePermissions = currentItem.EveryonePermissions; | ||
1378 | itemInfo.GroupPermissions = currentItem.GroupPermissions; | ||
1379 | itemInfo.NextPermissions = currentItem.NextPermissions; | ||
1380 | itemInfo.CurrentPermissions = currentItem.CurrentPermissions; | ||
1381 | } | ||
1382 | else | ||
1383 | { | ||
1384 | // Owner can't change base, and can change other | ||
1385 | // only up to base | ||
1386 | itemInfo.BasePermissions = currentItem.BasePermissions; | ||
1387 | itemInfo.EveryonePermissions &= currentItem.BasePermissions; | ||
1388 | itemInfo.GroupPermissions &= currentItem.BasePermissions; | ||
1389 | itemInfo.CurrentPermissions &= currentItem.BasePermissions; | ||
1390 | itemInfo.NextPermissions &= currentItem.BasePermissions; | ||
1391 | } | ||
1392 | |||
1266 | } | 1393 | } |
1394 | |||
1395 | // Next ALWAYS has move | ||
1396 | itemInfo.NextPermissions |= (uint)PermissionMask.Move; | ||
1397 | |||
1267 | if (part.Inventory.UpdateInventoryItem(itemInfo)) | 1398 | if (part.Inventory.UpdateInventoryItem(itemInfo)) |
1268 | { | 1399 | { |
1269 | remoteClient.SendAgentAlertMessage("Notecard saved", false); | ||
1270 | part.GetProperties(remoteClient); | 1400 | part.GetProperties(remoteClient); |
1271 | } | 1401 | } |
1272 | } | 1402 | } |
@@ -1478,7 +1608,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1478 | srcTaskItem.NextPermissions; | 1608 | srcTaskItem.NextPermissions; |
1479 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & | 1609 | destTaskItem.BasePermissions = srcTaskItem.BasePermissions & |
1480 | srcTaskItem.NextPermissions; | 1610 | srcTaskItem.NextPermissions; |
1481 | destTaskItem.CurrentPermissions |= 8; // Slam! | 1611 | destTaskItem.CurrentPermissions |= 16; // Slam! |
1482 | } | 1612 | } |
1483 | } | 1613 | } |
1484 | 1614 | ||
@@ -1597,7 +1727,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1597 | } | 1727 | } |
1598 | 1728 | ||
1599 | // Handle god perms | 1729 | // Handle god perms |
1600 | if (Permissions.IsGod(remoteClient.AgentId)) | 1730 | if ((remoteClient != null) && Permissions.IsGod(remoteClient.AgentId)) |
1601 | { | 1731 | { |
1602 | permissionToTake = true; | 1732 | permissionToTake = true; |
1603 | permissionToTakeCopy = true; | 1733 | permissionToTakeCopy = true; |
@@ -1608,7 +1738,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1608 | if (action == DeRezAction.SaveToExistingUserInventoryItem) | 1738 | if (action == DeRezAction.SaveToExistingUserInventoryItem) |
1609 | permissionToDelete = false; | 1739 | permissionToDelete = false; |
1610 | 1740 | ||
1611 | // if we want to take a copy,, we also don't want to delete | 1741 | // if we want to take a copy, we also don't want to delete |
1612 | // Note: after this point, the permissionToTakeCopy flag | 1742 | // Note: after this point, the permissionToTakeCopy flag |
1613 | // becomes irrelevant. It already includes the permissionToTake | 1743 | // becomes irrelevant. It already includes the permissionToTake |
1614 | // permission and after excluding no copy items here, we can | 1744 | // permission and after excluding no copy items here, we can |
@@ -1619,6 +1749,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1619 | if (!permissionToTakeCopy) | 1749 | if (!permissionToTakeCopy) |
1620 | return; | 1750 | return; |
1621 | 1751 | ||
1752 | permissionToTake = true; | ||
1622 | // Don't delete | 1753 | // Don't delete |
1623 | permissionToDelete = false; | 1754 | permissionToDelete = false; |
1624 | } | 1755 | } |
@@ -1863,17 +1994,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1863 | 1994 | ||
1864 | group.SetGroup(sourcePart.GroupID, null); | 1995 | group.SetGroup(sourcePart.GroupID, null); |
1865 | 1996 | ||
1866 | if (rootPart.OwnerID != item.OwnerID) | 1997 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) |
1867 | { | 1998 | { |
1868 | if (Permissions.PropagatePermissions()) | 1999 | if (Permissions.PropagatePermissions()) |
1869 | { | 2000 | { |
1870 | if ((item.CurrentPermissions & 8) != 0) | 2001 | foreach (SceneObjectPart part in partList) |
1871 | { | 2002 | { |
1872 | foreach (SceneObjectPart part in partList) | 2003 | part.EveryoneMask = item.EveryonePermissions; |
1873 | { | 2004 | part.NextOwnerMask = item.NextPermissions; |
1874 | part.EveryoneMask = item.EveryonePermissions; | ||
1875 | part.NextOwnerMask = item.NextPermissions; | ||
1876 | } | ||
1877 | } | 2005 | } |
1878 | group.ApplyNextOwnerPermissions(); | 2006 | group.ApplyNextOwnerPermissions(); |
1879 | } | 2007 | } |
@@ -1881,17 +2009,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1881 | 2009 | ||
1882 | foreach (SceneObjectPart part in partList) | 2010 | foreach (SceneObjectPart part in partList) |
1883 | { | 2011 | { |
1884 | if (part.OwnerID != item.OwnerID) | 2012 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) |
1885 | { | 2013 | { |
1886 | part.LastOwnerID = part.OwnerID; | 2014 | part.LastOwnerID = part.OwnerID; |
1887 | part.OwnerID = item.OwnerID; | 2015 | part.OwnerID = item.OwnerID; |
1888 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | 2016 | part.Inventory.ChangeInventoryOwner(item.OwnerID); |
1889 | } | 2017 | } |
1890 | else if ((item.CurrentPermissions & 8) != 0) // Slam! | 2018 | part.EveryoneMask = item.EveryonePermissions; |
1891 | { | 2019 | part.NextOwnerMask = item.NextPermissions; |
1892 | part.EveryoneMask = item.EveryonePermissions; | ||
1893 | part.NextOwnerMask = item.NextPermissions; | ||
1894 | } | ||
1895 | } | 2020 | } |
1896 | 2021 | ||
1897 | rootPart.TrimPermissions(); | 2022 | rootPart.TrimPermissions(); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 5542a0c..e8dce08 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -136,6 +136,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
136 | 136 | ||
137 | protected SceneCommunicationService m_sceneGridService; | 137 | protected SceneCommunicationService m_sceneGridService; |
138 | public bool LoginsDisabled = true; | 138 | public bool LoginsDisabled = true; |
139 | public bool LoadingPrims = false; | ||
139 | 140 | ||
140 | public new float TimeDilation | 141 | public new float TimeDilation |
141 | { | 142 | { |
@@ -478,8 +479,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
478 | set { m_sceneGraph.RestorePresences = value; } | 479 | set { m_sceneGraph.RestorePresences = value; } |
479 | } | 480 | } |
480 | 481 | ||
481 | public int objectCapacity = 45000; | ||
482 | |||
483 | #endregion | 482 | #endregion |
484 | 483 | ||
485 | #region BinaryStats | 484 | #region BinaryStats |
@@ -687,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
687 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 686 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
688 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 687 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
689 | 688 | ||
690 | StatsReporter.SetObjectCapacity(objectCapacity); | 689 | StatsReporter.SetObjectCapacity(RegionInfo.ObjectCapacity); |
691 | 690 | ||
692 | // Old | 691 | // Old |
693 | /* | 692 | /* |
@@ -1879,6 +1878,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1879 | /// </summary> | 1878 | /// </summary> |
1880 | public virtual void LoadPrimsFromStorage(UUID regionID) | 1879 | public virtual void LoadPrimsFromStorage(UUID regionID) |
1881 | { | 1880 | { |
1881 | LoadingPrims = true; | ||
1882 | m_log.Info("[SCENE]: Loading objects from datastore"); | 1882 | m_log.Info("[SCENE]: Loading objects from datastore"); |
1883 | 1883 | ||
1884 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); | 1884 | List<SceneObjectGroup> PrimsFromDB = m_storageManager.DataStore.LoadObjects(regionID); |
@@ -1904,6 +1904,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1904 | } | 1904 | } |
1905 | 1905 | ||
1906 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); | 1906 | m_log.Info("[SCENE]: Loaded " + PrimsFromDB.Count.ToString() + " SceneObject(s)"); |
1907 | LoadingPrims = false; | ||
1907 | } | 1908 | } |
1908 | 1909 | ||
1909 | 1910 | ||
@@ -2575,8 +2576,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2575 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); | 2576 | RootPrim.RemFlag(PrimFlags.TemporaryOnRez); |
2576 | 2577 | ||
2577 | if (AttachmentsModule != null) | 2578 | if (AttachmentsModule != null) |
2578 | AttachmentsModule.AttachObject( | 2579 | AttachmentsModule.AttachObject(sp.ControllingClient, grp, 0, false); |
2579 | sp.ControllingClient, grp.LocalId, (uint)0, grp.GroupRotation, grp.AbsolutePosition, false); | ||
2580 | 2580 | ||
2581 | } | 2581 | } |
2582 | else | 2582 | else |
@@ -4121,20 +4121,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
4121 | 4121 | ||
4122 | #region Other Methods | 4122 | #region Other Methods |
4123 | 4123 | ||
4124 | public void SetObjectCapacity(int objects) | ||
4125 | { | ||
4126 | // Region specific config overrides global | ||
4127 | // | ||
4128 | if (RegionInfo.ObjectCapacity != 0) | ||
4129 | objects = RegionInfo.ObjectCapacity; | ||
4130 | |||
4131 | if (StatsReporter != null) | ||
4132 | { | ||
4133 | StatsReporter.SetObjectCapacity(objects); | ||
4134 | } | ||
4135 | objectCapacity = objects; | ||
4136 | } | ||
4137 | |||
4138 | #endregion | 4124 | #endregion |
4139 | 4125 | ||
4140 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 4126 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
@@ -4733,7 +4719,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4733 | part.NextOwnerMask; | 4719 | part.NextOwnerMask; |
4734 | item.GroupPermissions = part.GroupMask & | 4720 | item.GroupPermissions = part.GroupMask & |
4735 | part.NextOwnerMask; | 4721 | part.NextOwnerMask; |
4736 | item.CurrentPermissions |= 8; // Slam! | 4722 | item.CurrentPermissions |= 16; // Slam! |
4737 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 4723 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
4738 | 4724 | ||
4739 | if (InventoryService.AddItem(item)) | 4725 | if (InventoryService.AddItem(item)) |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index f7e46af..9a01a28 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -172,13 +172,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
172 | taskItem.GroupPermissions = item.GroupPermissions & | 172 | taskItem.GroupPermissions = item.GroupPermissions & |
173 | item.NextPermissions; | 173 | item.NextPermissions; |
174 | taskItem.NextPermissions = item.NextPermissions; | 174 | taskItem.NextPermissions = item.NextPermissions; |
175 | taskItem.CurrentPermissions |= 8; | 175 | // We're adding this to a prim we don't own. Force |
176 | // owner change | ||
177 | taskItem.CurrentPermissions |= 16; // Slam | ||
176 | } | 178 | } |
177 | else | 179 | else |
178 | { | 180 | { |
179 | taskItem.BasePermissions = item.BasePermissions; | 181 | taskItem.BasePermissions = item.BasePermissions; |
180 | taskItem.CurrentPermissions = item.CurrentPermissions; | 182 | taskItem.CurrentPermissions = item.CurrentPermissions; |
181 | taskItem.CurrentPermissions |= 8; | ||
182 | taskItem.EveryonePermissions = item.EveryOnePermissions; | 183 | taskItem.EveryonePermissions = item.EveryOnePermissions; |
183 | taskItem.GroupPermissions = item.GroupPermissions; | 184 | taskItem.GroupPermissions = item.GroupPermissions; |
184 | taskItem.NextPermissions = item.NextPermissions; | 185 | taskItem.NextPermissions = item.NextPermissions; |
@@ -281,7 +282,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
281 | PermissionMask.Move | | 282 | PermissionMask.Move | |
282 | PermissionMask.Transfer) | 7; | 283 | PermissionMask.Transfer) | 7; |
283 | 284 | ||
284 | uint ownerMask = 0x7ffffff; | 285 | uint ownerMask = 0x7fffffff; |
285 | foreach (SceneObjectPart part in m_parts.Values) | 286 | foreach (SceneObjectPart part in m_parts.Values) |
286 | { | 287 | { |
287 | ownerMask &= part.OwnerMask; | 288 | ownerMask &= part.OwnerMask; |
@@ -295,12 +296,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) | 296 | if ((ownerMask & (uint)PermissionMask.Transfer) == 0) |
296 | perms &= ~(uint)PermissionMask.Transfer; | 297 | perms &= ~(uint)PermissionMask.Transfer; |
297 | 298 | ||
298 | if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) | 299 | // If root prim permissions are applied here, this would screw |
299 | perms &= ~((uint)PermissionMask.Modify >> 13); | 300 | // with in-inventory manipulation of the next owner perms |
300 | if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) | 301 | // in a major way. So, let's move this to the give itself. |
301 | perms &= ~((uint)PermissionMask.Copy >> 13); | 302 | // Yes. I know. Evil. |
302 | if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) | 303 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Modify) == 0) |
303 | perms &= ~((uint)PermissionMask.Transfer >> 13); | 304 | // perms &= ~((uint)PermissionMask.Modify >> 13); |
305 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Copy) == 0) | ||
306 | // perms &= ~((uint)PermissionMask.Copy >> 13); | ||
307 | // if ((ownerMask & RootPart.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) | ||
308 | // perms &= ~((uint)PermissionMask.Transfer >> 13); | ||
304 | 309 | ||
305 | return perms; | 310 | return perms; |
306 | } | 311 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 451b93e..c2f9117 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -294,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
294 | 294 | ||
295 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) | 295 | if ((m_scene.TestBorderCross(val - Vector3.UnitX, Cardinals.E) || m_scene.TestBorderCross(val + Vector3.UnitX, Cardinals.W) |
296 | || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) | 296 | || m_scene.TestBorderCross(val - Vector3.UnitY, Cardinals.N) || m_scene.TestBorderCross(val + Vector3.UnitY, Cardinals.S)) |
297 | && !IsAttachmentCheckFull()) | 297 | && !IsAttachmentCheckFull() && (!m_scene.LoadingPrims)) |
298 | { | 298 | { |
299 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); | 299 | m_scene.CrossPrimGroupIntoNewRegion(val, this, true); |
300 | } | 300 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3165f4d..444a239 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -181,6 +181,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
181 | public UUID FromItemID; | 181 | public UUID FromItemID; |
182 | 182 | ||
183 | [XmlIgnore] | 183 | [XmlIgnore] |
184 | public UUID FromFolderID; | ||
185 | |||
186 | [XmlIgnore] | ||
184 | public int STATUS_ROTATE_X; | 187 | public int STATUS_ROTATE_X; |
185 | 188 | ||
186 | [XmlIgnore] | 189 | [XmlIgnore] |
@@ -4164,6 +4167,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
4164 | case 16: | 4167 | case 16: |
4165 | _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & | 4168 | _nextOwnerMask = ApplyMask(_nextOwnerMask, set, mask) & |
4166 | baseMask; | 4169 | baseMask; |
4170 | // Prevent the client from creating no mod, no copy | ||
4171 | // objects | ||
4172 | if ((_nextOwnerMask & (uint)PermissionMask.Copy) == 0) | ||
4173 | _nextOwnerMask |= (uint)PermissionMask.Transfer; | ||
4174 | |||
4175 | _nextOwnerMask |= (uint)PermissionMask.Move; | ||
4176 | |||
4167 | break; | 4177 | break; |
4168 | } | 4178 | } |
4169 | SendFullUpdateToAllClients(); | 4179 | SendFullUpdateToAllClients(); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3a8f168..4ae53a2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -118,20 +118,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
118 | /// <param name="linkNum">Link number for the part</param> | 118 | /// <param name="linkNum">Link number for the part</param> |
119 | public void ResetInventoryIDs() | 119 | public void ResetInventoryIDs() |
120 | { | 120 | { |
121 | lock (Items) | 121 | lock (m_items) |
122 | { | 122 | { |
123 | if (0 == Items.Count) | 123 | if (0 == m_items.Count) |
124 | return; | 124 | return; |
125 | 125 | ||
126 | HasInventoryChanged = true; | 126 | HasInventoryChanged = true; |
127 | m_part.ParentGroup.HasGroupChanged = true; | 127 | m_part.ParentGroup.HasGroupChanged = true; |
128 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 128 | IList<TaskInventoryItem> items = GetInventoryItems(); |
129 | Items.Clear(); | 129 | m_items.Clear(); |
130 | 130 | ||
131 | foreach (TaskInventoryItem item in items) | 131 | foreach (TaskInventoryItem item in items) |
132 | { | 132 | { |
133 | item.ResetIDs(m_part.UUID); | 133 | item.ResetIDs(m_part.UUID); |
134 | Items.Add(item.ItemID, item); | 134 | m_items.Add(item.ItemID, item); |
135 | } | 135 | } |
136 | } | 136 | } |
137 | } | 137 | } |
@@ -148,17 +148,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
148 | { | 148 | { |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | } | ||
151 | 152 | ||
152 | HasInventoryChanged = true; | 153 | HasInventoryChanged = true; |
153 | m_part.ParentGroup.HasGroupChanged = true; | 154 | m_part.ParentGroup.HasGroupChanged = true; |
154 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 155 | List<TaskInventoryItem> items = GetInventoryItems(); |
155 | foreach (TaskInventoryItem item in items) | 156 | foreach (TaskInventoryItem item in items) |
157 | { | ||
158 | if (ownerId != item.OwnerID) | ||
156 | { | 159 | { |
157 | if (ownerId != item.OwnerID) | 160 | item.LastOwnerID = item.OwnerID; |
158 | { | 161 | item.OwnerID = ownerId; |
159 | item.LastOwnerID = item.OwnerID; | ||
160 | item.OwnerID = ownerId; | ||
161 | } | ||
162 | } | 162 | } |
163 | } | 163 | } |
164 | } | 164 | } |
@@ -175,17 +175,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
175 | { | 175 | { |
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | } | ||
178 | 179 | ||
179 | HasInventoryChanged = true; | 180 | HasInventoryChanged = true; |
180 | m_part.ParentGroup.HasGroupChanged = true; | 181 | m_part.ParentGroup.HasGroupChanged = true; |
181 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 182 | List<TaskInventoryItem> items = GetInventoryItems(); |
182 | foreach (TaskInventoryItem item in items) | 183 | foreach (TaskInventoryItem item in items) |
183 | { | 184 | { |
184 | if (groupID != item.GroupID) | 185 | if (groupID != item.GroupID) |
185 | { | 186 | item.GroupID = groupID; |
186 | item.GroupID = groupID; | ||
187 | } | ||
188 | } | ||
189 | } | 187 | } |
190 | } | 188 | } |
191 | 189 | ||
@@ -194,17 +192,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
194 | /// </summary> | 192 | /// </summary> |
195 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) | 193 | public void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource) |
196 | { | 194 | { |
197 | lock (m_items) | 195 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
198 | { | 196 | foreach (TaskInventoryItem item in scripts) |
199 | foreach (TaskInventoryItem item in Items.Values) | 197 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
200 | { | ||
201 | if ((int)InventoryType.LSL == item.InvType) | ||
202 | { | ||
203 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); | ||
204 | Thread.Sleep(10); // workaround for Mono cpu utilization > 100% bug | ||
205 | } | ||
206 | } | ||
207 | } | ||
208 | } | 198 | } |
209 | 199 | ||
210 | public ArrayList GetScriptErrors(UUID itemID) | 200 | public ArrayList GetScriptErrors(UUID itemID) |
@@ -237,16 +227,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
237 | /// </param> | 227 | /// </param> |
238 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) | 228 | public void RemoveScriptInstances(bool sceneObjectBeingDeleted) |
239 | { | 229 | { |
240 | lock (Items) | 230 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
241 | { | 231 | foreach (TaskInventoryItem item in scripts) |
242 | foreach (TaskInventoryItem item in Items.Values) | 232 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); |
243 | { | ||
244 | if ((int)InventoryType.LSL == item.InvType) | ||
245 | { | ||
246 | RemoveScriptInstance(item.ItemID, sceneObjectBeingDeleted); | ||
247 | } | ||
248 | } | ||
249 | } | ||
250 | } | 233 | } |
251 | 234 | ||
252 | /// <summary> | 235 | /// <summary> |
@@ -259,7 +242,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | // m_log.InfoFormat( | 242 | // m_log.InfoFormat( |
260 | // "[PRIM INVENTORY]: " + | 243 | // "[PRIM INVENTORY]: " + |
261 | // "Starting script {0}, {1} in prim {2}, {3}", | 244 | // "Starting script {0}, {1} in prim {2}, {3}", |
262 | // item.Name, item.ItemID, m_part.Name, m_part.UUID); | 245 | // item.Name, item.ItemID, Name, UUID); |
263 | 246 | ||
264 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) | 247 | if (!m_part.ParentGroup.Scene.Permissions.CanRunScript(item.ItemID, m_part.UUID, item.OwnerID)) |
265 | return; | 248 | return; |
@@ -295,20 +278,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
295 | } | 278 | } |
296 | else | 279 | else |
297 | { | 280 | { |
281 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
282 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
283 | |||
298 | lock (m_items) | 284 | lock (m_items) |
299 | { | 285 | { |
300 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
301 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
302 | |||
303 | m_items[item.ItemID].PermsMask = 0; | 286 | m_items[item.ItemID].PermsMask = 0; |
304 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 287 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
305 | |||
306 | string script = Utils.BytesToString(asset.Data); | ||
307 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
308 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
309 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
310 | m_part.ScheduleFullUpdate(); | ||
311 | } | 288 | } |
289 | |||
290 | string script = Utils.BytesToString(asset.Data); | ||
291 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
292 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
293 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
294 | m_part.ScheduleFullUpdate(); | ||
312 | } | 295 | } |
313 | } | 296 | } |
314 | } | 297 | } |
@@ -376,21 +359,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
376 | /// </param> | 359 | /// </param> |
377 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) | 360 | public void CreateScriptInstance(UUID itemId, int startParam, bool postOnRez, string engine, int stateSource) |
378 | { | 361 | { |
379 | lock (m_items) | 362 | TaskInventoryItem item = GetInventoryItem(itemId); |
380 | { | 363 | if (item != null) |
381 | if (m_items.ContainsKey(itemId)) | 364 | CreateScriptInstance(item, startParam, postOnRez, engine, stateSource); |
382 | { | 365 | else |
383 | CreateScriptInstance(m_items[itemId], startParam, postOnRez, engine, stateSource); | 366 | m_log.ErrorFormat( |
384 | } | 367 | "[PRIM INVENTORY]: " + |
385 | else | 368 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", |
386 | { | 369 | itemId, m_part.Name, m_part.UUID, |
387 | m_log.ErrorFormat( | 370 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
388 | "[PRIM INVENTORY]: " + | ||
389 | "Couldn't start script with ID {0} since it couldn't be found for prim {1}, {2} at {3} in {4}", | ||
390 | itemId, m_part.Name, m_part.UUID, | ||
391 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
392 | } | ||
393 | } | ||
394 | } | 371 | } |
395 | 372 | ||
396 | /// <summary> | 373 | /// <summary> |
@@ -431,16 +408,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | 408 | ||
432 | /// <summary> | 409 | /// <summary> |
433 | /// Check if the inventory holds an item with a given name. | 410 | /// Check if the inventory holds an item with a given name. |
434 | /// This method assumes that the task inventory is already locked. | ||
435 | /// </summary> | 411 | /// </summary> |
436 | /// <param name="name"></param> | 412 | /// <param name="name"></param> |
437 | /// <returns></returns> | 413 | /// <returns></returns> |
438 | private bool InventoryContainsName(string name) | 414 | private bool InventoryContainsName(string name) |
439 | { | 415 | { |
440 | foreach (TaskInventoryItem item in Items.Values) | 416 | lock (m_items) |
441 | { | 417 | { |
442 | if (item.Name == name) | 418 | foreach (TaskInventoryItem item in m_items.Values) |
443 | return true; | 419 | { |
420 | if (item.Name == name) | ||
421 | return true; | ||
422 | } | ||
444 | } | 423 | } |
445 | return false; | 424 | return false; |
446 | } | 425 | } |
@@ -483,12 +462,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
483 | /// <param name="item"></param> | 462 | /// <param name="item"></param> |
484 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) | 463 | public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop) |
485 | { | 464 | { |
486 | List<TaskInventoryItem> il; | 465 | List<TaskInventoryItem> il = GetInventoryItems(); |
487 | |||
488 | lock (m_items) | ||
489 | { | ||
490 | il = new List<TaskInventoryItem>(m_items.Values); | ||
491 | } | ||
492 | 466 | ||
493 | foreach (TaskInventoryItem i in il) | 467 | foreach (TaskInventoryItem i in il) |
494 | { | 468 | { |
@@ -528,14 +502,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
528 | item.GroupID = m_part.GroupID; | 502 | item.GroupID = m_part.GroupID; |
529 | 503 | ||
530 | lock (m_items) | 504 | lock (m_items) |
531 | { | ||
532 | m_items.Add(item.ItemID, item); | 505 | m_items.Add(item.ItemID, item); |
533 | 506 | ||
534 | if (allowedDrop) | 507 | if (allowedDrop) |
535 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); | 508 | m_part.TriggerScriptChangedEvent(Changed.ALLOWED_DROP); |
536 | else | 509 | else |
537 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 510 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
538 | } | ||
539 | 511 | ||
540 | m_inventorySerial++; | 512 | m_inventorySerial++; |
541 | //m_inventorySerial += 2; | 513 | //m_inventorySerial += 2; |
@@ -559,9 +531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
559 | m_items.Add(item.ItemID, item); | 531 | m_items.Add(item.ItemID, item); |
560 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 532 | // m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
561 | } | 533 | } |
534 | m_inventorySerial++; | ||
562 | } | 535 | } |
563 | |||
564 | m_inventorySerial++; | ||
565 | } | 536 | } |
566 | 537 | ||
567 | /// <summary> | 538 | /// <summary> |
@@ -616,45 +587,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
616 | 587 | ||
617 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | 588 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) |
618 | { | 589 | { |
619 | lock(m_items) | 590 | TaskInventoryItem it = GetInventoryItem(item.ItemID); |
591 | if (it != null) | ||
620 | { | 592 | { |
621 | if (m_items.ContainsKey(item.ItemID)) | 593 | item.ParentID = m_part.UUID; |
622 | { | 594 | item.ParentPartID = m_part.UUID; |
623 | if (m_items.ContainsKey(item.ItemID)) | 595 | item.Flags = m_items[item.ItemID].Flags; |
624 | { | 596 | |
625 | item.ParentID = m_part.UUID; | 597 | // If group permissions have been set on, check that the groupID is up to date in case it has |
626 | item.ParentPartID = m_part.UUID; | 598 | // changed since permissions were last set. |
627 | item.Flags = m_items[item.ItemID].Flags; | 599 | if (item.GroupPermissions != (uint)PermissionMask.None) |
628 | 600 | item.GroupID = m_part.GroupID; | |
629 | // If group permissions have been set on, check that the groupID is up to date in case it has | 601 | |
630 | // changed since permissions were last set. | 602 | if (item.AssetID == UUID.Zero) |
631 | if (item.GroupPermissions != (uint)PermissionMask.None) | 603 | item.AssetID = it.AssetID; |
632 | item.GroupID = m_part.GroupID; | ||
633 | |||
634 | if (item.AssetID == UUID.Zero) | ||
635 | { | ||
636 | item.AssetID = m_items[item.ItemID].AssetID; | ||
637 | } | ||
638 | m_items[item.ItemID] = item; | ||
639 | m_inventorySerial++; | ||
640 | if (fireScriptEvents) | ||
641 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
642 | HasInventoryChanged = true; | ||
643 | m_part.ParentGroup.HasGroupChanged = true; | ||
644 | return true; | ||
645 | } | ||
646 | else | ||
647 | { | ||
648 | m_log.ErrorFormat( | ||
649 | "[PRIM INVENTORY]: " + | ||
650 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
651 | item.ItemID, m_part.Name, m_part.UUID, | ||
652 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
653 | } | ||
654 | 604 | ||
605 | lock (m_items) | ||
606 | { | ||
607 | m_items[item.ItemID] = item; | ||
608 | m_inventorySerial++; | ||
655 | } | 609 | } |
656 | return false; | 610 | |
611 | if (fireScriptEvents) | ||
612 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
613 | |||
614 | HasInventoryChanged = true; | ||
615 | m_part.ParentGroup.HasGroupChanged = true; | ||
616 | return true; | ||
657 | } | 617 | } |
618 | else | ||
619 | { | ||
620 | m_log.ErrorFormat( | ||
621 | "[PRIM INVENTORY]: " + | ||
622 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
623 | item.ItemID, m_part.Name, m_part.UUID, | ||
624 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
625 | } | ||
626 | return false; | ||
627 | |||
658 | } | 628 | } |
659 | 629 | ||
660 | /// <summary> | 630 | /// <summary> |
@@ -665,52 +635,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
665 | /// in this prim's inventory.</returns> | 635 | /// in this prim's inventory.</returns> |
666 | public int RemoveInventoryItem(UUID itemID) | 636 | public int RemoveInventoryItem(UUID itemID) |
667 | { | 637 | { |
668 | lock (m_items) | 638 | TaskInventoryItem item = GetInventoryItem(itemID); |
639 | if (item != null) | ||
669 | { | 640 | { |
670 | if (m_items.ContainsKey(itemID)) | 641 | int type = m_items[itemID].InvType; |
642 | if (type == 10) // Script | ||
671 | { | 643 | { |
672 | int type = m_items[itemID].InvType; | 644 | m_part.RemoveScriptEvents(itemID); |
673 | if (type == 10) // Script | 645 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); |
674 | { | 646 | } |
675 | m_part.RemoveScriptEvents(itemID); | 647 | m_items.Remove(itemID); |
676 | m_part.ParentGroup.Scene.EventManager.TriggerRemoveScript(m_part.LocalId, itemID); | 648 | m_inventorySerial++; |
677 | } | 649 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
678 | m_items.Remove(itemID); | ||
679 | m_inventorySerial++; | ||
680 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
681 | |||
682 | HasInventoryChanged = true; | ||
683 | m_part.ParentGroup.HasGroupChanged = true; | ||
684 | 650 | ||
685 | int scriptcount = 0; | 651 | HasInventoryChanged = true; |
686 | lock (m_items) | 652 | m_part.ParentGroup.HasGroupChanged = true; |
687 | { | ||
688 | foreach (TaskInventoryItem item in m_items.Values) | ||
689 | { | ||
690 | if (item.Type == 10) | ||
691 | { | ||
692 | scriptcount++; | ||
693 | } | ||
694 | } | ||
695 | } | ||
696 | 653 | ||
697 | if (scriptcount <= 0) | 654 | if (!ContainsScripts()) |
698 | { | 655 | m_part.RemFlag(PrimFlags.Scripted); |
699 | m_part.RemFlag(PrimFlags.Scripted); | ||
700 | } | ||
701 | 656 | ||
702 | m_part.ScheduleFullUpdate(); | 657 | m_part.ScheduleFullUpdate(); |
703 | 658 | ||
704 | return type; | 659 | return type; |
705 | } | 660 | |
706 | else | 661 | } |
707 | { | 662 | else |
708 | m_log.ErrorFormat( | 663 | { |
709 | "[PRIM INVENTORY]: " + | 664 | m_log.ErrorFormat( |
710 | "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | 665 | "[PRIM INVENTORY]: " + |
711 | itemID, m_part.Name, m_part.UUID, | 666 | "Tried to remove item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", |
712 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | 667 | itemID, m_part.Name, m_part.UUID, |
713 | } | 668 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); |
714 | } | 669 | } |
715 | 670 | ||
716 | return -1; | 671 | return -1; |
@@ -764,52 +719,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
764 | // isn't available (such as drag from prim inventory to agent inventory) | 719 | // isn't available (such as drag from prim inventory to agent inventory) |
765 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 720 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
766 | 721 | ||
767 | lock (m_items) | 722 | List<TaskInventoryItem> items = GetInventoryItems(); |
723 | foreach (TaskInventoryItem item in items) | ||
768 | { | 724 | { |
769 | foreach (TaskInventoryItem item in m_items.Values) | 725 | UUID ownerID = item.OwnerID; |
770 | { | 726 | uint everyoneMask = 0; |
771 | UUID ownerID = item.OwnerID; | 727 | uint baseMask = item.BasePermissions; |
772 | uint everyoneMask = 0; | 728 | uint ownerMask = item.CurrentPermissions; |
773 | uint baseMask = item.BasePermissions; | 729 | uint groupMask = item.GroupPermissions; |
774 | uint ownerMask = item.CurrentPermissions; | ||
775 | uint groupMask = item.GroupPermissions; | ||
776 | 730 | ||
777 | invString.AddItemStart(); | 731 | invString.AddItemStart(); |
778 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 732 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
779 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | 733 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); |
780 | 734 | ||
781 | invString.AddPermissionsStart(); | 735 | invString.AddPermissionsStart(); |
782 | 736 | ||
783 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 737 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
784 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 738 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); |
785 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); | 739 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); |
786 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 740 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); |
787 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | 741 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); |
788 | 742 | ||
789 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 743 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
790 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | 744 | invString.AddNameValueLine("owner_id", ownerID.ToString()); |
791 | 745 | ||
792 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 746 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
793 | 747 | ||
794 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 748 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
795 | invString.AddSectionEnd(); | 749 | invString.AddSectionEnd(); |
796 | 750 | ||
797 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 751 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); |
798 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 752 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); |
799 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | 753 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); |
800 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | 754 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); |
801 | 755 | ||
802 | invString.AddSaleStart(); | 756 | invString.AddSaleStart(); |
803 | invString.AddNameValueLine("sale_type", "not"); | 757 | invString.AddNameValueLine("sale_type", "not"); |
804 | invString.AddNameValueLine("sale_price", "0"); | 758 | invString.AddNameValueLine("sale_price", "0"); |
805 | invString.AddSectionEnd(); | 759 | invString.AddSectionEnd(); |
806 | 760 | ||
807 | invString.AddNameValueLine("name", item.Name + "|"); | 761 | invString.AddNameValueLine("name", item.Name + "|"); |
808 | invString.AddNameValueLine("desc", item.Description + "|"); | 762 | invString.AddNameValueLine("desc", item.Description + "|"); |
809 | 763 | ||
810 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | 764 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
811 | invString.AddSectionEnd(); | 765 | invString.AddSectionEnd(); |
812 | } | ||
813 | } | 766 | } |
814 | 767 | ||
815 | fileData = Utils.StringToBytes(invString.BuildString); | 768 | fileData = Utils.StringToBytes(invString.BuildString); |
@@ -831,12 +784,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
831 | { | 784 | { |
832 | if (HasInventoryChanged) | 785 | if (HasInventoryChanged) |
833 | { | 786 | { |
834 | lock (Items) | ||
835 | { | ||
836 | datastore.StorePrimInventory(m_part.UUID, Items.Values); | ||
837 | } | ||
838 | |||
839 | HasInventoryChanged = false; | 787 | HasInventoryChanged = false; |
788 | List<TaskInventoryItem> items = GetInventoryItems(); | ||
789 | datastore.StorePrimInventory(m_part.UUID, items); | ||
790 | |||
840 | } | 791 | } |
841 | } | 792 | } |
842 | 793 | ||
@@ -952,7 +903,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
952 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; | 903 | item.CurrentPermissions &= ~(uint)PermissionMask.Transfer; |
953 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) | 904 | if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0) |
954 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; | 905 | item.CurrentPermissions &= ~(uint)PermissionMask.Modify; |
955 | item.CurrentPermissions |= 8; | ||
956 | } | 906 | } |
957 | item.CurrentPermissions &= item.NextPermissions; | 907 | item.CurrentPermissions &= item.NextPermissions; |
958 | item.BasePermissions &= item.NextPermissions; | 908 | item.BasePermissions &= item.NextPermissions; |
@@ -1002,6 +952,30 @@ namespace OpenSim.Region.Framework.Scenes | |||
1002 | 952 | ||
1003 | return ret; | 953 | return ret; |
1004 | } | 954 | } |
955 | |||
956 | public List<TaskInventoryItem> GetInventoryItems() | ||
957 | { | ||
958 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | ||
959 | |||
960 | lock (m_items) | ||
961 | ret = new List<TaskInventoryItem>(m_items.Values); | ||
962 | |||
963 | return ret; | ||
964 | } | ||
965 | |||
966 | public List<TaskInventoryItem> GetInventoryScripts() | ||
967 | { | ||
968 | List<TaskInventoryItem> ret = new List<TaskInventoryItem>(); | ||
969 | |||
970 | lock (m_items) | ||
971 | { | ||
972 | foreach (TaskInventoryItem item in m_items.Values) | ||
973 | if (item.InvType == (int)InventoryType.LSL) | ||
974 | ret.Add(item); | ||
975 | } | ||
976 | |||
977 | return ret; | ||
978 | } | ||
1005 | 979 | ||
1006 | public Dictionary<UUID, string> GetScriptStates() | 980 | public Dictionary<UUID, string> GetScriptStates() |
1007 | { | 981 | { |
@@ -1011,24 +985,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1011 | if (engines == null) // No engine at all | 985 | if (engines == null) // No engine at all |
1012 | return ret; | 986 | return ret; |
1013 | 987 | ||
1014 | lock (m_items) | 988 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
989 | |||
990 | foreach (TaskInventoryItem item in scripts) | ||
1015 | { | 991 | { |
1016 | foreach (TaskInventoryItem item in m_items.Values) | 992 | foreach (IScriptModule e in engines) |
1017 | { | 993 | { |
1018 | if (item.InvType == (int)InventoryType.LSL) | 994 | if (e != null) |
1019 | { | 995 | { |
1020 | foreach (IScriptModule e in engines) | 996 | string n = e.GetXMLState(item.ItemID); |
997 | if (n != String.Empty) | ||
1021 | { | 998 | { |
1022 | if (e != null) | 999 | if (!ret.ContainsKey(item.ItemID)) |
1023 | { | 1000 | ret[item.ItemID] = n; |
1024 | string n = e.GetXMLState(item.ItemID); | 1001 | break; |
1025 | if (n != String.Empty) | ||
1026 | { | ||
1027 | if (!ret.ContainsKey(item.ItemID)) | ||
1028 | ret[item.ItemID] = n; | ||
1029 | break; | ||
1030 | } | ||
1031 | } | ||
1032 | } | 1002 | } |
1033 | } | 1003 | } |
1034 | } | 1004 | } |
@@ -1043,25 +1013,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
1043 | if (engines == null) | 1013 | if (engines == null) |
1044 | return; | 1014 | return; |
1045 | 1015 | ||
1046 | lock (m_items) | 1016 | List<TaskInventoryItem> scripts = GetInventoryScripts(); |
1017 | |||
1018 | foreach (TaskInventoryItem item in scripts) | ||
1047 | { | 1019 | { |
1048 | foreach (TaskInventoryItem item in m_items.Values) | 1020 | foreach (IScriptModule engine in engines) |
1049 | { | 1021 | { |
1050 | if (item.InvType == (int)InventoryType.LSL) | 1022 | if (engine != null) |
1051 | { | 1023 | { |
1052 | foreach (IScriptModule engine in engines) | 1024 | if (item.OwnerChanged) |
1053 | { | 1025 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); |
1054 | if (engine != null) | 1026 | item.OwnerChanged = false; |
1055 | { | 1027 | engine.ResumeScript(item.ItemID); |
1056 | if (item.OwnerChanged) | ||
1057 | engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); | ||
1058 | item.OwnerChanged = false; | ||
1059 | engine.ResumeScript(item.ItemID); | ||
1060 | } | ||
1061 | } | ||
1062 | } | 1028 | } |
1063 | } | 1029 | } |
1064 | } | 1030 | } |
1065 | } | 1031 | } |
1032 | |||
1066 | } | 1033 | } |
1067 | } | 1034 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6c119c2..1e8ce22 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -60,7 +60,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
60 | struct ScriptControllers | 60 | struct ScriptControllers |
61 | { | 61 | { |
62 | public UUID itemID; | 62 | public UUID itemID; |
63 | public uint objID; | ||
64 | public ScriptControlled ignoreControls; | 63 | public ScriptControlled ignoreControls; |
65 | public ScriptControlled eventControls; | 64 | public ScriptControlled eventControls; |
66 | } | 65 | } |
@@ -3057,6 +3056,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
3057 | cAgent.Attachments = attachs; | 3056 | cAgent.Attachments = attachs; |
3058 | } | 3057 | } |
3059 | 3058 | ||
3059 | lock (scriptedcontrols) | ||
3060 | { | ||
3061 | ControllerData[] controls = new ControllerData[scriptedcontrols.Count]; | ||
3062 | int i = 0; | ||
3063 | |||
3064 | foreach (ScriptControllers c in scriptedcontrols.Values) | ||
3065 | { | ||
3066 | controls[i++] = new ControllerData(c.itemID, (uint)c.ignoreControls, (uint)c.eventControls); | ||
3067 | } | ||
3068 | cAgent.Controllers = controls; | ||
3069 | } | ||
3070 | |||
3060 | // Animations | 3071 | // Animations |
3061 | try | 3072 | try |
3062 | { | 3073 | { |
@@ -3137,6 +3148,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
3137 | } | 3148 | } |
3138 | catch { } | 3149 | catch { } |
3139 | 3150 | ||
3151 | try | ||
3152 | { | ||
3153 | lock (scriptedcontrols) | ||
3154 | { | ||
3155 | if (cAgent.Controllers != null) | ||
3156 | { | ||
3157 | scriptedcontrols.Clear(); | ||
3158 | |||
3159 | foreach (ControllerData c in cAgent.Controllers) | ||
3160 | { | ||
3161 | ScriptControllers sc = new ScriptControllers(); | ||
3162 | sc.itemID = c.ItemID; | ||
3163 | sc.ignoreControls = (ScriptControlled)c.IgnoreControls; | ||
3164 | sc.eventControls = (ScriptControlled)c.EventControls; | ||
3165 | |||
3166 | scriptedcontrols[sc.itemID] = sc; | ||
3167 | } | ||
3168 | } | ||
3169 | } | ||
3170 | } | ||
3171 | catch { } | ||
3140 | // Animations | 3172 | // Animations |
3141 | try | 3173 | try |
3142 | { | 3174 | { |
@@ -3468,7 +3500,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3468 | obj.eventControls = ScriptControlled.CONTROL_ZERO; | 3500 | obj.eventControls = ScriptControlled.CONTROL_ZERO; |
3469 | 3501 | ||
3470 | obj.itemID = Script_item_UUID; | 3502 | obj.itemID = Script_item_UUID; |
3471 | obj.objID = Obj_localID; | ||
3472 | if (pass_on == 0 && accept == 0) | 3503 | if (pass_on == 0 && accept == 0) |
3473 | { | 3504 | { |
3474 | IgnoredControls |= (ScriptControlled)controls; | 3505 | IgnoredControls |= (ScriptControlled)controls; |
@@ -3611,7 +3642,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3611 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) | 3642 | if (localHeld != ScriptControlled.CONTROL_ZERO || localChange != ScriptControlled.CONTROL_ZERO) |
3612 | { | 3643 | { |
3613 | // only send if still pressed or just changed | 3644 | // only send if still pressed or just changed |
3614 | m_scene.EventManager.TriggerControlEvent(scriptControlData.objID, scriptUUID, UUID, (uint)localHeld, (uint)localChange); | 3645 | m_scene.EventManager.TriggerControlEvent(scriptUUID, UUID, (uint)localHeld, (uint)localChange); |
3615 | } | 3646 | } |
3616 | } | 3647 | } |
3617 | } | 3648 | } |