aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
authorMelanie2013-01-23 18:58:29 +0100
committerMelanie2013-01-23 19:45:36 +0000
commit6a2b673fca6fcff4e358cf4ef6bd773f8a0488ba (patch)
tree2ca64915b5af8719a7247b4fc966c51fa5d07a0e /OpenSim/Region/ScriptEngine/Shared/Api
parentMerge branch 'master' of /home/opensim/var/repo/opensim (diff)
downloadopensim-SC_OLD-6a2b673fca6fcff4e358cf4ef6bd773f8a0488ba.zip
opensim-SC_OLD-6a2b673fca6fcff4e358cf4ef6bd773f8a0488ba.tar.gz
opensim-SC_OLD-6a2b673fca6fcff4e358cf4ef6bd773f8a0488ba.tar.bz2
opensim-SC_OLD-6a2b673fca6fcff4e358cf4ef6bd773f8a0488ba.tar.xz
Remove the return value from llGiveMoney and add llTransferLindenDollars. Also
make llGiveMoney async so the script thread is not held up waiting for comms to an external server.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs135
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs3
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs9
3 files changed, 114 insertions, 33 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 507c399..632b73f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -2738,42 +2738,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
2738 return src.ToLower(); 2738 return src.ToLower();
2739 } 2739 }
2740 2740
2741 public LSL_Integer llGiveMoney(string destination, int amount) 2741 public void llGiveMoney(string destination, int amount)
2742 { 2742 {
2743 m_host.AddScriptLPS(1); 2743 Util.FireAndForget(x =>
2744
2745 if (m_item.PermsGranter == UUID.Zero)
2746 return 0;
2747
2748 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2749 { 2744 {
2750 LSLError("No permissions to give money"); 2745 m_host.AddScriptLPS(1);
2751 return 0;
2752 }
2753 2746
2754 UUID toID = new UUID(); 2747 if (m_item.PermsGranter == UUID.Zero)
2748 return;
2755 2749
2756 if (!UUID.TryParse(destination, out toID)) 2750 if ((m_item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
2757 { 2751 {
2758 LSLError("Bad key in llGiveMoney"); 2752 LSLError("No permissions to give money");
2759 return 0; 2753 return;
2760 } 2754 }
2761 2755
2762 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>(); 2756 UUID toID = new UUID();
2763 2757
2764 if (money == null) 2758 if (!UUID.TryParse(destination, out toID))
2765 { 2759 {
2766 NotImplemented("llGiveMoney"); 2760 LSLError("Bad key in llGiveMoney");
2767 return 0; 2761 return;
2768 } 2762 }
2769 2763
2770 bool result = money.ObjectGiveMoney( 2764 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
2771 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
2772 2765
2773 if (result) 2766 if (money == null)
2774 return 1; 2767 {
2768 NotImplemented("llGiveMoney");
2769 return;
2770 }
2775 2771
2776 return 0; 2772 money.ObjectGiveMoney(
2773 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
2774 });
2777 } 2775 }
2778 2776
2779 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset) 2777 public void llMakeExplosion(int particles, double scale, double vel, double lifetime, double arc, string texture, LSL_Vector offset)
@@ -6839,7 +6837,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6839 { 6837 {
6840 m_host.AddScriptLPS(1); 6838 m_host.AddScriptLPS(1);
6841 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6839 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6842 if (xmlrpcMod.IsEnabled()) 6840 if (xmlrpcMod != null && xmlrpcMod.IsEnabled())
6843 { 6841 {
6844 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero); 6842 UUID channelID = xmlrpcMod.OpenXMLRPCChannel(m_host.LocalId, m_item.ItemID, UUID.Zero);
6845 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>(); 6843 IXmlRpcRouter xmlRpcRouter = m_ScriptEngine.World.RequestModuleInterface<IXmlRpcRouter>();
@@ -6871,6 +6869,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6871 m_host.AddScriptLPS(1); 6869 m_host.AddScriptLPS(1);
6872 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6870 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6873 ScriptSleep(3000); 6871 ScriptSleep(3000);
6872 if (xmlrpcMod == null)
6873 return "";
6874 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString(); 6874 return (xmlrpcMod.SendRemoteData(m_host.LocalId, m_item.ItemID, channel, dest, idata, sdata)).ToString();
6875 } 6875 }
6876 6876
@@ -6878,7 +6878,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6878 { 6878 {
6879 m_host.AddScriptLPS(1); 6879 m_host.AddScriptLPS(1);
6880 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6880 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6881 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata); 6881 if (xmlrpcMod != null)
6882 xmlrpcMod.RemoteDataReply(channel, message_id, sdata, idata);
6882 ScriptSleep(3000); 6883 ScriptSleep(3000);
6883 } 6884 }
6884 6885
@@ -6893,7 +6894,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
6893 } 6894 }
6894 6895
6895 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>(); 6896 IXMLRPC xmlrpcMod = m_ScriptEngine.World.RequestModuleInterface<IXMLRPC>();
6896 xmlrpcMod.CloseXMLRPCChannel((UUID)channel); 6897 if (xmlrpcMod != null)
6898 xmlrpcMod.CloseXMLRPCChannel((UUID)channel);
6897 ScriptSleep(1000); 6899 ScriptSleep(1000);
6898 } 6900 }
6899 6901
@@ -11554,6 +11556,79 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
11554 NotImplemented("llGodLikeRezObject"); 11556 NotImplemented("llGodLikeRezObject");
11555 } 11557 }
11556 11558
11559 public LSL_String llTransferLindenDollars(string destination, int amount)
11560 {
11561 UUID txn = UUID.Random();
11562
11563 Util.FireAndForget(delegate(object x)
11564 {
11565 int replycode = 0;
11566 string replydata = destination + "," + amount.ToString();
11567
11568 try
11569 {
11570 TaskInventoryItem item = m_item;
11571 if (item == null)
11572 {
11573 replydata = "SERVICE_ERROR";
11574 return;
11575 }
11576
11577 m_host.AddScriptLPS(1);
11578
11579 if (item.PermsGranter == UUID.Zero)
11580 {
11581 replydata = "MISSING_PERMISSION_DEBIT";
11582 return;
11583 }
11584
11585 if ((item.PermsMask & ScriptBaseClass.PERMISSION_DEBIT) == 0)
11586 {
11587 replydata = "MISSING_PERMISSION_DEBIT";
11588 return;
11589 }
11590
11591 UUID toID = new UUID();
11592
11593 if (!UUID.TryParse(destination, out toID))
11594 {
11595 replydata = "INVALID_AGENT";
11596 return;
11597 }
11598
11599 IMoneyModule money = World.RequestModuleInterface<IMoneyModule>();
11600
11601 if (money == null)
11602 {
11603 replydata = "TRANSFERS_DISABLED";
11604 return;
11605 }
11606
11607 bool result = money.ObjectGiveMoney(
11608 m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
11609
11610 if (result)
11611 {
11612 replycode = 1;
11613 return;
11614 }
11615
11616 replydata = "LINDENDOLLAR_INSUFFICIENTFUNDS";
11617 }
11618 finally
11619 {
11620 m_ScriptEngine.PostScriptEvent(m_item.ItemID, new EventParams(
11621 "transaction_result", new Object[] {
11622 new LSL_String(txn.ToString()),
11623 new LSL_Integer(replycode),
11624 new LSL_String(replydata) },
11625 new DetectParams[0]));
11626 }
11627 });
11628
11629 return txn.ToString();
11630 }
11631
11557 #endregion 11632 #endregion
11558 } 11633 }
11559 11634
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
index 98f8be7..4ac179a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs
@@ -207,7 +207,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
207 LSL_Float llGetWallclock(); 207 LSL_Float llGetWallclock();
208 void llGiveInventory(string destination, string inventory); 208 void llGiveInventory(string destination, string inventory);
209 void llGiveInventoryList(string destination, string category, LSL_List inventory); 209 void llGiveInventoryList(string destination, string category, LSL_List inventory);
210 LSL_Integer llGiveMoney(string destination, int amount); 210 void llGiveMoney(string destination, int amount);
211 LSL_String llTransferLindenDollars(string destination, int amount);
211 void llGodLikeRezObject(string inventory, LSL_Vector pos); 212 void llGodLikeRezObject(string inventory, LSL_Vector pos);
212 LSL_Float llGround(LSL_Vector offset); 213 LSL_Float llGround(LSL_Vector offset);
213 LSL_Vector llGroundContour(LSL_Vector offset); 214 LSL_Vector llGroundContour(LSL_Vector offset);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
index 36803a4..c7a7cf6 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs
@@ -869,9 +869,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
869 m_LSL_Functions.llGiveInventoryList(destination, category, inventory); 869 m_LSL_Functions.llGiveInventoryList(destination, category, inventory);
870 } 870 }
871 871
872 public LSL_Integer llGiveMoney(string destination, int amount) 872 public void llGiveMoney(string destination, int amount)
873 { 873 {
874 return m_LSL_Functions.llGiveMoney(destination, amount); 874 m_LSL_Functions.llGiveMoney(destination, amount);
875 }
876
877 public LSL_String llTransferLindenDollars(string destination, int amount)
878 {
879 return m_LSL_Functions.llTransferLindenDollars(destination, amount);
875 } 880 }
876 881
877 public void llGodLikeRezObject(string inventory, LSL_Vector pos) 882 public void llGodLikeRezObject(string inventory, LSL_Vector pos)