From 5d6f92fb9697dc09d26bba236846809c737fc5c0 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Sat, 23 Aug 2008 00:44:06 +0000 Subject: Patch #9171 Disallow bulk uploads if money module is present and upload cost is set and the user hasn't got sufficient funds. --- .../Currency/SampleMoney/SampleMoneyModule.cs | 37 +++++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Environment/Modules/Avatar/Currency') diff --git a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs index f038975..e31770f 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs @@ -266,11 +266,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney scene.SetObjectCapacity(ObjectCapacity); } - /// - /// New Client Event Handler - /// - /// - private void OnNewClient(IClientAPI client) + private void GetClientFunds(IClientAPI client) { // Here we check if we're in grid mode // I imagine that the 'check balance' @@ -343,6 +339,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney CheckExistAndRefreshFunds(client.AgentId); } + } + + /// + /// New Client Event Handler + /// + /// + private void OnNewClient(IClientAPI client) + { + GetClientFunds(client); + // Subscribe to Money messages client.OnEconomyDataRequest += EconomyDataRequestHandler; client.OnMoneyBalanceRequest += SendMoneyBalance; @@ -1525,6 +1531,27 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient); } + public int GetBalance(IClientAPI client) + { + GetClientFunds(client); + + lock(m_KnownClientFunds) + { + if (!m_KnownClientFunds.ContainsKey(client.AgentId)) + return 0; + + return m_KnownClientFunds[client.AgentId]; + } + } + + public bool UploadCovered(IClientAPI client) + { + if (GetBalance(client) < PriceUpload) + return false; + + return true; + } + #endregion } -- cgit v1.1