* Move general alert code to DialogModule.

* Should be a clean build - last failure looked like a mantis hiccup
0.6.2-post-fixes
Justin Clarke Casey 2009-01-07 20:29:09 +00:00
parent c084b07116
commit 1aa9e63428
5 changed files with 34 additions and 31 deletions

View File

@ -54,6 +54,12 @@ namespace OpenSim.Region.Environment.Interfaces
/// <param name="lastName"></param>
/// <param name="message"></param>
/// <param name="modal"></param>
void SendAlertToUser(string firstName, string lastName, string message, bool modal);
void SendAlertToUser(string firstName, string lastName, string message, bool modal);
/// <summary>
/// Send an alert messages to all avatars in the scene.
/// </summary>
/// <param name="message"></param>
void SendGeneralAlert(string message);
}
}

View File

@ -78,6 +78,21 @@ namespace OpenSim.Region.Environment.Modules.Avatar.Dialog
break;
}
}
}
/// <summary>
/// Send an alert messages to all avatars in this scene.
/// </summary>
/// <param name="message"></param>
public void SendGeneralAlert(string message)
{
List<ScenePresence> presenceList = m_scene.GetScenePresences();
foreach (ScenePresence presence in presenceList)
{
if (!presence.IsChildAgent)
presence.ControllingClient.SendAlertMessage(message);
}
}
}
}

View File

@ -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<IRegionSerialiserModule>();
m_interregionCommsOut = RequestModuleInterface<IInterregionCommsOut>();
m_interregionCommsIn = RequestModuleInterface<IInterregionCommsIn>();
m_dialogModule = RequestModuleInterface<IDialogModule>();
}
#endregion
@ -3428,25 +3430,8 @@ namespace OpenSim.Region.Environment.Scenes
#endregion
#region Console Commands
#region Alert Methods
/// <summary>
/// Send an alert messages to all avatars in this scene.
/// </summary>
/// <param name="message"></param>
public void SendGeneralAlert(string message)
{
List<ScenePresence> presenceList = GetScenePresences();
foreach (ScenePresence presence in presenceList)
{
if (!presence.IsChildAgent)
presence.ControllingClient.SendAlertMessage(message);
}
}
/// <summary>
/// Handle a request for admin rights
/// </summary>
@ -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<IDialogModule>();
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
/// <summary>

View File

@ -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)

View File

@ -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<IDialogModule>();
if (dm != null)
dm.SendGeneralAlert(msg);
}
public void osSetRot(UUID target, Quaternion rotation)