diff options
Diffstat (limited to 'OpenSim/Region/Environment')
3 files changed, 53 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs index eae6702..49d096b 100644 --- a/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IMoneyModule.cs | |||
@@ -36,7 +36,10 @@ namespace OpenSim.Region.Environment.Interfaces | |||
36 | { | 36 | { |
37 | bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, | 37 | bool ObjectGiveMoney(LLUUID objectID, LLUUID fromID, LLUUID toID, |
38 | int amount); | 38 | int amount); |
39 | |||
40 | int GetBalance(IClientAPI client); | ||
39 | void ApplyUploadCharge(LLUUID agentID); | 41 | void ApplyUploadCharge(LLUUID agentID); |
42 | bool UploadCovered(IClientAPI client); | ||
40 | 43 | ||
41 | event ObjectPaid OnObjectPaid; | 44 | event ObjectPaid OnObjectPaid; |
42 | } | 45 | } |
diff --git a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs index fd407d9..d8720db 100644 --- a/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs +++ b/OpenSim/Region/Environment/Modules/Agent/AssetTransaction/AssetTransactionModule.cs | |||
@@ -261,6 +261,23 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction | |||
261 | public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, | 261 | public void HandleUDPUploadRequest(IClientAPI remoteClient, LLUUID assetID, LLUUID transaction, sbyte type, |
262 | byte[] data, bool storeLocal, bool tempFile) | 262 | byte[] data, bool storeLocal, bool tempFile) |
263 | { | 263 | { |
264 | if ((AssetType)type == AssetType.Texture || | ||
265 | (AssetType)type == AssetType.Sound || | ||
266 | (AssetType)type == AssetType.TextureTGA || | ||
267 | (AssetType)type == AssetType.Animation) | ||
268 | { | ||
269 | Scene scene = (Scene)remoteClient.Scene; | ||
270 | IMoneyModule mm = scene.RequestModuleInterface<IMoneyModule>(); | ||
271 | if (mm != null) | ||
272 | { | ||
273 | if (!mm.UploadCovered(remoteClient)) | ||
274 | { | ||
275 | remoteClient.SendAgentAlertMessage("Unable to upload asset. Insufficient funds.", false); | ||
276 | return; | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
264 | // Console.WriteLine("asset upload of " + assetID); | 281 | // Console.WriteLine("asset upload of " + assetID); |
265 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); | 282 | AgentAssetTransactions transactions = GetUserTransactions(remoteClient.AgentId); |
266 | 283 | ||
@@ -288,4 +305,4 @@ namespace OpenSim.Region.Environment.Modules.Agent.AssetTransaction | |||
288 | transactions.HandleXfer(xferID, packetID, data); | 305 | transactions.HandleXfer(xferID, packetID, data); |
289 | } | 306 | } |
290 | } | 307 | } |
291 | } \ No newline at end of file | 308 | } |
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 | ||