From 17f783457b8dbd182f8184ef77c72d57d7c8da8b Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Thu, 8 Jan 2009 18:50:46 +0000 Subject: * refactor: move code for sending a message to all users in a region to the DialogModule --- .../Region/ClientStack/LindenUDP/LLClientView.cs | 2 -- .../Region/Environment/Interfaces/IDialogModule.cs | 20 ++++++++++-- .../Modules/Avatar/Dialog/DialogModule.cs | 18 ++++++++--- .../Modules/World/Estate/EstateManagementModule.cs | 7 +++-- OpenSim/Region/Environment/Scenes/Scene.cs | 36 +++++----------------- 5 files changed, 42 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 6742948..7398c70 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -6056,9 +6056,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); - } - break; // case "texturebase": // if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) diff --git a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs index a296c5a..4a648d6 100644 --- a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs @@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Interfaces public interface IDialogModule { /// - /// Send a non-modal alert message to a particular user. + /// Send a non-modal alert message to a particular user. This can disappear from the user's view after a + /// small interval. /// /// /// @@ -73,9 +74,22 @@ namespace OpenSim.Region.Environment.Interfaces void SendAlertToUser(string firstName, string lastName, string message, bool modal); /// - /// Send an alert messages to all avatars in the scene. + /// Send an alert message to all users in the scene. /// /// - void SendGeneralAlert(string message); + void SendGeneralAlert(string message); + + /// + /// Send a notification to all users in the scene. This notification should remain around until the + /// user explicitly dismisses it. + /// + /// + /// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the + /// screen. + /// + /// The user sending the message + /// The name of the user doing the sending + /// The message being sent to the user + void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message); } } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs index 430968d..b64ec71 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs @@ -90,10 +90,6 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog } } - /// - /// Send an alert messages to all avatars in this scene. - /// - /// public void SendGeneralAlert(string message) { List presenceList = m_scene.GetScenePresences(); @@ -103,6 +99,18 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog if (!presence.IsChildAgent) presence.ControllingClient.SendAlertMessage(message); } - } + } + + public void SendNotificationToUsersInRegion( + UUID fromAvatarID, string fromAvatarName, string message) + { + List presenceList = m_scene.GetScenePresences(); + + foreach (ScenePresence presence in presenceList) + { + if (!presence.IsChildAgent) + presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); + } + } } } diff --git a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs index 14450ae..33e354e 100644 --- a/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/Environment/Modules/World/Estate/EstateManagementModule.cs @@ -51,8 +51,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) { - //SendDetailedEstateData(UUID invoice, string estateName, uint estateID, uint parentEstate, uint estateFlags, uint sunPosition, UUID covenant) - uint sun = 0; if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) @@ -356,7 +354,10 @@ namespace OpenSim.Region.Environment.Modules.World.Estate private void SendSimulatorBlueBoxMessage(IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) { - m_scene.SendRegionMessageFromEstateTools(senderID, sessionID, senderName, message); + IDialogModule dm = m_scene.RequestModuleInterface(); + + if (dm != null) + dm.SendNotificationToUsersInRegion(senderID, senderName, message); } private void SendEstateBlueBoxMessage(IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index dea265e..134946b 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -559,11 +559,11 @@ namespace OpenSim.Region.Environment.Scenes m_incrementsof15seconds = (int)seconds / 15; m_RestartTimerCounter = 0; m_restartTimer.AutoReset = true; - m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); - m_log.Error("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); + m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); + m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_restartTimer.Start(); - SendRegionMessageFromEstateTools(UUID.Random(), UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); - //SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); + m_dialogModule.SendNotificationToUsersInRegion( + UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); } } @@ -577,11 +577,10 @@ namespace OpenSim.Region.Environment.Scenes if (m_RestartTimerCounter <= m_incrementsof15seconds) { if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) - SendRegionMessageFromEstateTools(UUID.Random(), UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + - ((8 - m_RestartTimerCounter) * 15) + " seconds"); - - // SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) + - //" seconds"); + m_dialogModule.SendNotificationToUsersInRegion( + UUID.Random(), + String.Empty, + RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds"); } else { @@ -3477,25 +3476,6 @@ namespace OpenSim.Region.Environment.Scenes /// /// Sends a Big Blue Box message on the upper right of the screen to the client - /// for all agents in the region - /// - /// The person sending the message - /// The session of the person sending the message - /// The name of the person doing the sending - /// The Message being sent to the user - public void SendRegionMessageFromEstateTools(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message) - { - List presenceList = GetScenePresences(); - - foreach (ScenePresence presence in presenceList) - { - if (!presence.IsChildAgent) - presence.ControllingClient.SendBlueBoxMessage(FromAvatarID, FromAvatarName, Message); - } - } - - /// - /// Sends a Big Blue Box message on the upper right of the screen to the client /// for all agents in the estate /// /// The person sending the message -- cgit v1.1