Disallow bulk uploads if money module is present and upload cost
is set and the user hasn't got sufficient funds.
This commit is contained in:
Melanie Thielker
2008-08-23 00:44:06 +00:00
parent 50bf3618a3
commit 5d6f92fb96
5 changed files with 80 additions and 6 deletions

View File

@@ -266,11 +266,7 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
scene.SetObjectCapacity(ObjectCapacity);
}
/// <summary>
/// New Client Event Handler
/// </summary>
/// <param name="client"></param>
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);
}
}
/// <summary>
/// New Client Event Handler
/// </summary>
/// <param name="client"></param>
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
}