diff options
author | Diva Canto | 2010-12-24 08:50:00 -0800 |
---|---|---|
committer | Diva Canto | 2010-12-24 08:50:00 -0800 |
commit | 3eaaaa0d994c7c994d471d511127ed0ba66ab9bc (patch) | |
tree | 94f784b0cc76ebe3c527657a8af3b5621bf212fd /OpenSim/Region/Framework | |
parent | Hopefully this fixes all prim inventory issues. No more abort, no more keepin... (diff) | |
download | opensim-SC_OLD-3eaaaa0d994c7c994d471d511127ed0ba66ab9bc.zip opensim-SC_OLD-3eaaaa0d994c7c994d471d511127ed0ba66ab9bc.tar.gz opensim-SC_OLD-3eaaaa0d994c7c994d471d511127ed0ba66ab9bc.tar.bz2 opensim-SC_OLD-3eaaaa0d994c7c994d471d511127ed0ba66ab9bc.tar.xz |
One more pass at object inventory. This time, fix SceneObjectPartInventory so that it makes sure that the file is added to Xfer's before it signals the client to come and get it. This allows the simplification of the logic of Xfer's.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 1177378..39ebaef 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -766,102 +766,102 @@ namespace OpenSim.Region.Framework.Scenes | |||
766 | return -1; | 766 | return -1; |
767 | } | 767 | } |
768 | 768 | ||
769 | private bool CreateInventoryFileName() | 769 | private bool CreateInventoryFile() |
770 | { | 770 | { |
771 | if (m_inventoryFileName == String.Empty || | 771 | if (m_inventoryFileName == String.Empty || |
772 | m_inventoryFileNameSerial < m_inventorySerial) | 772 | m_inventoryFileNameSerial < m_inventorySerial) |
773 | { | 773 | { |
774 | // Something changed, we need to create a new file | ||
774 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; | 775 | m_inventoryFileName = "inventory_" + UUID.Random().ToString() + ".tmp"; |
775 | m_inventoryFileNameSerial = m_inventorySerial; | 776 | m_inventoryFileNameSerial = m_inventorySerial; |
776 | return true; | ||
777 | } | ||
778 | 777 | ||
779 | return false; | 778 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); |
780 | } | ||
781 | 779 | ||
782 | /// <summary> | 780 | lock (m_items) |
783 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client | 781 | { |
784 | /// </summary> | 782 | foreach (TaskInventoryItem item in m_items.Values) |
785 | /// <param name="xferManager"></param> | 783 | { |
786 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | 784 | UUID ownerID = item.OwnerID; |
787 | { | 785 | uint everyoneMask = 0; |
788 | bool changed = CreateInventoryFileName(); | 786 | uint baseMask = item.BasePermissions; |
787 | uint ownerMask = item.CurrentPermissions; | ||
788 | uint groupMask = item.GroupPermissions; | ||
789 | 789 | ||
790 | InventoryStringBuilder invString = new InventoryStringBuilder(m_part.UUID, UUID.Zero); | 790 | invString.AddItemStart(); |
791 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | ||
792 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | ||
791 | 793 | ||
792 | lock (m_items) | 794 | invString.AddPermissionsStart(); |
793 | { | ||
794 | if (m_inventorySerial == 0) // No inventory | ||
795 | { | ||
796 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); | ||
797 | return; | ||
798 | } | ||
799 | 795 | ||
800 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | 796 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); |
801 | Util.StringToBytes256(m_inventoryFileName)); | 797 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); |
798 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); | ||
799 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | ||
800 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | ||
802 | 801 | ||
803 | if (!changed) | 802 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); |
804 | { | 803 | invString.AddNameValueLine("owner_id", ownerID.ToString()); |
805 | if (m_inventoryFileData.Length > 2) | ||
806 | { | ||
807 | xferManager.AddNewFile(m_inventoryFileName, | ||
808 | m_inventoryFileData); | ||
809 | return; | ||
810 | } | ||
811 | } | ||
812 | 804 | ||
813 | foreach (TaskInventoryItem item in m_items.Values) | 805 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); |
814 | { | ||
815 | UUID ownerID = item.OwnerID; | ||
816 | uint everyoneMask = 0; | ||
817 | uint baseMask = item.BasePermissions; | ||
818 | uint ownerMask = item.CurrentPermissions; | ||
819 | uint groupMask = item.GroupPermissions; | ||
820 | 806 | ||
821 | invString.AddItemStart(); | 807 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); |
822 | invString.AddNameValueLine("item_id", item.ItemID.ToString()); | 808 | invString.AddSectionEnd(); |
823 | invString.AddNameValueLine("parent_id", m_part.UUID.ToString()); | ||
824 | 809 | ||
825 | invString.AddPermissionsStart(); | 810 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); |
811 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | ||
812 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | ||
813 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | ||
826 | 814 | ||
827 | invString.AddNameValueLine("base_mask", Utils.UIntToHexString(baseMask)); | 815 | invString.AddSaleStart(); |
828 | invString.AddNameValueLine("owner_mask", Utils.UIntToHexString(ownerMask)); | 816 | invString.AddNameValueLine("sale_type", "not"); |
829 | invString.AddNameValueLine("group_mask", Utils.UIntToHexString(groupMask)); | 817 | invString.AddNameValueLine("sale_price", "0"); |
830 | invString.AddNameValueLine("everyone_mask", Utils.UIntToHexString(everyoneMask)); | 818 | invString.AddSectionEnd(); |
831 | invString.AddNameValueLine("next_owner_mask", Utils.UIntToHexString(item.NextPermissions)); | ||
832 | 819 | ||
833 | invString.AddNameValueLine("creator_id", item.CreatorID.ToString()); | 820 | invString.AddNameValueLine("name", item.Name + "|"); |
834 | invString.AddNameValueLine("owner_id", ownerID.ToString()); | 821 | invString.AddNameValueLine("desc", item.Description + "|"); |
835 | 822 | ||
836 | invString.AddNameValueLine("last_owner_id", item.LastOwnerID.ToString()); | 823 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); |
824 | invString.AddSectionEnd(); | ||
825 | } | ||
826 | } | ||
837 | 827 | ||
838 | invString.AddNameValueLine("group_id", item.GroupID.ToString()); | 828 | m_inventoryFileData = Utils.StringToBytes(invString.BuildString); |
839 | invString.AddSectionEnd(); | ||
840 | 829 | ||
841 | invString.AddNameValueLine("asset_id", item.AssetID.ToString()); | 830 | return true; |
842 | invString.AddNameValueLine("type", TaskInventoryItem.Types[item.Type]); | 831 | } |
843 | invString.AddNameValueLine("inv_type", TaskInventoryItem.InvTypes[item.InvType]); | ||
844 | invString.AddNameValueLine("flags", Utils.UIntToHexString(item.Flags)); | ||
845 | 832 | ||
846 | invString.AddSaleStart(); | 833 | // No need to recreate, the existing file is fine |
847 | invString.AddNameValueLine("sale_type", "not"); | 834 | return false; |
848 | invString.AddNameValueLine("sale_price", "0"); | 835 | } |
849 | invString.AddSectionEnd(); | ||
850 | 836 | ||
851 | invString.AddNameValueLine("name", item.Name + "|"); | 837 | /// <summary> |
852 | invString.AddNameValueLine("desc", item.Description + "|"); | 838 | /// Serialize all the metadata for the items in this prim's inventory ready for sending to the client |
839 | /// </summary> | ||
840 | /// <param name="xferManager"></param> | ||
841 | public void RequestInventoryFile(IClientAPI client, IXfer xferManager) | ||
842 | { | ||
843 | bool changed = CreateInventoryFile(); | ||
853 | 844 | ||
854 | invString.AddNameValueLine("creation_date", item.CreationDate.ToString()); | 845 | if (m_inventorySerial == 0) // No inventory |
855 | invString.AddSectionEnd(); | 846 | { |
856 | } | 847 | client.SendTaskInventory(m_part.UUID, 0, new byte[0]); |
848 | return; | ||
857 | } | 849 | } |
858 | 850 | ||
859 | m_inventoryFileData = Utils.StringToBytes(invString.BuildString); | 851 | // In principle, we should only do the rest if the inventory changed; |
852 | // by sending m_inventorySerial to the client, it ought to know | ||
853 | // that nothing changed and that it doesn't need to request the file. | ||
854 | // Unfortunately, it doesn't look like the client optimizes this; | ||
855 | // the client seems to always come back and request the Xfer, | ||
856 | // no matter what value m_inventorySerial has. | ||
860 | 857 | ||
861 | if (m_inventoryFileData.Length > 2) | 858 | if (m_inventoryFileData.Length > 2) |
862 | { | 859 | // Add the file for Xfer |
863 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); | 860 | xferManager.AddNewFile(m_inventoryFileName, m_inventoryFileData); |
864 | } | 861 | |
862 | // Tell the client we're ready to Xfer the file | ||
863 | client.SendTaskInventory(m_part.UUID, (short)m_inventorySerial, | ||
864 | Util.StringToBytes256(m_inventoryFileName)); | ||
865 | } | 865 | } |
866 | 866 | ||
867 | /// <summary> | 867 | /// <summary> |