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 --- OpenSim/Client/MXP/ClientStack/MXPClientView.cs | 4 +++ .../Sirikata/ClientStack/SirikataClientView.cs | 4 +++ .../Client/VWoHTTP/ClientStack/VWHClientView.cs | 4 +++ OpenSim/Framework/IClientAPI.cs | 1 + .../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 ++++++++++++++++++++-- OpenSim/Tests/Common/Mock/TestClient.cs | 4 +++ 12 files changed, 106 insertions(+), 3 deletions(-) diff --git a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs index cf87a30..7b435f5 100644 --- a/OpenSim/Client/MXP/ClientStack/MXPClientView.cs +++ b/OpenSim/Client/MXP/ClientStack/MXPClientView.cs @@ -1710,5 +1710,9 @@ namespace OpenSim.Client.MXP.ClientStack 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/Client/Sirikata/ClientStack/SirikataClientView.cs b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs index 56f5f8f..e2986d9 100644 --- a/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs +++ b/OpenSim/Client/Sirikata/ClientStack/SirikataClientView.cs @@ -1199,6 +1199,10 @@ namespace OpenSim.Client.Sirikata.ClientStack { } + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + } + #endregion } } diff --git a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs index b8f46dc..c4f2016 100644 --- a/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs +++ b/OpenSim/Client/VWoHTTP/ClientStack/VWHClientView.cs @@ -1214,5 +1214,9 @@ namespace OpenSim.Client.VWoHTTP.ClientStack 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/Framework/IClientAPI.cs b/OpenSim/Framework/IClientAPI.cs index 82b5968..0c268bf 100644 --- a/OpenSim/Framework/IClientAPI.cs +++ b/OpenSim/Framework/IClientAPI.cs @@ -1479,5 +1479,6 @@ namespace OpenSim.Framework void SendGroupTransactionsSummaryDetails(IClientAPI sender,UUID groupID, UUID transactionID, UUID sessionID,int amt); void SendChangeUserRights(UUID agentID, UUID friendID, int rights); + void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId); } } 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; diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 6403c1b..7b46e95 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -1213,5 +1213,9 @@ namespace OpenSim.Tests.Common.Mock public void SendChangeUserRights(UUID agentID, UUID friendID, int rights) { } + + public void SendTextBoxRequest(string message, int chatChannel, string objectname, string ownerFirstName, string ownerLastName, UUID objectId) + { + } } } -- cgit v1.1