aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
authorJustin Clarke Casey2009-02-13 19:03:18 +0000
committerJustin Clarke Casey2009-02-13 19:03:18 +0000
commitd307109e1af20c5b1b27743853236d7842d871f0 (patch)
tree200d85452cadddc5b05ab90e311c2b373ec9d1b7 /OpenSim/Region/CoreModules
parent* Quieten down log messages from the Friends module (diff)
downloadopensim-SC_OLD-d307109e1af20c5b1b27743853236d7842d871f0.zip
opensim-SC_OLD-d307109e1af20c5b1b27743853236d7842d871f0.tar.gz
opensim-SC_OLD-d307109e1af20c5b1b27743853236d7842d871f0.tar.bz2
opensim-SC_OLD-d307109e1af20c5b1b27743853236d7842d871f0.tar.xz
* refactor: move alert commands from Scene to DialogModule
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs52
1 files changed, 51 insertions, 1 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
index 3fe57bc..6dd020a 100644
--- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs
@@ -26,6 +26,8 @@
26 */ 26 */
27 27
28using System.Collections.Generic; 28using System.Collections.Generic;
29using System.Reflection;
30using log4net;
29using Nini.Config; 31using Nini.Config;
30using OpenMetaverse; 32using OpenMetaverse;
31using OpenSim.Framework; 33using OpenSim.Framework;
@@ -36,7 +38,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
36{ 38{
37 public class DialogModule : IRegionModule, IDialogModule 39 public class DialogModule : IRegionModule, IDialogModule
38 { 40 {
39 //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 41 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
40 42
41 protected Scene m_scene; 43 protected Scene m_scene;
42 44
@@ -44,6 +46,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
44 { 46 {
45 m_scene = scene; 47 m_scene = scene;
46 m_scene.RegisterModuleInterface<IDialogModule>(this); 48 m_scene.RegisterModuleInterface<IDialogModule>(this);
49
50 m_scene.AddCommand(
51 this, "alert", "alert <first> <last> <message>", "Send an alert to a user", HandleAlertConsoleCommand);
52
53 m_scene.AddCommand(
54 this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand);
47 } 55 }
48 56
49 public void PostInitialise() {} 57 public void PostInitialise() {}
@@ -137,5 +145,47 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog
137 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message); 145 presence.ControllingClient.SendBlueBoxMessage(fromAvatarID, fromAvatarName, message);
138 } 146 }
139 } 147 }
148
149 /// <summary>
150 /// Handle an alert command from the console.
151 /// </summary>
152 /// <param name="module"></param>
153 /// <param name="cmdparams"></param>
154 public void HandleAlertConsoleCommand(string module, string[] cmdparams)
155 {
156 if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene)
157 return;
158
159 if (cmdparams[1] == "general")
160 {
161 string message = CombineParams(cmdparams, 2);
162
163 m_log.InfoFormat(
164 "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message);
165 SendGeneralAlert(message);
166 }
167 else
168 {
169 string firstName = cmdparams[1];
170 string lastName = cmdparams[2];
171 string message = CombineParams(cmdparams, 3);
172
173 m_log.InfoFormat(
174 "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}",
175 m_scene.RegionInfo.RegionName, firstName, lastName, message);
176 SendAlertToUser(firstName, lastName, message, false);
177 }
178 }
179
180 private string CombineParams(string[] commandParams, int pos)
181 {
182 string result = string.Empty;
183 for (int i = pos; i < commandParams.Length; i++)
184 {
185 result += commandParams[i] + " ";
186 }
187
188 return result;
189 }
140 } 190 }
141} 191}