Add some additional checks to llTransferLindenDollars.

LSLKeyTest
Melanie Thielker 2016-07-18 11:12:14 +01:00
parent 9b4e83caa0
commit 2cffa71be2
2 changed files with 23 additions and 6 deletions

View File

@ -32,14 +32,13 @@ namespace OpenSim.Framework
public delegate void ObjectPaid(UUID objectID, UUID agentID, int amount);
public interface IMoneyModule
{
bool ObjectGiveMoney(UUID objectID, UUID fromID, UUID toID,
int amount, UUID txn, out string reason);
bool ObjectGiveMoney(UUID objectID, UUID fromID,
UUID toID, int amount, UUID txn, out string reason);
int GetBalance(UUID agentID);
bool UploadCovered(UUID agentID, int amount);
bool AmountCovered(UUID agentID, int amount);
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type);
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData);
void ApplyCharge(UUID agentID, int amount, MoneyTransactionType type, string extraData = "");
void ApplyUploadCharge(UUID agentID, int amount, string text);
void MoveMoney(UUID fromUser, UUID toUser, int amount, string text);

View File

@ -15678,6 +15678,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
try
{
if (amount <= 0)
{
replydata = "INVALID_AMOUNT";
return;
}
TaskInventoryItem item = m_item;
if (item == null)
{
@ -15685,6 +15691,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
if (m_host.OwnerID == m_host.GroupID)
{
replydata = "GROUP_OWNED";
return;
}
m_host.AddScriptLPS(1);
if (item.PermsGranter == UUID.Zero)
@ -15707,6 +15719,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return;
}
UserAccount account = World.UserAccountService.GetUserAccount(World.RegionInfo.ScopeID, toID);
if (account == null)
{
replydata = "LINDENDOLLAR_ENTITYDOESNOTEXIST";
return;
}
IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
if (money == null)
@ -15716,8 +15735,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
}
string reason;
bool result = money.ObjectGiveMoney(
m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
bool result = money.ObjectGiveMoney( m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount, txn, out reason);
if (result)
{