diff options
author | Adam Frisby | 2008-04-23 12:21:54 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-23 12:21:54 +0000 |
commit | 3370d581e1c5297721a05db857a016e1d728018f (patch) | |
tree | f5e7721843e649a9cf6e760c0a61b7331f227118 /OpenSim/Region/ScriptEngine | |
parent | * Another bamboo fix (diff) | |
download | opensim-SC_OLD-3370d581e1c5297721a05db857a016e1d728018f.zip opensim-SC_OLD-3370d581e1c5297721a05db857a016e1d728018f.tar.gz opensim-SC_OLD-3370d581e1c5297721a05db857a016e1d728018f.tar.bz2 opensim-SC_OLD-3370d581e1c5297721a05db857a016e1d728018f.tar.xz |
* Patch #1026 - llDialog support -- Thanks Melanie!
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 63 |
1 files changed, 54 insertions, 9 deletions
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); |