From 1aa9e6342829201e29290638fbb23baae8702193 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 7 Jan 2009 20:29:09 +0000 Subject: * Move general alert code to DialogModule. * Should be a clean build - last failure looked like a mantis hiccup --- .../Region/Environment/Interfaces/IDialogModule.cs | 8 ++++- .../Modules/Avatar/Dialog/DialogModule.cs | 15 ++++++++++ OpenSim/Region/Environment/Scenes/Scene.cs | 34 ++++------------------ OpenSim/Region/Environment/Scenes/SceneManager.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 6 +++- 5 files changed, 34 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs index 15f0471..1e5c791 100644 --- a/OpenSim/Region/Environment/Interfaces/IDialogModule.cs +++ b/OpenSim/Region/Environment/Interfaces/IDialogModule.cs @@ -54,6 +54,12 @@ namespace OpenSim.Region.Environment.Interfaces /// /// /// - void SendAlertToUser(string firstName, string lastName, string message, bool modal); + void SendAlertToUser(string firstName, string lastName, string message, bool modal); + + /// + /// Send an alert messages to all avatars in the scene. + /// + /// + void SendGeneralAlert(string message); } } diff --git a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs index e036c73..14a05ae 100644 --- a/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/Environment/Modules/Avatar/Dialog/DialogModule.cs @@ -78,6 +78,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog break; } } + } + + /// + /// Send an alert messages to all avatars in this scene. + /// + /// + public void SendGeneralAlert(string message) + { + List presenceList = m_scene.GetScenePresences(); + + foreach (ScenePresence presence in presenceList) + { + if (!presence.IsChildAgent) + presence.ControllingClient.SendAlertMessage(message); + } } } } diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index c3f2417..43354e6 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -148,6 +148,7 @@ namespace OpenSim.Region.Environment.Scenes protected IRegionSerialiserModule m_serialiser; protected IInterregionCommsOut m_interregionCommsOut; protected IInterregionCommsIn m_interregionCommsIn; + protected IDialogModule m_dialogModule; // Central Update Loop @@ -549,7 +550,7 @@ namespace OpenSim.Region.Environment.Scenes if (seconds < 15) { m_restartTimer.Stop(); - SendGeneralAlert("Restart Aborted"); + m_dialogModule.SendGeneralAlert("Restart Aborted"); } else { @@ -775,6 +776,7 @@ namespace OpenSim.Region.Environment.Scenes m_serialiser = RequestModuleInterface(); m_interregionCommsOut = RequestModuleInterface(); m_interregionCommsIn = RequestModuleInterface(); + m_dialogModule = RequestModuleInterface(); } #endregion @@ -3428,26 +3430,9 @@ namespace OpenSim.Region.Environment.Scenes #endregion - #region Console Commands - #region Alert Methods /// - /// Send an alert messages to all avatars in this scene. - /// - /// - public void SendGeneralAlert(string message) - { - List presenceList = GetScenePresences(); - - foreach (ScenePresence presence in presenceList) - { - if (!presence.IsChildAgent) - presence.ControllingClient.SendAlertMessage(message); - } - } - - /// /// Handle a request for admin rights /// /// @@ -3616,17 +3601,12 @@ namespace OpenSim.Region.Environment.Scenes if (commandParams[0] == "general") { string message = CombineParams(commandParams, 1); - SendGeneralAlert(message); + m_dialogModule.SendGeneralAlert(message); } else { - IDialogModule dm = RequestModuleInterface(); - - if (dm != null) - { - string message = CombineParams(commandParams, 2); - dm.SendAlertToUser(commandParams[0], commandParams[1], message, false); - } + string message = CombineParams(commandParams, 2); + m_dialogModule.SendAlertToUser(commandParams[0], commandParams[1], message, false); } } @@ -3727,8 +3707,6 @@ namespace OpenSim.Region.Environment.Scenes } } - #endregion - #region Script Handling Methods /// diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index d585b48..5541454 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -310,7 +310,7 @@ namespace OpenSim.Region.Environment.Scenes public void SendGeneralMessage(string msg) { - ForEachCurrentScene(delegate(Scene scene) { scene.SendGeneralAlert(msg); }); + ForEachCurrentScene(delegate(Scene scene) { scene.HandleAlertCommand(new string[] { "general", msg }); }); } public bool TrySetCurrentScene(string regionName) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8a380ad..a9ee88a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -329,7 +329,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.VeryHigh, "osRegionNotice"); m_host.AddScriptLPS(1); - World.SendGeneralAlert(msg); + + IDialogModule dm = World.RequestModuleInterface(); + + if (dm != null) + dm.SendGeneralAlert(msg); } public void osSetRot(UUID target, Quaternion rotation) -- cgit v1.1