diff --git a/OpenSim/Framework/Capabilities/Caps.cs b/OpenSim/Framework/Capabilities/Caps.cs index 62a1e17f50..da953bbef0 100644 --- a/OpenSim/Framework/Capabilities/Caps.cs +++ b/OpenSim/Framework/Capabilities/Caps.cs @@ -814,7 +814,7 @@ namespace OpenSim.Framework.Capabilities if (mm != null) { - if (!mm.UploadCovered(client)) + if (!mm.UploadCovered(client, mm.UploadCharge)) { if (client != null) client.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); diff --git a/OpenSim/Framework/IMoneyModule.cs b/OpenSim/Framework/IMoneyModule.cs index 17e74a05cc..3d4873df0c 100644 --- a/OpenSim/Framework/IMoneyModule.cs +++ b/OpenSim/Framework/IMoneyModule.cs @@ -35,13 +35,14 @@ namespace OpenSim.Framework bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount); - int GetBalance(IClientAPI client); - void ApplyUploadCharge(UUID agentID); - bool UploadCovered(IClientAPI client); - void ApplyGroupCreationCharge(UUID agentID); - bool GroupCreationCovered(IClientAPI client); + int GetBalance(UUID agentID); + bool UploadCovered(IClientAPI client, int amount); bool AmountCovered(IClientAPI client, int amount); void ApplyCharge(UUID agentID, int amount, string text); + void ApplyUploadCharge(UUID agentID, int amount, string text); + + int UploadCharge { get; } + int GroupCreationCharge { get; } event ObjectPaid OnObjectPaid; } diff --git a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs index 7e08ecf688..ae31050853 100644 --- a/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/CoreModules/Agent/AssetTransaction/AssetTransactionModule.cs @@ -243,7 +243,7 @@ namespace OpenSim.Region.CoreModules.Agent.AssetTransaction if (mm != null) { - if (!mm.UploadCovered(remoteClient)) + if (!mm.UploadCovered(remoteClient, mm.UploadCharge)) { remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); return; diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index f9da341ba9..33173dda21 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -73,7 +73,7 @@ namespace OpenSim.Region.Framework.Scenes IMoneyModule money=RequestModuleInterface(); if (money != null) { - money.ApplyUploadCharge(agentID); + money.ApplyUploadCharge(agentID, money.UploadCharge, "Asset upload"); } AddInventoryItem(agentID, item); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 56c0d985f1..3f15b69944 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs @@ -722,11 +722,11 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups if (money != null) { // do the transaction, that is if the agent has got sufficient funds - if (!money.GroupCreationCovered(remoteClient)) { + if (!money.AmountCovered(remoteClient, money.GroupCreationCharge)) { remoteClient.SendCreateGroupReply(UUID.Zero, false, "You have got issuficient funds to create a group."); return UUID.Zero; } - money.ApplyGroupCreationCharge(GetRequestingAgentID(remoteClient)); + money.ApplyCharge(GetRequestingAgentID(remoteClient), money.GroupCreationCharge, "Group Creation"); } UUID groupID = m_groupData.CreateGroup(GetRequestingAgentID(remoteClient), name, charter, showInList, insigniaID, membershipFee, openEnrollment, allowPublish, maturePublish, GetRequestingAgentID(remoteClient)); diff --git a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs index e070077556..6f5ef9e9f8 100644 --- a/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs +++ b/OpenSim/Region/OptionalModules/World/MoneyModule/SampleMoneyModule.cs @@ -108,6 +108,16 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule public event ObjectPaid OnObjectPaid; + public int UploadCharge + { + get { return 0; } + } + + public int GroupCreationCharge + { + get { return 0; } + } + /// /// Startup /// @@ -188,17 +198,12 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule // Please do not refactor these to be just one method // Existing implementations need the distinction // - public void ApplyUploadCharge(UUID agentID) - { - } - - public void ApplyGroupCreationCharge(UUID agentID) - { - } - public void ApplyCharge(UUID agentID, int amount, string text) { } + public void ApplyUploadCharge(UUID agentID, int amount, string text) + { + } public bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID, int amount) { @@ -769,7 +774,7 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule //m_log.Info("[FRIEND]: " + avatar.Name + " status:" + (!avatar.IsChildAgent).ToString()); } - public int GetBalance(IClientAPI client) + public int GetBalance(UUID agentID) { return 0; } @@ -777,16 +782,10 @@ namespace OpenSim.Region.OptionalModules.World.MoneyModule // Please do not refactor these to be just one method // Existing implementations need the distinction // - public bool UploadCovered(IClientAPI client) + public bool UploadCovered(IClientAPI client, int amount) { - return AmountCovered(client, PriceUpload); + return true; } - - public bool GroupCreationCovered(IClientAPI client) - { - return AmountCovered(client, PriceGroupCreate); - } - public bool AmountCovered(IClientAPI client, int amount) { return true;