diff options
author | UbitUmarov | 2012-09-24 22:57:33 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-24 22:57:33 +0100 |
commit | a1a0a90720e65ce104699abb6dcd46b5cb34a6db (patch) | |
tree | 91aea3aac168e92f33ed7c8ef4aab1c3cd68a177 /OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |
parent | touch prebuild.xml (diff) | |
download | opensim-SC-a1a0a90720e65ce104699abb6dcd46b5cb34a6db.zip opensim-SC-a1a0a90720e65ce104699abb6dcd46b5cb34a6db.tar.gz opensim-SC-a1a0a90720e65ce104699abb6dcd46b5cb34a6db.tar.bz2 opensim-SC-a1a0a90720e65ce104699abb6dcd46b5cb34a6db.tar.xz |
more upload changes (plus untouch prebuild.xml)
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 183 |
1 files changed, 123 insertions, 60 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 21a1005..4a323d8 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -118,12 +118,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
118 | private IAssetService m_assetService; | 118 | private IAssetService m_assetService; |
119 | private bool m_dumpAssetsToFile = false; | 119 | private bool m_dumpAssetsToFile = false; |
120 | private string m_regionName; | 120 | private string m_regionName; |
121 | |||
121 | private int m_levelUpload = 0; | 122 | private int m_levelUpload = 0; |
122 | private float m_PrimScaleMin = 0.001f; | 123 | |
123 | private bool m_enableFreeTestUpload = false; | 124 | private bool m_enableFreeTestUpload = false; // allows "TEST-" prefix hack |
124 | private bool m_enableModelUploadTextureToInventory = false; | 125 | private bool m_ForceFreeTestUpload = false; // forces all uploads to be test |
126 | |||
127 | private bool m_enableModelUploadTextureToInventory = false; // place uploaded textures also in inventory | ||
128 | // may not be visible till relog | ||
129 | |||
130 | private bool m_RestrictFreeTestUploadPerms = false; // reduces also the permitions. Needs a creator defined!! | ||
125 | private UUID m_testAssetsCreatorID = UUID.Zero; | 131 | private UUID m_testAssetsCreatorID = UUID.Zero; |
126 | 132 | ||
133 | private float m_PrimScaleMin = 0.001f; | ||
134 | |||
127 | private enum FileAgentInventoryState : int | 135 | private enum FileAgentInventoryState : int |
128 | { | 136 | { |
129 | idle = 0, | 137 | idle = 0, |
@@ -143,16 +151,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
143 | // tell it about scene object limits | 151 | // tell it about scene object limits |
144 | m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; | 152 | m_ModelCost.NonPhysicalPrimScaleMax = m_Scene.m_maxNonphys; |
145 | m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; | 153 | m_ModelCost.PhysicalPrimScaleMax = m_Scene.m_maxPhys; |
146 | // m_ModelCost.PrimScaleMin = ?? | 154 | |
147 | // m_ModelCost.ObjectLinkedPartsMax = ?? | 155 | // m_ModelCost.ObjectLinkedPartsMax = ?? |
148 | // m_PrimScaleMin = ?? | 156 | // m_ModelCost.PrimScaleMin = ?? |
149 | 157 | ||
158 | m_PrimScaleMin = m_ModelCost.PrimScaleMin; | ||
150 | float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; | 159 | float modelTextureUploadFactor = m_ModelCost.ModelTextureCostFactor; |
151 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; | 160 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; |
152 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; | 161 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; |
153 | 162 | float modelPrimCreationCost = m_ModelCost.primCreationCost; | |
154 | // can be UUID.zero. This is me at OSG, should be a valid grid ID, is case a bad config | 163 | float modelMeshByteCost = m_ModelCost.bytecost; |
155 | UUID.TryParse("58e06f33-ea8c-4ff6-9af5-420606926118", out m_testAssetsCreatorID); | ||
156 | 164 | ||
157 | IConfigSource config = m_Scene.Config; | 165 | IConfigSource config = m_Scene.Config; |
158 | if (config != null) | 166 | if (config != null) |
@@ -175,10 +183,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
175 | modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); | 183 | modelUploadFactor = EconomyConfig.GetFloat("MeshModelUploadCostFactor", modelUploadFactor); |
176 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); | 184 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); |
177 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); | 185 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); |
178 | m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); | 186 | // next 2 are normalized so final cost is afected by modelUploadFactor above and normal cost |
187 | modelPrimCreationCost = EconomyConfig.GetFloat("ModelPrimCreationCost", modelPrimCreationCost); | ||
188 | modelMeshByteCost = EconomyConfig.GetFloat("ModelMeshByteCost", modelMeshByteCost); | ||
179 | 189 | ||
180 | m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", false); | 190 | m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", m_enableModelUploadTextureToInventory); |
181 | string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", m_testAssetsCreatorID.ToString()); | 191 | |
192 | m_RestrictFreeTestUploadPerms = EconomyConfig.GetBoolean("m_RestrictFreeTestUploadPerms", m_RestrictFreeTestUploadPerms); | ||
193 | m_enableFreeTestUpload = EconomyConfig.GetBoolean("AllowFreeTestUpload", m_enableFreeTestUpload); | ||
194 | m_ForceFreeTestUpload = EconomyConfig.GetBoolean("ForceFreeTestUpload", m_ForceFreeTestUpload); | ||
195 | string testcreator = EconomyConfig.GetString("TestAssetsCreatorID", ""); | ||
182 | if (testcreator != "") | 196 | if (testcreator != "") |
183 | { | 197 | { |
184 | UUID id; | 198 | UUID id; |
@@ -190,6 +204,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
190 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; | 204 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; |
191 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; | 205 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; |
192 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; | 206 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; |
207 | m_ModelCost.primCreationCost = modelPrimCreationCost; | ||
208 | m_ModelCost.bytecost = modelMeshByteCost; | ||
193 | } | 209 | } |
194 | } | 210 | } |
195 | 211 | ||
@@ -490,6 +506,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
490 | int nreqinstances = 0; | 506 | int nreqinstances = 0; |
491 | bool IsAtestUpload = false; | 507 | bool IsAtestUpload = false; |
492 | 508 | ||
509 | string assetName = llsdRequest.name; | ||
510 | |||
493 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); | 511 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); |
494 | 512 | ||
495 | if (llsdRequest.asset_type == "texture" || | 513 | if (llsdRequest.asset_type == "texture" || |
@@ -497,7 +515,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
497 | llsdRequest.asset_type == "mesh" || | 515 | llsdRequest.asset_type == "mesh" || |
498 | llsdRequest.asset_type == "sound") | 516 | llsdRequest.asset_type == "sound") |
499 | { | 517 | { |
500 | ScenePresence avatar = null; | 518 | ScenePresence avatar = null; |
501 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); | 519 | m_Scene.TryGetScenePresence(m_HostCapsObj.AgentID, out avatar); |
502 | 520 | ||
503 | // check user level | 521 | // check user level |
@@ -519,7 +537,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
519 | } | 537 | } |
520 | } | 538 | } |
521 | 539 | ||
522 | // check funds | 540 | // check test upload and funds |
523 | if (client != null) | 541 | if (client != null) |
524 | { | 542 | { |
525 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); | 543 | IMoneyModule mm = m_Scene.RequestModuleInterface<IMoneyModule>(); |
@@ -558,41 +576,53 @@ namespace OpenSim.Region.ClientStack.Linden | |||
558 | cost = baseCost; | 576 | cost = baseCost; |
559 | } | 577 | } |
560 | 578 | ||
561 | if (m_enableFreeTestUpload && cost > 0 && mm != null) | 579 | if (cost > 0 && mm != null) |
562 | { | 580 | { |
563 | string str = llsdRequest.name; | 581 | // check for test upload |
564 | if (str.Length > 5 && str.StartsWith("TEST-")) | 582 | |
583 | if (m_ForceFreeTestUpload) // all are test | ||
565 | { | 584 | { |
566 | warning += "Upload will have no cost, but for personal test purposes only. Other uses are forbiden"; | 585 | if (!(assetName.Length > 5 && assetName.StartsWith("TEST-"))) // has normal name lets change it |
586 | assetName = "TEST-" + assetName; | ||
587 | |||
567 | IsAtestUpload = true; | 588 | IsAtestUpload = true; |
568 | } | 589 | } |
569 | } | ||
570 | |||
571 | if (client != null && warning != String.Empty) | ||
572 | client.SendAgentAlertMessage(warning, true); | ||
573 | 590 | ||
574 | // check funds | 591 | else if (m_enableFreeTestUpload) // only if prefixed with "TEST-" |
575 | if (!IsAtestUpload && mm != null && cost >0) | ||
576 | { | ||
577 | if (!mm.UploadCovered(client.AgentId, (int)cost)) | ||
578 | { | 592 | { |
579 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | ||
580 | resperror.message = "Insuficient funds"; | ||
581 | resperror.identifier = UUID.Zero; | ||
582 | 593 | ||
583 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | 594 | IsAtestUpload = (assetName.Length > 5 && assetName.StartsWith("TEST-")); |
584 | errorResponse.uploader = ""; | 595 | } |
585 | errorResponse.state = "error"; | 596 | |
586 | errorResponse.error = resperror; | 597 | |
587 | lock (m_ModelCost) | 598 | if(IsAtestUpload) // let user know, still showing cost estimation |
588 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | 599 | warning += "Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on another region"; |
589 | return errorResponse; | 600 | |
601 | // check funds | ||
602 | else | ||
603 | { | ||
604 | if (!mm.UploadCovered(client.AgentId, (int)cost)) | ||
605 | { | ||
606 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | ||
607 | resperror.message = "Insuficient funds"; | ||
608 | resperror.identifier = UUID.Zero; | ||
609 | |||
610 | LLSDAssetUploadResponse errorResponse = new LLSDAssetUploadResponse(); | ||
611 | errorResponse.uploader = ""; | ||
612 | errorResponse.state = "error"; | ||
613 | errorResponse.error = resperror; | ||
614 | lock (m_ModelCost) | ||
615 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | ||
616 | return errorResponse; | ||
617 | } | ||
590 | } | 618 | } |
591 | } | 619 | } |
620 | |||
621 | if (client != null && warning != String.Empty) | ||
622 | client.SendAgentAlertMessage(warning, true); | ||
592 | } | 623 | } |
593 | } | 624 | } |
594 | 625 | ||
595 | string assetName = llsdRequest.name; | ||
596 | string assetDes = llsdRequest.description; | 626 | string assetDes = llsdRequest.description; |
597 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; | 627 | string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath; |
598 | UUID newAsset = UUID.Random(); | 628 | UUID newAsset = UUID.Random(); |
@@ -607,7 +637,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
607 | AssetUploader uploader = | 637 | AssetUploader uploader = |
608 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 638 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
609 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, | 639 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost, |
610 | texturesFolder, nreqtextures, nreqmeshs, nreqinstances,IsAtestUpload); | 640 | texturesFolder, nreqtextures, nreqmeshs, nreqinstances, IsAtestUpload); |
611 | 641 | ||
612 | m_HostCapsObj.HttpListener.AddStreamHandler( | 642 | m_HostCapsObj.HttpListener.AddStreamHandler( |
613 | new BinaryStreamHandler( | 643 | new BinaryStreamHandler( |
@@ -667,12 +697,16 @@ namespace OpenSim.Region.ClientStack.Linden | |||
667 | sbyte assType = 0; | 697 | sbyte assType = 0; |
668 | sbyte inType = 0; | 698 | sbyte inType = 0; |
669 | 699 | ||
700 | IClientAPI client = null; | ||
701 | |||
670 | UUID owner_id = m_HostCapsObj.AgentID; | 702 | UUID owner_id = m_HostCapsObj.AgentID; |
671 | UUID creatorID; | 703 | UUID creatorID; |
672 | 704 | ||
673 | bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); | 705 | bool istest = IsAtestUpload && m_enableFreeTestUpload && (cost > 0); |
674 | 706 | ||
675 | if (istest) | 707 | bool restrictPerms = m_RestrictFreeTestUploadPerms && istest; |
708 | |||
709 | if (istest && m_testAssetsCreatorID != UUID.Zero) | ||
676 | creatorID = m_testAssetsCreatorID; | 710 | creatorID = m_testAssetsCreatorID; |
677 | else | 711 | else |
678 | creatorID = owner_id; | 712 | creatorID = owner_id; |
@@ -755,10 +789,19 @@ namespace OpenSim.Region.ClientStack.Linden | |||
755 | 789 | ||
756 | List<UUID> textures = new List<UUID>(); | 790 | List<UUID> textures = new List<UUID>(); |
757 | 791 | ||
792 | |||
793 | if (doTextInv) | ||
794 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | ||
795 | |||
796 | if(client == null) // don't put textures in inventory if there is no client | ||
797 | doTextInv = false; | ||
798 | |||
758 | for (int i = 0; i < texture_list.Count; i++) | 799 | for (int i = 0; i < texture_list.Count; i++) |
759 | { | 800 | { |
760 | AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); | 801 | AssetBase textureAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Texture, creatorIDstr); |
761 | textureAsset.Data = texture_list[i].AsBinary(); | 802 | textureAsset.Data = texture_list[i].AsBinary(); |
803 | if (istest) | ||
804 | textureAsset.Local = true; | ||
762 | m_assetService.Store(textureAsset); | 805 | m_assetService.Store(textureAsset); |
763 | textures.Add(textureAsset.FullID); | 806 | textures.Add(textureAsset.FullID); |
764 | 807 | ||
@@ -788,9 +831,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
788 | texitem.NextPermissions = (uint)PermissionMask.All; | 831 | texitem.NextPermissions = (uint)PermissionMask.All; |
789 | texitem.CreationDate = Util.UnixTimeSinceEpoch(); | 832 | texitem.CreationDate = Util.UnixTimeSinceEpoch(); |
790 | 833 | ||
791 | AddNewInventoryItem(m_HostCapsObj.AgentID, texitem, 0); | 834 | m_Scene.AddInventoryItem(client, texitem); |
792 | texitem = null; | 835 | texitem = null; |
793 | // this aren't showing up in viewer until relog :( | ||
794 | } | 836 | } |
795 | } | 837 | } |
796 | 838 | ||
@@ -800,6 +842,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
800 | { | 842 | { |
801 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); | 843 | AssetBase meshAsset = new AssetBase(UUID.Random(), assetName, (sbyte)AssetType.Mesh, creatorIDstr); |
802 | meshAsset.Data = mesh_list[i].AsBinary(); | 844 | meshAsset.Data = mesh_list[i].AsBinary(); |
845 | if (istest) | ||
846 | meshAsset.Local = true; | ||
803 | m_assetService.Store(meshAsset); | 847 | m_assetService.Store(meshAsset); |
804 | meshAssets.Add(meshAsset.FullID); | 848 | meshAssets.Add(meshAsset.FullID); |
805 | } | 849 | } |
@@ -908,14 +952,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
908 | // UUID owner_id = permissions["owner_id"].AsUUID(); | 952 | // UUID owner_id = permissions["owner_id"].AsUUID(); |
909 | // int owner_mask = permissions["owner_mask"].AsInteger(); | 953 | // int owner_mask = permissions["owner_mask"].AsInteger(); |
910 | // no longer used - end ------------------------ | 954 | // no longer used - end ------------------------ |
911 | 955 | ||
912 | |||
913 | 956 | ||
914 | SceneObjectPart prim | 957 | SceneObjectPart prim |
915 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); | 958 | = new SceneObjectPart(owner_id, pbs, position, Quaternion.Identity, Vector3.Zero); |
916 | 959 | ||
917 | prim.Scale = scale; | 960 | prim.Scale = scale; |
918 | // prim.OffsetPosition = position; | ||
919 | rotations.Add(rotation); | 961 | rotations.Add(rotation); |
920 | positions.Add(position); | 962 | positions.Add(position); |
921 | prim.UUID = UUID.Random(); | 963 | prim.UUID = UUID.Random(); |
@@ -930,18 +972,20 @@ namespace OpenSim.Region.ClientStack.Linden | |||
930 | else | 972 | else |
931 | prim.Name = assetName + "#" + i.ToString(); | 973 | prim.Name = assetName + "#" + i.ToString(); |
932 | 974 | ||
933 | if (istest) | 975 | if (restrictPerms) |
934 | { | 976 | { |
935 | prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); | 977 | prim.BaseMask = (uint)(PermissionMask.Move | PermissionMask.Modify); |
936 | prim.EveryoneMask = 0; | 978 | prim.EveryoneMask = 0; |
937 | prim.GroupMask = 0; | 979 | prim.GroupMask = 0; |
938 | prim.NextOwnerMask = 0; | 980 | prim.NextOwnerMask = 0; |
939 | prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); | 981 | prim.OwnerMask = (uint)(PermissionMask.Move | PermissionMask.Modify); |
982 | } | ||
940 | 983 | ||
984 | if(istest) | ||
941 | prim.Description = "For personal testing only. Other uses are forbiden"; | 985 | prim.Description = "For personal testing only. Other uses are forbiden"; |
942 | } | ||
943 | else | 986 | else |
944 | prim.Description = ""; | 987 | prim.Description = ""; |
988 | |||
945 | prim.Material = material; | 989 | prim.Material = material; |
946 | prim.PhysicsShapeType = physicsShapeType; | 990 | prim.PhysicsShapeType = physicsShapeType; |
947 | 991 | ||
@@ -1007,6 +1051,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1007 | AssetBase asset; | 1051 | AssetBase asset; |
1008 | asset = new AssetBase(assetID, assetName, assType, creatorIDstr); | 1052 | asset = new AssetBase(assetID, assetName, assType, creatorIDstr); |
1009 | asset.Data = data; | 1053 | asset.Data = data; |
1054 | if (istest) | ||
1055 | asset.Local = true; | ||
1010 | if (AddNewAsset != null) | 1056 | if (AddNewAsset != null) |
1011 | AddNewAsset(asset); | 1057 | AddNewAsset(asset); |
1012 | else if (m_assetService != null) | 1058 | else if (m_assetService != null) |
@@ -1019,7 +1065,10 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1019 | item.ID = inventoryItem; | 1065 | item.ID = inventoryItem; |
1020 | item.AssetID = asset.FullID; | 1066 | item.AssetID = asset.FullID; |
1021 | if (istest) | 1067 | if (istest) |
1068 | { | ||
1022 | item.Description = "For personal testing only. Other uses are forbiden"; | 1069 | item.Description = "For personal testing only. Other uses are forbiden"; |
1070 | item.Flags = (uint) (InventoryItemFlags.SharedSingleReference); | ||
1071 | } | ||
1023 | else | 1072 | else |
1024 | item.Description = assetDescription; | 1073 | item.Description = assetDescription; |
1025 | item.Name = assetName; | 1074 | item.Name = assetName; |
@@ -1030,7 +1079,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1030 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | 1079 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current |
1031 | // (owner) permissions. This becomes a problem if next permissions are changed. | 1080 | // (owner) permissions. This becomes a problem if next permissions are changed. |
1032 | 1081 | ||
1033 | if (istest) | 1082 | if (restrictPerms) |
1034 | { | 1083 | { |
1035 | item.CurrentPermissions | 1084 | item.CurrentPermissions |
1036 | = (uint)(PermissionMask.Move | PermissionMask.Modify); | 1085 | = (uint)(PermissionMask.Move | PermissionMask.Modify); |
@@ -1051,16 +1100,18 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1051 | 1100 | ||
1052 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 1101 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
1053 | 1102 | ||
1054 | IClientAPI client = null; | ||
1055 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); | 1103 | m_Scene.TryGetClient(m_HostCapsObj.AgentID, out client); |
1056 | 1104 | ||
1057 | if (AddNewInventoryItem != null) | 1105 | if (AddNewInventoryItem != null) |
1058 | { | 1106 | { |
1059 | if (istest) | 1107 | if (istest) |
1060 | { | 1108 | { |
1109 | m_Scene.AddInventoryItem(client, item); | ||
1110 | /* | ||
1061 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); | 1111 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, 0); |
1062 | if (client != null) | 1112 | if (client != null) |
1063 | client.SendAgentAlertMessage("Upload complete with no cost for personal testing purposes only. Other uses are forbiden", true); | 1113 | client.SendAgentAlertMessage("Upload will have no cost, for personal test purposes only. Other uses are forbiden. Items may not work on a another region" , true); |
1114 | */ | ||
1064 | } | 1115 | } |
1065 | else | 1116 | else |
1066 | { | 1117 | { |
@@ -1487,22 +1538,34 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1487 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, | 1538 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType, |
1488 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); | 1539 | m_cost, m_texturesFolder, m_nreqtextures, m_nreqmeshs, m_nreqinstances, m_IsAtestUpload, ref m_error); |
1489 | } | 1540 | } |
1490 | if(m_error == String.Empty) | 1541 | if (m_IsAtestUpload) |
1491 | { | ||
1492 | uploadComplete.new_asset = newAssetID.ToString(); | ||
1493 | uploadComplete.new_inventory_item = inv; | ||
1494 | // if (m_texturesFolder != UUID.Zero) | ||
1495 | // uploadComplete.new_texture_folder_id = m_texturesFolder; | ||
1496 | uploadComplete.state = "complete"; | ||
1497 | } | ||
1498 | else | ||
1499 | { | 1542 | { |
1500 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | 1543 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); |
1501 | resperror.message = m_error; | 1544 | resperror.message = "Upload SUCESSEFULL for testing purposes only. Other uses are forbiden. Item may not work on other region"; |
1502 | resperror.identifier = inv; | 1545 | resperror.identifier = inv; |
1503 | 1546 | ||
1504 | uploadComplete.error = resperror; | 1547 | uploadComplete.error = resperror; |
1505 | uploadComplete.state = "failed"; | 1548 | uploadComplete.state = "Upload4Testing"; |
1549 | } | ||
1550 | else | ||
1551 | { | ||
1552 | if (m_error == String.Empty) | ||
1553 | { | ||
1554 | uploadComplete.new_asset = newAssetID.ToString(); | ||
1555 | uploadComplete.new_inventory_item = inv; | ||
1556 | // if (m_texturesFolder != UUID.Zero) | ||
1557 | // uploadComplete.new_texture_folder_id = m_texturesFolder; | ||
1558 | uploadComplete.state = "complete"; | ||
1559 | } | ||
1560 | else | ||
1561 | { | ||
1562 | LLSDAssetUploadError resperror = new LLSDAssetUploadError(); | ||
1563 | resperror.message = m_error; | ||
1564 | resperror.identifier = inv; | ||
1565 | |||
1566 | uploadComplete.error = resperror; | ||
1567 | uploadComplete.state = "failed"; | ||
1568 | } | ||
1506 | } | 1569 | } |
1507 | 1570 | ||
1508 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); | 1571 | res = LLSDHelpers.SerialiseLLSDReply(uploadComplete); |