diff options
author | UbitUmarov | 2012-09-22 16:47:15 +0100 |
---|---|---|
committer | UbitUmarov | 2012-09-22 16:47:15 +0100 |
commit | 4bba72b7afc104ea5a42acb6206c1c07fbba099b (patch) | |
tree | 86f5dfe4742d9258daea9cb5d0c06a97120e0cfa /OpenSim | |
parent | removed unused data in MeshUploadFlag response (diff) | |
download | opensim-SC-4bba72b7afc104ea5a42acb6206c1c07fbba099b.zip opensim-SC-4bba72b7afc104ea5a42acb6206c1c07fbba099b.tar.gz opensim-SC-4bba72b7afc104ea5a42acb6206c1c07fbba099b.tar.bz2 opensim-SC-4bba72b7afc104ea5a42acb6206c1c07fbba099b.tar.xz |
removed AssetUploaderWithCost, fixing AssetUploader. add parsing of some
more needed fields in request
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Capabilities/LLSDAssetUploadRequest.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | 66 |
2 files changed, 28 insertions, 42 deletions
diff --git a/OpenSim/Capabilities/LLSDAssetUploadRequest.cs b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs index f981bf0..6779cc1 100644 --- a/OpenSim/Capabilities/LLSDAssetUploadRequest.cs +++ b/OpenSim/Capabilities/LLSDAssetUploadRequest.cs | |||
@@ -45,6 +45,10 @@ namespace OpenSim.Framework.Capabilities | |||
45 | public string asset_type = String.Empty; | 45 | public string asset_type = String.Empty; |
46 | public string description = String.Empty; | 46 | public string description = String.Empty; |
47 | public UUID folder_id = UUID.Zero; | 47 | public UUID folder_id = UUID.Zero; |
48 | public UUID texture_folder_id = UUID.Zero; | ||
49 | public int next_owner_mask = 0; | ||
50 | public int group_mask = 0; | ||
51 | public int everyone_mask = 0; | ||
48 | public string inventory_type = String.Empty; | 52 | public string inventory_type = String.Empty; |
49 | public string name = String.Empty; | 53 | public string name = String.Empty; |
50 | public LLSDAssetResource asset_resources = new LLSDAssetResource(); | 54 | public LLSDAssetResource asset_resources = new LLSDAssetResource(); |
diff --git a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs index 1b47fca..b64453a 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/BunchOfCaps/BunchOfCaps.cs | |||
@@ -54,8 +54,8 @@ using OSDMap = OpenMetaverse.StructuredData.OSDMap; | |||
54 | namespace OpenSim.Region.ClientStack.Linden | 54 | namespace OpenSim.Region.ClientStack.Linden |
55 | { | 55 | { |
56 | public delegate void UpLoadedAsset( | 56 | public delegate void UpLoadedAsset( |
57 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, | 57 | string assetName, string description, UUID assetID, UUID inventoryItem, UUID parentFolder, |
58 | byte[] data, string inventoryType, string assetType); | 58 | byte[] data, string inventoryType, string assetType, int cost); |
59 | 59 | ||
60 | public delegate UUID UpdateItem(UUID itemID, byte[] data); | 60 | public delegate UUID UpdateItem(UUID itemID, byte[] data); |
61 | 61 | ||
@@ -119,6 +119,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
119 | private int m_levelUpload = 0; | 119 | private int m_levelUpload = 0; |
120 | private float m_PrimScaleMin = 0.001f; | 120 | private float m_PrimScaleMin = 0.001f; |
121 | private bool m_enableFreeTestModelUpload = false; | 121 | private bool m_enableFreeTestModelUpload = false; |
122 | private bool m_enableModelUploadTextureToInventory = false; | ||
122 | 123 | ||
123 | private enum FileAgentInventoryState : int | 124 | private enum FileAgentInventoryState : int |
124 | { | 125 | { |
@@ -147,7 +148,6 @@ namespace OpenSim.Region.ClientStack.Linden | |||
147 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; | 148 | float modelUploadFactor = m_ModelCost.ModelMeshCostFactor; |
148 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; | 149 | float modelMinUploadCostFactor = m_ModelCost.ModelMinCostFactor; |
149 | 150 | ||
150 | |||
151 | IConfigSource config = m_Scene.Config; | 151 | IConfigSource config = m_Scene.Config; |
152 | if (config != null) | 152 | if (config != null) |
153 | { | 153 | { |
@@ -170,12 +170,12 @@ namespace OpenSim.Region.ClientStack.Linden | |||
170 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); | 170 | modelTextureUploadFactor = EconomyConfig.GetFloat("MeshModelUploadTextureCostFactor", modelTextureUploadFactor); |
171 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); | 171 | modelMinUploadCostFactor = EconomyConfig.GetFloat("MeshModelMinCostFactor", modelMinUploadCostFactor); |
172 | m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); | 172 | m_enableFreeTestModelUpload = EconomyConfig.GetBoolean("MeshModelUploadAllowFreeTest", false); |
173 | m_enableModelUploadTextureToInventory = EconomyConfig.GetBoolean("MeshModelAllowTextureToInventory", false); | ||
173 | 174 | ||
174 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; | 175 | m_ModelCost.ModelMeshCostFactor = modelUploadFactor; |
175 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; | 176 | m_ModelCost.ModelTextureCostFactor = modelTextureUploadFactor; |
176 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; | 177 | m_ModelCost.ModelMinCostFactor = modelMinUploadCostFactor; |
177 | } | 178 | } |
178 | |||
179 | } | 179 | } |
180 | 180 | ||
181 | m_assetService = m_Scene.AssetService; | 181 | m_assetService = m_Scene.AssetService; |
@@ -426,37 +426,13 @@ namespace OpenSim.Region.ClientStack.Linden | |||
426 | 426 | ||
427 | return UUID.Zero; | 427 | return UUID.Zero; |
428 | } | 428 | } |
429 | 429 | /* | |
430 | private delegate void UploadWithCostCompleteDelegate(string assetName, | 430 | private class AssetUploaderExtraParameters |
431 | string assetDescription, UUID assetID, UUID inventoryItem, | ||
432 | UUID parentFolder, byte[] data, string inventoryType, | ||
433 | string assetType, uint cost); | ||
434 | |||
435 | private class AssetUploaderWithCost : AssetUploader | ||
436 | { | 431 | { |
437 | private uint m_cost; | 432 | public int total_cost; |
433 | public UUID textureFolder = UUID.Zero; | ||
434 | */ | ||
438 | 435 | ||
439 | public event UploadWithCostCompleteDelegate OnUpLoad; | ||
440 | |||
441 | public AssetUploaderWithCost(string assetName, string description, UUID assetID, | ||
442 | UUID inventoryItem, UUID parentFolderID, string invType, string assetType, | ||
443 | string path, IHttpServer httpServer, bool dumpAssetsToFile, uint cost) : | ||
444 | base(assetName, description, assetID, inventoryItem, parentFolderID, | ||
445 | invType, assetType, path, httpServer, dumpAssetsToFile) | ||
446 | { | ||
447 | m_cost = cost; | ||
448 | |||
449 | base.OnUpLoad += UploadCompleteHandler; | ||
450 | } | ||
451 | |||
452 | private void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | ||
453 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | ||
454 | string assetType) | ||
455 | { | ||
456 | OnUpLoad(assetName, assetDescription, assetID, inventoryItem, parentFolder, | ||
457 | data, inventoryType, assetType, m_cost); | ||
458 | } | ||
459 | } | ||
460 | 436 | ||
461 | /// <summary> | 437 | /// <summary> |
462 | /// | 438 | /// |
@@ -497,7 +473,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
497 | m_FileAgentInventoryState = FileAgentInventoryState.processRequest; | 473 | m_FileAgentInventoryState = FileAgentInventoryState.processRequest; |
498 | } | 474 | } |
499 | 475 | ||
500 | uint cost = 0; | 476 | int cost = 0; |
501 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); | 477 | LLSDAssetUploadResponseData meshcostdata = new LLSDAssetUploadResponseData(); |
502 | 478 | ||
503 | if (llsdRequest.asset_type == "texture" || | 479 | if (llsdRequest.asset_type == "texture" || |
@@ -551,11 +527,11 @@ namespace OpenSim.Region.ClientStack.Linden | |||
551 | m_FileAgentInventoryState = FileAgentInventoryState.idle; | 527 | m_FileAgentInventoryState = FileAgentInventoryState.idle; |
552 | return errorResponse; | 528 | return errorResponse; |
553 | } | 529 | } |
554 | cost = (uint)modelcost; | 530 | cost = modelcost; |
555 | } | 531 | } |
556 | else | 532 | else |
557 | { | 533 | { |
558 | cost = (uint)baseCost; | 534 | cost = baseCost; |
559 | } | 535 | } |
560 | 536 | ||
561 | // check funds | 537 | // check funds |
@@ -584,8 +560,8 @@ namespace OpenSim.Region.ClientStack.Linden | |||
584 | UUID parentFolder = llsdRequest.folder_id; | 560 | UUID parentFolder = llsdRequest.folder_id; |
585 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); | 561 | string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); |
586 | 562 | ||
587 | AssetUploaderWithCost uploader = | 563 | AssetUploader uploader = |
588 | new AssetUploaderWithCost(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, | 564 | new AssetUploader(assetName, assetDes, newAsset, newInvItem, parentFolder, llsdRequest.inventory_type, |
589 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); | 565 | llsdRequest.asset_type, capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_dumpAssetsToFile, cost); |
590 | 566 | ||
591 | m_HostCapsObj.HttpListener.AddStreamHandler( | 567 | m_HostCapsObj.HttpListener.AddStreamHandler( |
@@ -631,7 +607,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
631 | /// <param name="data"></param> | 607 | /// <param name="data"></param> |
632 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, | 608 | public void UploadCompleteHandler(string assetName, string assetDescription, UUID assetID, |
633 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, | 609 | UUID inventoryItem, UUID parentFolder, byte[] data, string inventoryType, |
634 | string assetType, uint cost) | 610 | string assetType, int cost) |
635 | { | 611 | { |
636 | lock (m_ModelCost) | 612 | lock (m_ModelCost) |
637 | m_FileAgentInventoryState = FileAgentInventoryState.processUpload; | 613 | m_FileAgentInventoryState = FileAgentInventoryState.processUpload; |
@@ -920,6 +896,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
920 | 896 | ||
921 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current | 897 | // If we set PermissionMask.All then when we rez the item the next permissions will replace the current |
922 | // (owner) permissions. This becomes a problem if next permissions are changed. | 898 | // (owner) permissions. This becomes a problem if next permissions are changed. |
899 | |||
923 | item.CurrentPermissions | 900 | item.CurrentPermissions |
924 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); | 901 | = (uint)(PermissionMask.Move | PermissionMask.Copy | PermissionMask.Modify | PermissionMask.Transfer); |
925 | 902 | ||
@@ -930,7 +907,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
930 | 907 | ||
931 | if (AddNewInventoryItem != null) | 908 | if (AddNewInventoryItem != null) |
932 | { | 909 | { |
933 | AddNewInventoryItem(m_HostCapsObj.AgentID, item, cost); | 910 | AddNewInventoryItem(m_HostCapsObj.AgentID, item,(uint) cost); |
934 | } | 911 | } |
935 | 912 | ||
936 | lock (m_ModelCost) | 913 | lock (m_ModelCost) |
@@ -1247,6 +1224,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1247 | private static readonly ILog m_log = | 1224 | private static readonly ILog m_log = |
1248 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 1225 | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
1249 | 1226 | ||
1227 | |||
1250 | public event UpLoadedAsset OnUpLoad; | 1228 | public event UpLoadedAsset OnUpLoad; |
1251 | private UpLoadedAsset handlerUpLoad = null; | 1229 | private UpLoadedAsset handlerUpLoad = null; |
1252 | 1230 | ||
@@ -1261,11 +1239,14 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1261 | 1239 | ||
1262 | private string m_invType = String.Empty; | 1240 | private string m_invType = String.Empty; |
1263 | private string m_assetType = String.Empty; | 1241 | private string m_assetType = String.Empty; |
1242 | private int m_cost; | ||
1243 | |||
1264 | private Timer m_timeoutTimer = new Timer(); | 1244 | private Timer m_timeoutTimer = new Timer(); |
1265 | 1245 | ||
1246 | |||
1266 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, | 1247 | public AssetUploader(string assetName, string description, UUID assetID, UUID inventoryItem, |
1267 | UUID parentFolderID, string invType, string assetType, string path, | 1248 | UUID parentFolderID, string invType, string assetType, string path, |
1268 | IHttpServer httpServer, bool dumpAssetsToFile) | 1249 | IHttpServer httpServer, bool dumpAssetsToFile, int totalCost) |
1269 | { | 1250 | { |
1270 | m_assetName = assetName; | 1251 | m_assetName = assetName; |
1271 | m_assetDes = description; | 1252 | m_assetDes = description; |
@@ -1277,6 +1258,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1277 | m_assetType = assetType; | 1258 | m_assetType = assetType; |
1278 | m_invType = invType; | 1259 | m_invType = invType; |
1279 | m_dumpAssetsToFile = dumpAssetsToFile; | 1260 | m_dumpAssetsToFile = dumpAssetsToFile; |
1261 | m_cost = totalCost; | ||
1280 | 1262 | ||
1281 | m_timeoutTimer.Elapsed += TimedOut; | 1263 | m_timeoutTimer.Elapsed += TimedOut; |
1282 | m_timeoutTimer.Interval = 120000; | 1264 | m_timeoutTimer.Interval = 120000; |
@@ -1319,7 +1301,7 @@ namespace OpenSim.Region.ClientStack.Linden | |||
1319 | handlerUpLoad = OnUpLoad; | 1301 | handlerUpLoad = OnUpLoad; |
1320 | if (handlerUpLoad != null) | 1302 | if (handlerUpLoad != null) |
1321 | { | 1303 | { |
1322 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType); | 1304 | handlerUpLoad(m_assetName, m_assetDes, newAssetID, inv, parentFolder, data, m_invType, m_assetType,m_cost); |
1323 | } | 1305 | } |
1324 | return res; | 1306 | return res; |
1325 | } | 1307 | } |