From 7dcaa409b34288a5743483a53a8f4e87994edda8 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Fri, 23 May 2008 01:38:20 +0000 Subject: Thank you kindly, Melanie, for a patch which: Previously, upload charging was possible only for UPD uploads. This is because UDP uploads are charged by the viewer, while in CAPS, this was changed to be server side, so hackers couldn't avoid paying the upload charge. This patch adds a method to allow implementation of this serverside charge. --- OpenSim/Region/Environment/Interfaces/IMoneyModule.cs | 1 + .../Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs | 4 ++++ OpenSim/Region/Environment/Scenes/Scene.Inventory.cs | 11 +++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 2 +- 4 files changed, 17 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs index de39d0f..eae6702 100644 --- a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs @@ -36,6 +36,7 @@ namespace OpenSim.Region.Environment.Interfaces { bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount); + void ApplyUploadCharge(LLUUID agentID); event ObjectPaid OnObjectPaid; } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index d64afe7..1883b0a 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs @@ -182,6 +182,10 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney } } + public void ApplyUploadCharge(LLUUID agentID) + { + } + public bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, int amount) { string description = String.Format("Object {0} pays {1}", resolveObjectName(objectID), resolveAgentName(toID)); diff --git a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs index 4f65beb..0e19d96 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.Inventory.cs @@ -59,6 +59,17 @@ namespace OpenSim.Region.Environment.Scenes } } + public void AddUploadedInventoryItem(LLUUID agentID, InventoryItemBase item) + { + IMoneyModule money=RequestModuleInterface(); + if(money != null) + { + money.ApplyUploadCharge(agentID); + } + + AddInventoryItem(agentID, item); + } + /// /// Add an inventory item to an avatar's inventory. /// diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ee634d3..774ddfc 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -2092,7 +2092,7 @@ namespace OpenSim.Region.Environment.Scenes EventManager.TriggerOnRegisterCaps(agentId, cap); - cap.AddNewInventoryItem = AddInventoryItem; + cap.AddNewInventoryItem = AddUploadedInventoryItem; cap.ItemUpdatedCall = CapsUpdateInventoryItemAsset; cap.TaskScriptUpdatedCall = CapsUpdateTaskInventoryScriptAsset; cap.CAPSFetchInventoryDescendents = CommsManager.UserProfileCacheService.HandleFetchInventoryDescendentsCAPS; -- cgit v1.1