mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 01:35:46 +08:00
Patch #9171
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user