diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | 184 |
1 files changed, 92 insertions, 92 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs index e1be8ff..cce263c 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.Inventory.cs | |||
@@ -67,7 +67,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
67 | 67 | ||
68 | /// <summary> | 68 | /// <summary> |
69 | /// Holds in memory prim inventory | 69 | /// Holds in memory prim inventory |
70 | /// </summary> | 70 | /// </summary> |
71 | protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); | 71 | protected TaskInventoryDictionary m_taskInventory = new TaskInventoryDictionary(); |
72 | 72 | ||
73 | public TaskInventoryDictionary TaskInventory | 73 | public TaskInventoryDictionary TaskInventory |
@@ -84,21 +84,21 @@ namespace OpenSim.Region.Environment.Scenes | |||
84 | /// <summary> | 84 | /// <summary> |
85 | /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating | 85 | /// Reset LLUUIDs for all the items in the prim's inventory. This involves either generating |
86 | /// new ones or setting existing UUIDs to the correct parent UUIDs. | 86 | /// new ones or setting existing UUIDs to the correct parent UUIDs. |
87 | /// | 87 | /// |
88 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. | 88 | /// If this method is called and there are inventory items, then we regard the inventory as having changed. |
89 | /// </summary> | 89 | /// </summary> |
90 | /// <param name="linkNum">Link number for the part</param> | 90 | /// <param name="linkNum">Link number for the part</param> |
91 | public void ResetInventoryIDs() | 91 | public void ResetInventoryIDs() |
92 | { | 92 | { |
93 | lock (TaskInventory) | 93 | lock (TaskInventory) |
94 | { | 94 | { |
95 | if (0 == TaskInventory.Count) | 95 | if (0 == TaskInventory.Count) |
96 | { | 96 | { |
97 | return; | 97 | return; |
98 | } | 98 | } |
99 | 99 | ||
100 | HasInventoryChanged = true; | 100 | HasInventoryChanged = true; |
101 | 101 | ||
102 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); | 102 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(TaskInventory.Values); |
103 | TaskInventory.Clear(); | 103 | TaskInventory.Clear(); |
104 | 104 | ||
@@ -127,7 +127,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
127 | if (ownerId != item.OwnerID) | 127 | if (ownerId != item.OwnerID) |
128 | { | 128 | { |
129 | item.LastOwnerID = item.OwnerID; | 129 | item.LastOwnerID = item.OwnerID; |
130 | item.OwnerID = ownerId; | 130 | item.OwnerID = ownerId; |
131 | } | 131 | } |
132 | } | 132 | } |
133 | } | 133 | } |
@@ -178,7 +178,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
178 | { | 178 | { |
179 | // m_log.InfoFormat( | 179 | // m_log.InfoFormat( |
180 | // "[PRIM INVENTORY]: " + | 180 | // "[PRIM INVENTORY]: " + |
181 | // "Starting script {0}, {1} in prim {2}, {3}", | 181 | // "Starting script {0}, {1} in prim {2}, {3}", |
182 | // item.Name, item.ItemID, Name, UUID); | 182 | // item.Name, item.ItemID, Name, UUID); |
183 | AddFlag(LLObject.ObjectFlags.Scripted); | 183 | AddFlag(LLObject.ObjectFlags.Scripted); |
184 | 184 | ||
@@ -211,7 +211,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
211 | /// </summary> | 211 | /// </summary> |
212 | /// <param name="itemId"> | 212 | /// <param name="itemId"> |
213 | /// A <see cref="LLUUID"/> | 213 | /// A <see cref="LLUUID"/> |
214 | /// </param> | 214 | /// </param> |
215 | public void StartScript(LLUUID itemId) | 215 | public void StartScript(LLUUID itemId) |
216 | { | 216 | { |
217 | lock (m_taskInventory) | 217 | lock (m_taskInventory) |
@@ -234,7 +234,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
234 | /// <summary> | 234 | /// <summary> |
235 | /// Stop a script which is in this prim's inventory. | 235 | /// Stop a script which is in this prim's inventory. |
236 | /// </summary> | 236 | /// </summary> |
237 | /// <param name="itemId"></param> | 237 | /// <param name="itemId"></param> |
238 | public void StopScript(LLUUID itemId) | 238 | public void StopScript(LLUUID itemId) |
239 | { | 239 | { |
240 | if (m_taskInventory.ContainsKey(itemId)) | 240 | if (m_taskInventory.ContainsKey(itemId)) |
@@ -306,9 +306,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
306 | } | 306 | } |
307 | 307 | ||
308 | /// <summary> | 308 | /// <summary> |
309 | /// Restore a whole collection of items to the prim's inventory at once. | 309 | /// Restore a whole collection of items to the prim's inventory at once. |
310 | /// We assume that the items already have all their fields correctly filled out. | 310 | /// We assume that the items already have all their fields correctly filled out. |
311 | /// The items are not flagged for persistence to the database, since they are being restored | 311 | /// The items are not flagged for persistence to the database, since they are being restored |
312 | /// from persistence rather than being newly added. | 312 | /// from persistence rather than being newly added. |
313 | /// </summary> | 313 | /// </summary> |
314 | /// <param name="items"></param> | 314 | /// <param name="items"></param> |
@@ -338,9 +338,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
338 | if (m_taskInventory.ContainsKey(itemID)) | 338 | if (m_taskInventory.ContainsKey(itemID)) |
339 | { | 339 | { |
340 | // m_log.DebugFormat( | 340 | // m_log.DebugFormat( |
341 | // "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}", | 341 | // "[PRIM INVENTORY]: Retrieved task inventory item {0}, {1} from prim {2}, {3}", |
342 | // m_taskInventory[itemID].Name, itemID, Name, UUID); | 342 | // m_taskInventory[itemID].Name, itemID, Name, UUID); |
343 | 343 | ||
344 | return m_taskInventory[itemID]; | 344 | return m_taskInventory[itemID]; |
345 | } | 345 | } |
346 | else | 346 | else |
@@ -450,11 +450,11 @@ namespace OpenSim.Region.Environment.Scenes | |||
450 | /// <param name="client"></param> | 450 | /// <param name="client"></param> |
451 | /// <param name="localID"></param> | 451 | /// <param name="localID"></param> |
452 | public bool GetInventoryFileName(IClientAPI client, uint localID) | 452 | public bool GetInventoryFileName(IClientAPI client, uint localID) |
453 | { | 453 | { |
454 | // m_log.DebugFormat( | 454 | // m_log.DebugFormat( |
455 | // "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", | 455 | // "[PRIM INVENTORY]: Received request from client {0} for inventory file name of {1}, {2}", |
456 | // client.AgentId, Name, UUID); | 456 | // client.AgentId, Name, UUID); |
457 | 457 | ||
458 | if (m_inventorySerial > 0) | 458 | if (m_inventorySerial > 0) |
459 | { | 459 | { |
460 | client.SendTaskInventory(m_uuid, (short)m_inventorySerial, | 460 | client.SendTaskInventory(m_uuid, (short)m_inventorySerial, |
@@ -473,9 +473,9 @@ namespace OpenSim.Region.Environment.Scenes | |||
473 | /// </summary> | 473 | /// </summary> |
474 | /// <param name="xferManager"></param> | 474 | /// <param name="xferManager"></param> |
475 | public void RequestInventoryFile(IXfer xferManager) | 475 | public void RequestInventoryFile(IXfer xferManager) |
476 | { | 476 | { |
477 | byte[] fileData = new byte[0]; | 477 | byte[] fileData = new byte[0]; |
478 | 478 | ||
479 | // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches | 479 | // Confusingly, the folder item has to be the object id, while the 'parent id' has to be zero. This matches |
480 | // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality | 480 | // what appears to happen in the Second Life protocol. If this isn't the case. then various functionality |
481 | // isn't available (such as drag from prim inventory to agent inventory) | 481 | // isn't available (such as drag from prim inventory to agent inventory) |
@@ -486,39 +486,39 @@ namespace OpenSim.Region.Environment.Scenes | |||
486 | foreach (TaskInventoryItem item in m_taskInventory.Values) | 486 | foreach (TaskInventoryItem item in m_taskInventory.Values) |
487 | { | 487 | { |
488 | invString.AddItemStart(); | 488 | invString.AddItemStart(); |
489 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 489 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); |
490 | invString.AddNameValueLine("parent_id", UUID.ToString()); | 490 | invString.AddNameValueLine("parent_id", UUID.ToString()); |
491 | 491 | ||
492 | invString.AddPermissionsStart(); | 492 | invString.AddPermissionsStart(); |
493 | 493 | ||
494 | invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask)); | 494 | invString.AddNameValueLine("base_mask", Helpers.UIntToHexString(item.BaseMask)); |
495 | invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask)); | 495 | invString.AddNameValueLine("owner_mask", Helpers.UIntToHexString(item.OwnerMask)); |
496 | invString.AddNameValueLine("group_mask", "00000000"); | 496 | invString.AddNameValueLine("group_mask", "00000000"); |
497 | invString.AddNameValueLine("everyone_mask", "00000000"); | 497 | invString.AddNameValueLine("everyone_mask", "00000000"); |
498 | invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); | 498 | invString.AddNameValueLine("next_owner_mask", Helpers.UIntToHexString(item.NextOwnerMask)); |
499 | 499 | ||
500 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 500 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
501 | invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); | 501 | invString.AddNameValueLine("owner_id", item.OwnerID.ToString()); |
502 | 502 | ||
503 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 503 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
504 | // invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString()); | 504 | // invString.AddNameValueLine("last_owner_id", item.OwnerID.ToString()); |
505 | 505 | ||
506 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 506 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
507 | invString.AddSectionEnd(); | 507 | invString.AddSectionEnd(); |
508 | 508 | ||
509 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 509 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); |
510 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 510 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); |
511 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | 511 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); |
512 | invString.AddNameValueLine("flags", "00000000"); | 512 | invString.AddNameValueLine("flags", "00000000"); |
513 | 513 | ||
514 | invString.AddSaleStart(); | 514 | invString.AddSaleStart(); |
515 | invString.AddNameValueLine("sale_type", "not"); | 515 | invString.AddNameValueLine("sale_type", "not"); |
516 | invString.AddNameValueLine("sale_price", "0"); | 516 | invString.AddNameValueLine("sale_price", "0"); |
517 | invString.AddSectionEnd(); | 517 | invString.AddSectionEnd(); |
518 | 518 | ||
519 | invString.AddNameValueLine("name", item.Name + "|"); | 519 | invString.AddNameValueLine("name", item.Name + "|"); |
520 | invString.AddNameValueLine("desc", item.Description + "|"); | 520 | invString.AddNameValueLine("desc", item.Description + "|"); |
521 | 521 | ||
522 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | 522 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
523 | invString.AddSectionEnd(); | 523 | invString.AddSectionEnd(); |
524 | } | 524 | } |
@@ -576,13 +576,13 @@ namespace OpenSim.Region.Environment.Scenes | |||
576 | BuildString += "\tpermissions 0\n"; | 576 | BuildString += "\tpermissions 0\n"; |
577 | AddSectionStart(); | 577 | AddSectionStart(); |
578 | } | 578 | } |
579 | 579 | ||
580 | public void AddSaleStart() | 580 | public void AddSaleStart() |
581 | { | 581 | { |
582 | BuildString += "\tsale_info\t0\n"; | 582 | BuildString += "\tsale_info\t0\n"; |
583 | AddSectionStart(); | 583 | AddSectionStart(); |
584 | } | 584 | } |
585 | 585 | ||
586 | protected void AddSectionStart() | 586 | protected void AddSectionStart() |
587 | { | 587 | { |
588 | BuildString += "\t{\n"; | 588 | BuildString += "\t{\n"; |
@@ -610,64 +610,64 @@ namespace OpenSim.Region.Environment.Scenes | |||
610 | } | 610 | } |
611 | } | 611 | } |
612 | 612 | ||
613 | public uint MaskEffectivePermissions() | 613 | public uint MaskEffectivePermissions() |
614 | { | 614 | { |
615 | uint mask=0x7fffffff; | 615 | uint mask=0x7fffffff; |
616 | 616 | ||
617 | foreach (TaskInventoryItem item in m_taskInventory.Values) | 617 | foreach (TaskInventoryItem item in m_taskInventory.Values) |
618 | { | 618 | { |
619 | if(item.InvType != 6) | 619 | if (item.InvType != 6) |
620 | { | 620 | { |
621 | if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Copy) == 0) | 621 | if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Copy) == 0) |
622 | mask &= ~((uint)PermissionMask.Copy >> 13); | 622 | mask &= ~((uint)PermissionMask.Copy >> 13); |
623 | if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) | 623 | if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Transfer) == 0) |
624 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 624 | mask &= ~((uint)PermissionMask.Transfer >> 13); |
625 | if((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Modify) == 0) | 625 | if ((item.OwnerMask & item.NextOwnerMask & (uint)PermissionMask.Modify) == 0) |
626 | mask &= ~((uint)PermissionMask.Modify >> 13); | 626 | mask &= ~((uint)PermissionMask.Modify >> 13); |
627 | } | 627 | } |
628 | else | 628 | else |
629 | { | 629 | { |
630 | if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) | 630 | if ((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) |
631 | mask &= ~((uint)PermissionMask.Copy >> 13); | 631 | mask &= ~((uint)PermissionMask.Copy >> 13); |
632 | if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) | 632 | if ((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) |
633 | mask &= ~((uint)PermissionMask.Transfer >> 13); | 633 | mask &= ~((uint)PermissionMask.Transfer >> 13); |
634 | if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) | 634 | if ((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) |
635 | mask &= ~((uint)PermissionMask.Modify >> 13); | 635 | mask &= ~((uint)PermissionMask.Modify >> 13); |
636 | } | 636 | } |
637 | 637 | ||
638 | if((item.OwnerMask & (uint)PermissionMask.Copy) == 0) | 638 | if ((item.OwnerMask & (uint)PermissionMask.Copy) == 0) |
639 | mask &= ~(uint)PermissionMask.Copy; | 639 | mask &= ~(uint)PermissionMask.Copy; |
640 | if((item.OwnerMask & (uint)PermissionMask.Transfer) == 0) | 640 | if ((item.OwnerMask & (uint)PermissionMask.Transfer) == 0) |
641 | mask &= ~(uint)PermissionMask.Transfer; | 641 | mask &= ~(uint)PermissionMask.Transfer; |
642 | if((item.OwnerMask & (uint)PermissionMask.Modify) == 0) | 642 | if ((item.OwnerMask & (uint)PermissionMask.Modify) == 0) |
643 | mask &= ~(uint)PermissionMask.Modify; | 643 | mask &= ~(uint)PermissionMask.Modify; |
644 | } | 644 | } |
645 | return mask; | 645 | return mask; |
646 | } | 646 | } |
647 | 647 | ||
648 | public void ApplyNextOwnerPermissions() | 648 | public void ApplyNextOwnerPermissions() |
649 | { | 649 | { |
650 | BaseMask &= NextOwnerMask; | 650 | BaseMask &= NextOwnerMask; |
651 | OwnerMask &= NextOwnerMask; | 651 | OwnerMask &= NextOwnerMask; |
652 | EveryoneMask &= NextOwnerMask; | 652 | EveryoneMask &= NextOwnerMask; |
653 | 653 | ||
654 | foreach (TaskInventoryItem item in m_taskInventory.Values) | 654 | foreach (TaskInventoryItem item in m_taskInventory.Values) |
655 | { | 655 | { |
656 | if(item.InvType == 6) | 656 | if (item.InvType == 6) |
657 | { | 657 | { |
658 | if((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) | 658 | if ((item.OwnerMask & ((uint)PermissionMask.Copy >> 13)) == 0) |
659 | item.OwnerMask &= ~(uint)PermissionMask.Copy; | 659 | item.OwnerMask &= ~(uint)PermissionMask.Copy; |
660 | if((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) | 660 | if ((item.OwnerMask & ((uint)PermissionMask.Transfer >> 13)) == 0) |
661 | item.OwnerMask &= ~(uint)PermissionMask.Transfer; | 661 | item.OwnerMask &= ~(uint)PermissionMask.Transfer; |
662 | if((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) | 662 | if ((item.OwnerMask & ((uint)PermissionMask.Modify >> 13)) == 0) |
663 | item.OwnerMask &= ~(uint)PermissionMask.Modify; | 663 | item.OwnerMask &= ~(uint)PermissionMask.Modify; |
664 | } | 664 | } |
665 | item.OwnerMask &= item.NextOwnerMask; | 665 | item.OwnerMask &= item.NextOwnerMask; |
666 | item.BaseMask &= item.NextOwnerMask; | 666 | item.BaseMask &= item.NextOwnerMask; |
667 | item.EveryoneMask &= item.NextOwnerMask; | 667 | item.EveryoneMask &= item.NextOwnerMask; |
668 | } | 668 | } |
669 | 669 | ||
670 | TriggerScriptChangedEvent(Changed.OWNER); | 670 | TriggerScriptChangedEvent(Changed.OWNER); |
671 | } | 671 | } |
672 | } | 672 | } |
673 | } | 673 | } |