aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney
diff options
context:
space:
mode:
authorMelanie Thielker2008-08-23 00:44:06 +0000
committerMelanie Thielker2008-08-23 00:44:06 +0000
commit5d6f92fb9697dc09d26bba236846809c737fc5c0 (patch)
tree76637af39aaea0b30a19f322cadcdac5e301cb3f /OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney
parent* Homer's amazing terrain MapTileRenderer. Thanks Homer! (diff)
downloadopensim-SC-5d6f92fb9697dc09d26bba236846809c737fc5c0.zip
opensim-SC-5d6f92fb9697dc09d26bba236846809c737fc5c0.tar.gz
opensim-SC-5d6f92fb9697dc09d26bba236846809c737fc5c0.tar.bz2
opensim-SC-5d6f92fb9697dc09d26bba236846809c737fc5c0.tar.xz
Patch #9171
Disallow bulk uploads if money module is present and upload cost is set and the user hasn't got sufficient funds.
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney')
-rw-r--r--OpenSim/Region/Environment/Modules/Avatar/Currency/SampleMoney/SampleMoneyModule.cs37
1 files changed, 32 insertions, 5 deletions
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
266 scene.SetObjectCapacity(ObjectCapacity); 266 scene.SetObjectCapacity(ObjectCapacity);
267 } 267 }
268 268
269 /// <summary> 269 private void GetClientFunds(IClientAPI client)
270 /// New Client Event Handler
271 /// </summary>
272 /// <param name="client"></param>
273 private void OnNewClient(IClientAPI client)
274 { 270 {
275 // Here we check if we're in grid mode 271 // Here we check if we're in grid mode
276 // I imagine that the 'check balance' 272 // I imagine that the 'check balance'
@@ -343,6 +339,16 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
343 CheckExistAndRefreshFunds(client.AgentId); 339 CheckExistAndRefreshFunds(client.AgentId);
344 } 340 }
345 341
342 }
343
344 /// <summary>
345 /// New Client Event Handler
346 /// </summary>
347 /// <param name="client"></param>
348 private void OnNewClient(IClientAPI client)
349 {
350 GetClientFunds(client);
351
346 // Subscribe to Money messages 352 // Subscribe to Money messages
347 client.OnEconomyDataRequest += EconomyDataRequestHandler; 353 client.OnEconomyDataRequest += EconomyDataRequestHandler;
348 client.OnMoneyBalanceRequest += SendMoneyBalance; 354 client.OnMoneyBalanceRequest += SendMoneyBalance;
@@ -1525,6 +1531,27 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Currency.SampleMoney
1525 DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient); 1531 DeadAvatar.Scene.TeleportClientHome(DeadAvatar.UUID, DeadAvatar.ControllingClient);
1526 } 1532 }
1527 1533
1534 public int GetBalance(IClientAPI client)
1535 {
1536 GetClientFunds(client);
1537
1538 lock(m_KnownClientFunds)
1539 {
1540 if (!m_KnownClientFunds.ContainsKey(client.AgentId))
1541 return 0;
1542
1543 return m_KnownClientFunds[client.AgentId];
1544 }
1545 }
1546
1547 public bool UploadCovered(IClientAPI client)
1548 {
1549 if (GetBalance(client) < PriceUpload)
1550 return false;
1551
1552 return true;
1553 }
1554
1528 #endregion 1555 #endregion
1529 } 1556 }
1530 1557