From 25265c964f22a34fa3757ae487c15744f1da5850 Mon Sep 17 00:00:00 2001 From: Marck Date: Wed, 16 Feb 2011 18:34:44 +0100 Subject: Changed console command "alert" and added new command "alert-user". This addresses Mantis #4709. Command "alert" always sends a message to everybody; the variant "alert general" has been removed. Sending messages to one user is done with the dedicated command "alert-user". --- .../CoreModules/Avatar/Dialog/DialogModule.cs | 60 +++++++--------------- 1 file changed, 18 insertions(+), 42 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Dialog') diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 2b3d2a9..8a977c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs @@ -49,16 +49,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { m_scene = scene; m_scene.RegisterModuleInterface(this); - + m_scene.AddCommand( - this, "alert", "alert ", - "Send an alert to a user", + this, "alert", "alert ", + "Send an alert to everyone", HandleAlertConsoleCommand); m_scene.AddCommand( - this, "alert general", "alert [general] ", - "Send an alert to everyone", - "If keyword 'general' is omitted, then must be surrounded by quotation marks.", + this, "alert-user", "alert-user ", + "Send an alert to a user", HandleAlertConsoleCommand); } @@ -177,55 +176,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog { if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) return; - - bool isGeneral = false; - string firstName = string.Empty; - string lastName = string.Empty; + string message = string.Empty; - if (cmdparams.Length > 1) - { - firstName = cmdparams[1]; - isGeneral = firstName.ToLower().Equals("general"); - } - if (cmdparams.Length == 2 && !isGeneral) + if (cmdparams[0].ToLower().Equals("alert")) { - // alert "message" - message = cmdparams[1]; - isGeneral = true; - } - else if (cmdparams.Length > 2 && isGeneral) - { - // alert general - message = CombineParams(cmdparams, 2); + message = CombineParams(cmdparams, 1); + m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", + m_scene.RegionInfo.RegionName, message); + SendGeneralAlert(message); } else if (cmdparams.Length > 3) { - // alert - lastName = cmdparams[2]; + string firstName = cmdparams[1]; + string lastName = cmdparams[2]; message = CombineParams(cmdparams, 3); + m_log.InfoFormat( + "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", + m_scene.RegionInfo.RegionName, firstName, lastName, message); + SendAlertToUser(firstName, lastName, message, false); } else { OpenSim.Framework.Console.MainConsole.Instance.Output( - "Usage: alert \"message\" | alert general | alert "); + "Usage: alert | alert-user "); return; } - - if (isGeneral) - { - m_log.InfoFormat( - "[DIALOG]: Sending general alert in region {0} with message {1}", - m_scene.RegionInfo.RegionName, message); - SendGeneralAlert(message); - } - else - { - m_log.InfoFormat( - "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", - m_scene.RegionInfo.RegionName, firstName, lastName, message); - SendAlertToUser(firstName, lastName, message, false); - } } private string CombineParams(string[] commandParams, int pos) -- cgit v1.1