From 2dcf73dd93f2bc8993c2f534ef5ee8c72e24d0f3 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 6 Mar 2010 14:13:12 -0600 Subject: - supporting llTextBox Signed-off-by: Melanie --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 20 +++++++++++++++ .../CoreModules/Avatar/Dialog/DialogModule.cs | 26 ++++++++++++++++++- .../Region/Examples/SimpleModule/MyNpcCharacter.cs | 4 +++ .../Region/Framework/Interfaces/IDialogModule.cs | 5 ++++ .../Server/IRCClientView.cs | 4 +++ .../Region/OptionalModules/World/NPC/NPCAvatar.cs | 4 +++ .../Shared/Api/Implementation/LSL_Api.cs | 29 ++++++++++++++++++++-- 7 files changed, 89 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 569dc8d..2e59457 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -11630,5 +11630,25 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(packet, ThrottleOutPacketType.Task); } + + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + ScriptDialogPacket dialog = (ScriptDialogPacket)PacketPool.Instance.GetPacket(PacketType.ScriptDialog); + dialog.Data.ObjectID = objectId; + dialog.Data.ChatChannel = chatChannel; + dialog.Data.ImageID = UUID.Zero; + dialog.Data.ObjectName = Util.StringToBytes256(objectname); + // this is the username of the *owner* + dialog.Data.FirstName = Util.StringToBytes256(ownerFirstName); + dialog.Data.LastName = Util.StringToBytes256(ownerLastName); + dialog.Data.Message = Util.StringToBytes256(message); + + + ScriptDialogPacket.ButtonsBlock[] buttons = new ScriptDialogPacket.ButtonsBlock[1]; + buttons[0] = new ScriptDialogPacket.ButtonsBlock(); + buttons[0].ButtonLabel = Util.StringToBytes256("!!llTextBox!!"); + dialog.Buttons = buttons; + OutPacket(dialog, ThrottleOutPacketType.Task); + } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index fac052a..b8e013c 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -25,6 +25,7 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; using System.Collections.Generic; using System.Reflection; using log4net; @@ -151,7 +152,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog // region as the sending avatar. SendNotificationToUsersInRegion(fromAvatarID, fromAvatarName, message); } - + + public void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid) + { + UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, ownerid); + string ownerFirstName, ownerLastName; + if (account != null) + { + ownerFirstName = account.FirstName; + ownerLastName = account.LastName; + } + else + { + ownerFirstName = "(unknown"; + ownerLastName = "user)"; + } + + + ScenePresence sp = m_scene.GetScenePresence(avatarid); + + if (sp != null) { + sp.ControllingClient.SendTextBoxRequest(message, chatChannel, name, ownerFirstName, ownerLastName, objectid); + } + } + public void SendNotificationToUsersInRegion( UUID fromAvatarID, string fromAvatarName, string message) { diff --git a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs index a1957d1..7fdddc3 100644 --- a/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs +++ b/OpenSim/Region/Examples/SimpleModule/MyNpcCharacter.cs @@ -1153,5 +1153,9 @@ namespace OpenSim.Region.Examples.SimpleModule public void SendChangeUserRights(UUID agentID, UUID friendID, int rights) { } + + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + } } } diff --git a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs index ce57c44..35b4b63 100644 --- a/OpenSim/Region/Framework/Interfaces/IDialogModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IDialogModule.cs @@ -131,5 +131,10 @@ namespace OpenSim.Region.Framework.Interfaces /// The name of the user doing the sending /// The message being sent to the user void SendNotificationToUsersInEstate(UUID fromAvatarID, string fromAvatarName, string message); + + /// + /// Send a textbox entry for the client to respond to + /// + void SendTextBoxToUser(UUID avatarid, string message, int chatChannel, string name, UUID objectid, UUID ownerid); } } diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 96530a1..f2253f2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -1679,5 +1679,9 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public void SendChangeUserRights(UUID agentID, UUID friendID, int rights) { } + + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + } } } diff --git a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs index f8ab8d8..65445d9 100644 --- a/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs +++ b/OpenSim/Region/OptionalModules/World/NPC/NPCAvatar.cs @@ -1159,5 +1159,9 @@ namespace OpenSim.Region.OptionalModules.World.NPC public void SendChangeUserRights(UUID agentID, UUID friendID, int rights) { } + + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + } } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0a871d9..6f68305 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4009,10 +4009,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ScriptSleep(5000); } - public void llTextBox(string avatar, string message, int chat_channel) + public void llTextBox(string agent, string message, int chatChannel) { + IDialogModule dm = World.RequestModuleInterface(); + + if (dm == null) + return; + m_host.AddScriptLPS(1); - NotImplemented("llTextBox"); + UUID av = new UUID(); + if (!UUID.TryParse(agent,out av)) + { + LSLError("First parameter to llDialog needs to be a key"); + return; + } + + if( message == string.Empty) + { + ShoutError("Trying to use llTextBox with empty message."); + } + else if (message.Length > 512) + { + ShoutError("Trying to use llTextBox with message over 512 characters."); + } + else + { + dm.SendTextBoxToUser(av, message, chatChannel, m_host.Name, m_host.UUID, m_host.OwnerID); + ScriptSleep(1000); + } } public void llModifyLand(int action, int brush) @@ -4027,6 +4051,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public void llCollisionSound(string impact_sound, double impact_volume) { + m_host.AddScriptLPS(1); // TODO: Parameter check logic required. UUID soundId = UUID.Zero; -- cgit v1.1 From 89a739b45f0384cd9fc0801ce71be7976f16a999 Mon Sep 17 00:00:00 2001 From: Melanie Date: Sun, 7 Mar 2010 16:05:24 +0000 Subject: Small consistency change --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6f68305..59db81e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5900,7 +5900,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api for (int i = 0; i < rules.Length; i += 2) { - switch (Convert.ToInt32(rules.Data[i])) + switch (rules.GetLSLIntegerItem(i)) { case (int)ScriptBaseClass.PSYS_PART_FLAGS: prules.PartDataFlags = (Primitive.ParticleSystem.ParticleDataFlags)(uint)rules.GetLSLIntegerItem(i + 1); @@ -9871,4 +9871,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } } -} \ No newline at end of file +} -- cgit v1.1