* refactor: move code for sending a message to all users in a region to the DialogModule

0.6.2-post-fixes
Justin Clarke Casey 2009-01-08 18:50:46 +00:00
parent b0a59c3bf3
commit 17f783457b
5 changed files with 42 additions and 41 deletions

View File

@ -6056,9 +6056,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
(float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)), (float)Convert.ToDecimal(Utils.BytesToString(messagePacket.ParamList[5].Parameter)),
Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)), Convert.ToInt16(Utils.BytesToString(messagePacket.ParamList[6].Parameter)),
convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter)); convertParamStringToBool(messagePacket.ParamList[7].Parameter), convertParamStringToBool(messagePacket.ParamList[8].Parameter));
} }
break; break;
// case "texturebase": // case "texturebase":
// if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false)) // if (((Scene)m_scene).Permissions.CanIssueEstateCommand(AgentId, false))

View File

@ -34,7 +34,8 @@ namespace OpenSim.Region.Environment.Interfaces
public interface IDialogModule public interface IDialogModule
{ {
/// <summary> /// <summary>
/// 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.
/// </summary> /// </summary>
/// <param name="client"></param> /// <param name="client"></param>
/// <param name="message"></param> /// <param name="message"></param>
@ -73,9 +74,22 @@ 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);
/// <summary> /// <summary>
/// Send an alert messages to all avatars in the scene. /// Send an alert message to all users in the scene.
/// </summary> /// </summary>
/// <param name="message"></param> /// <param name="message"></param>
void SendGeneralAlert(string message); void SendGeneralAlert(string message);
/// <summary>
/// Send a notification to all users in the scene. This notification should remain around until the
/// user explicitly dismisses it.
/// </summary>
///
/// On the Linden Labs Second Client (as of 1.21), this is a big blue box message on the upper right of the
/// screen.
///
/// <param name="fromAvatarID">The user sending the message</param>
/// <param name="fromAvatarName">The name of the user doing the sending</param>
/// <param name="message">The message being sent to the user</param>
void SendNotificationToUsersInRegion(UUID fromAvatarID, string fromAvatarName, string message);
} }
} }

View File

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

View File

@ -51,8 +51,6 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice) 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; uint sun = 0;
if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime) 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) 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<IDialogModule>();
if (dm != null)
dm.SendNotificationToUsersInRegion(senderID, senderName, message);
} }
private void SendEstateBlueBoxMessage(IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message) private void SendEstateBlueBoxMessage(IClientAPI remote_client, UUID invoice, UUID senderID, UUID sessionID, string senderName, string message)

View File

@ -559,11 +559,11 @@ namespace OpenSim.Region.Environment.Scenes
m_incrementsof15seconds = (int)seconds / 15; m_incrementsof15seconds = (int)seconds / 15;
m_RestartTimerCounter = 0; m_RestartTimerCounter = 0;
m_restartTimer.AutoReset = true; m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed); m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Error("[REGION]: Restarting Region in " + (seconds / 60) + " minutes"); m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start(); m_restartTimer.Start();
SendRegionMessageFromEstateTools(UUID.Random(), UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in 2 Minutes"); m_dialogModule.SendNotificationToUsersInRegion(
//SendGeneralAlert(RegionInfo.RegionName + ": Restarting in 2 Minutes"); 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 <= m_incrementsof15seconds)
{ {
if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7) if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
SendRegionMessageFromEstateTools(UUID.Random(), UUID.Random(), String.Empty, RegionInfo.RegionName + ": Restarting in " + m_dialogModule.SendNotificationToUsersInRegion(
((8 - m_RestartTimerCounter) * 15) + " seconds"); UUID.Random(),
String.Empty,
// SendGeneralAlert(RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter)*15) + RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
//" seconds");
} }
else else
{ {
@ -3475,25 +3474,6 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
/// <summary>
/// Sends a Big Blue Box message on the upper right of the screen to the client
/// for all agents in the region
/// </summary>
/// <param name="FromAvatarID">The person sending the message</param>
/// <param name="fromSessionID">The session of the person sending the message</param>
/// <param name="FromAvatarName">The name of the person doing the sending</param>
/// <param name="Message">The Message being sent to the user</param>
public void SendRegionMessageFromEstateTools(UUID FromAvatarID, UUID fromSessionID, String FromAvatarName, String Message)
{
List<ScenePresence> presenceList = GetScenePresences();
foreach (ScenePresence presence in presenceList)
{
if (!presence.IsChildAgent)
presence.ControllingClient.SendBlueBoxMessage(FromAvatarID, FromAvatarName, Message);
}
}
/// <summary> /// <summary>
/// Sends a Big Blue Box message on the upper right of the screen to the client /// Sends a Big Blue Box message on the upper right of the screen to the client
/// for all agents in the estate /// for all agents in the estate