From 0b6e332e16cd7df588d3502318a722706d78928c Mon Sep 17 00:00:00 2001 From: MW Date: Thu, 19 Jul 2007 10:44:19 +0000 Subject: Added some Alert methods to Scene , and a console command handler. So from the console to send alerts use : alert general , for a instance wide message , or use alert firstname secondname to send a alert to one user. (TODO: add region wide messages). --- OpenSim/Region/Environment/Scenes/Scene.cs | 54 ++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 7ed4c96..f435681 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -910,5 +910,59 @@ namespace OpenSim.Region.Environment.Scenes } #endregion + + #region Alert Methods + public void SendGeneralAlert(string message) + { + foreach (ScenePresence presence in this.Avatars.Values) + { + presence.ControllingClient.SendAlertMessage(message); + } + } + + public void SendAlertToUser(LLUUID agentID, string message, bool modal) + { + if (this.Avatars.ContainsKey(agentID)) + { + this.Avatars[agentID].ControllingClient.SendAgentAlertMessage(message, modal); + } + } + + public void SendAlertToUser(string firstName, string lastName, string message, bool modal) + { + foreach (ScenePresence presence in this.Avatars.Values) + { + if ((presence.firstname == firstName) && (presence.lastname == lastName)) + { + presence.ControllingClient.SendAgentAlertMessage(message, modal); + break; + } + } + } + + public void HandleAlertCommand(string[] commandParams) + { + if (commandParams[0] == "general") + { + string message = this.CombineParams(commandParams, 1); + this.SendGeneralAlert(message); + } + else + { + string message = this.CombineParams(commandParams, 2); + this.SendAlertToUser(commandParams[0], commandParams[1], message, false); + } + } + + private string CombineParams(string[] commandParams, int pos) + { + string result = ""; + for (int i = pos; i < commandParams.Length; i++) + { + result += commandParams[i]+ " "; + } + return result; + } + #endregion } } \ No newline at end of file -- cgit v1.1