aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/ClientStack/ClientView.cs27
-rw-r--r--OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs6
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs63
3 files changed, 87 insertions, 9 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs
index a58f88f..9e8830f 100644
--- a/OpenSim/Region/ClientStack/ClientView.cs
+++ b/OpenSim/Region/ClientStack/ClientView.cs
@@ -233,6 +233,7 @@ namespace OpenSim.Region.ClientStack
233 private RequestAsset handlerRequestAsset = null; // OnRequestAsset; 233 private RequestAsset handlerRequestAsset = null; // OnRequestAsset;
234 private UUIDNameRequest handlerTeleportHomeRequest = null; 234 private UUIDNameRequest handlerTeleportHomeRequest = null;
235 235
236 private ScriptAnswer handlerScriptAnswer = null;
236 237
237 /* Properties */ 238 /* Properties */
238 239
@@ -789,6 +790,8 @@ namespace OpenSim.Region.ClientStack
789 790
790 public event UUIDNameRequest OnTeleportHomeRequest; 791 public event UUIDNameRequest OnTeleportHomeRequest;
791 792
793 public event ScriptAnswer OnScriptAnswer;
794
792 #region Scene/Avatar to Client 795 #region Scene/Avatar to Client
793 796
794 /// <summary> 797 /// <summary>
@@ -2484,6 +2487,20 @@ namespace OpenSim.Region.ClientStack
2484 return true; 2487 return true;
2485 } 2488 }
2486 2489
2490 public void SendScriptQuestion(LLUUID taskID, string taskName, string ownerName, LLUUID itemID, int question)
2491 {
2492 ScriptQuestionPacket scriptQuestion = (ScriptQuestionPacket)PacketPool.Instance.GetPacket(PacketType.ScriptQuestion);
2493 scriptQuestion.Data = new ScriptQuestionPacket.DataBlock();
2494 // TODO: don't create new blocks if recycling an old packet
2495 scriptQuestion.Data.TaskID = taskID;
2496 scriptQuestion.Data.ItemID = itemID;
2497 scriptQuestion.Data.Questions = question;
2498 scriptQuestion.Data.ObjectName = Helpers.StringToField(taskName);
2499 scriptQuestion.Data.ObjectOwner = Helpers.StringToField(ownerName);
2500
2501 OutPacket(scriptQuestion, ThrottleOutPacketType.Task);
2502 }
2503
2487 protected virtual bool Logout(IClientAPI client, Packet packet) 2504 protected virtual bool Logout(IClientAPI client, Packet packet)
2488 { 2505 {
2489 m_log.Info("[CLIENT]: Got a logout request"); 2506 m_log.Info("[CLIENT]: Got a logout request");
@@ -3840,6 +3857,16 @@ namespace OpenSim.Region.ClientStack
3840 } 3857 }
3841 break; 3858 break;
3842 3859
3860 case PacketType.ScriptAnswerYes:
3861 ScriptAnswerYesPacket scriptAnswer = (ScriptAnswerYesPacket)Pack;
3862
3863 handlerScriptAnswer = OnScriptAnswer;
3864 if (handlerScriptAnswer != null)
3865 {
3866 handlerScriptAnswer(this, scriptAnswer.Data.TaskID, scriptAnswer.Data.ItemID, scriptAnswer.Data.Questions);
3867 }
3868 break;
3869
3843 #endregion 3870 #endregion
3844 3871
3845 #region Inventory/Asset/Other related packets 3872 #region Inventory/Asset/Other related packets
diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
index 199653d..4f9024c 100644
--- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
+++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs
@@ -166,6 +166,8 @@ namespace OpenSim.Region.Examples.SimpleModule
166 public event ObjectIncludeInSearch OnObjectIncludeInSearch; 166 public event ObjectIncludeInSearch OnObjectIncludeInSearch;
167 public event UUIDNameRequest OnTeleportHomeRequest; 167 public event UUIDNameRequest OnTeleportHomeRequest;
168 168
169 public event ScriptAnswer OnScriptAnswer;
170
169 171
170#pragma warning restore 67 172#pragma warning restore 67
171 173
@@ -593,5 +595,9 @@ namespace OpenSim.Region.Examples.SimpleModule
593 public void SetClientInfo(ClientInfo info) 595 public void SetClientInfo(ClientInfo info)
594 { 596 {
595 } 597 }
598
599 public void SendScriptQuestion(LLUUID objectID, string taskName, string ownerName, LLUUID itemID, int question)
600 {
601 }
596 } 602 }
597} 603}
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index a8eb824..3dff98f 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -69,6 +69,8 @@ namespace OpenSim.Region.ScriptEngine.Common
69 69
70 private DateTime m_timer = DateTime.Now; 70 private DateTime m_timer = DateTime.Now;
71 private string m_state = "default"; 71 private string m_state = "default";
72 private bool m_waitingForScriptAnswer=false;
73
72 74
73 public string State 75 public string State
74 { 76 {
@@ -1950,11 +1952,6 @@ namespace OpenSim.Region.ScriptEngine.Common
1950 1952
1951 m_host.AddScriptLPS(1); 1953 m_host.AddScriptLPS(1);
1952 1954
1953 // Cannot combine debit with anything else since the new debit perms dialog has been introduced.
1954 if((perm & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) != 0 &&
1955 perm != BuiltIn_Commands_BaseClass.PERMISSION_DEBIT)
1956 perm &= ~BuiltIn_Commands_BaseClass.PERMISSION_DEBIT;// Silently ignore debit request
1957
1958 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state 1955 bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state
1959 1956
1960 if(attachment && agent == m_host.OwnerID) 1957 if(attachment && agent == m_host.OwnerID)
@@ -1993,15 +1990,48 @@ namespace OpenSim.Region.ScriptEngine.Common
1993 } 1990 }
1994 } 1991 }
1995 1992
1996 // TODO: Implement perms dialog sending 1993 if (World.m_innerScene.ScenePresences.ContainsKey(agentID))
1994 {
1995 string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
1996 if(ownerName == String.Empty)
1997 ownerName="(hippos)";
1998
1999 ScenePresence presence = World.m_innerScene.ScenePresences[agentID];
2000 if(!m_waitingForScriptAnswer)
2001 {
2002 m_host.TaskInventory[invItemID].PermsGranter=agentID;
2003 m_host.TaskInventory[invItemID].PermsMask=0;
2004 presence.ControllingClient.OnScriptAnswer+=handleScriptAnswer;
2005 m_waitingForScriptAnswer=true;
2006 }
2007
2008 presence.ControllingClient.SendScriptQuestion(m_host.UUID, m_host.ParentGroup.RootPart.Name, ownerName, invItemID, perm);
2009 return;
2010 }
1997 2011
1998 // Refuse perms for now 2012 // Requested agent is not in range, refuse perms
1999 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue( 2013 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2000 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0}); 2014 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)0});
2001
2002 NotImplemented("llRequestPermissions");
2003 } 2015 }
2004 2016
2017 void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
2018 {
2019 if(taskID != m_host.UUID)
2020 return;
2021
2022 LLUUID invItemID=InventorySelf();
2023
2024 if(invItemID == LLUUID.Zero)
2025 return;
2026
2027 client.OnScriptAnswer-=handleScriptAnswer;
2028 m_waitingForScriptAnswer=false;
2029
2030 m_host.TaskInventory[invItemID].PermsMask=answer;
2031 m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(
2032 m_localID, m_itemID, "run_time_permissions", EventQueueManager.llDetectNull, new Object[] {(int)answer});
2033 }
2034
2005 public string llGetPermissionsKey() 2035 public string llGetPermissionsKey()
2006 { 2036 {
2007 m_host.AddScriptLPS(1); 2037 m_host.AddScriptLPS(1);
@@ -3924,9 +3954,24 @@ namespace OpenSim.Region.ScriptEngine.Common
3924 LSLError("First parameter to llDialog needs to be a key"); 3954 LSLError("First parameter to llDialog needs to be a key");
3925 return; 3955 return;
3926 } 3956 }
3957 if(buttons.Length > 12)
3958 {
3959 LSLError("No more than 12 buttons can be shown");
3960 return;
3961 }
3927 string[] buts = new string[buttons.Length]; 3962 string[] buts = new string[buttons.Length];
3928 for(int i = 0; i < buttons.Length; i++) 3963 for(int i = 0; i < buttons.Length; i++)
3929 { 3964 {
3965 if(buttons.Data[i].ToString() == String.Empty)
3966 {
3967 LSLError("button label cannot be blank");
3968 return;
3969 }
3970 if(buttons.Data[i].ToString().Length > 24)
3971 {
3972 LSLError("button label cannot be longer than 24 characters");
3973 return;
3974 }
3930 buts[i] = buttons.Data[i].ToString(); 3975 buts[i] = buttons.Data[i].ToString();
3931 } 3976 }
3932 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts); 3977 World.SendDialogToUser(av, m_host.Name, m_host.UUID, m_host.OwnerID, message, new LLUUID("00000000-0000-2222-3333-100000001000"), chat_channel, buts);