diff options
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 60 |
1 files changed, 18 insertions, 42 deletions
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 | |||
49 | { | 49 | { |
50 | m_scene = scene; | 50 | m_scene = scene; |
51 | m_scene.RegisterModuleInterface<IDialogModule>(this); | 51 | m_scene.RegisterModuleInterface<IDialogModule>(this); |
52 | 52 | ||
53 | m_scene.AddCommand( | 53 | m_scene.AddCommand( |
54 | this, "alert", "alert <first> <last> <message>", | 54 | this, "alert", "alert <message>", |
55 | "Send an alert to a user", | 55 | "Send an alert to everyone", |
56 | HandleAlertConsoleCommand); | 56 | HandleAlertConsoleCommand); |
57 | 57 | ||
58 | m_scene.AddCommand( | 58 | m_scene.AddCommand( |
59 | this, "alert general", "alert [general] <message>", | 59 | this, "alert-user", "alert-user <first> <last> <message>", |
60 | "Send an alert to everyone", | 60 | "Send an alert to a user", |
61 | "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.", | ||
62 | HandleAlertConsoleCommand); | 61 | HandleAlertConsoleCommand); |
63 | } | 62 | } |
64 | 63 | ||
@@ -177,55 +176,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
177 | { | 176 | { |
178 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) | 177 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) |
179 | return; | 178 | return; |
180 | 179 | ||
181 | bool isGeneral = false; | ||
182 | string firstName = string.Empty; | ||
183 | string lastName = string.Empty; | ||
184 | string message = string.Empty; | 180 | string message = string.Empty; |
185 | 181 | ||
186 | if (cmdparams.Length > 1) | 182 | if (cmdparams[0].ToLower().Equals("alert")) |
187 | { | ||
188 | firstName = cmdparams[1]; | ||
189 | isGeneral = firstName.ToLower().Equals("general"); | ||
190 | } | ||
191 | if (cmdparams.Length == 2 && !isGeneral) | ||
192 | { | 183 | { |
193 | // alert "message" | 184 | message = CombineParams(cmdparams, 1); |
194 | message = cmdparams[1]; | 185 | m_log.InfoFormat("[DIALOG]: Sending general alert in region {0} with message {1}", |
195 | isGeneral = true; | 186 | m_scene.RegionInfo.RegionName, message); |
196 | } | 187 | SendGeneralAlert(message); |
197 | else if (cmdparams.Length > 2 && isGeneral) | ||
198 | { | ||
199 | // alert general <message> | ||
200 | message = CombineParams(cmdparams, 2); | ||
201 | } | 188 | } |
202 | else if (cmdparams.Length > 3) | 189 | else if (cmdparams.Length > 3) |
203 | { | 190 | { |
204 | // alert <first> <last> <message> | 191 | string firstName = cmdparams[1]; |
205 | lastName = cmdparams[2]; | 192 | string lastName = cmdparams[2]; |
206 | message = CombineParams(cmdparams, 3); | 193 | message = CombineParams(cmdparams, 3); |
194 | m_log.InfoFormat( | ||
195 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | ||
196 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | ||
197 | SendAlertToUser(firstName, lastName, message, false); | ||
207 | } | 198 | } |
208 | else | 199 | else |
209 | { | 200 | { |
210 | OpenSim.Framework.Console.MainConsole.Instance.Output( | 201 | OpenSim.Framework.Console.MainConsole.Instance.Output( |
211 | "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>"); | 202 | "Usage: alert <message> | alert-user <first> <last> <message>"); |
212 | return; | 203 | return; |
213 | } | 204 | } |
214 | |||
215 | if (isGeneral) | ||
216 | { | ||
217 | m_log.InfoFormat( | ||
218 | "[DIALOG]: Sending general alert in region {0} with message {1}", | ||
219 | m_scene.RegionInfo.RegionName, message); | ||
220 | SendGeneralAlert(message); | ||
221 | } | ||
222 | else | ||
223 | { | ||
224 | m_log.InfoFormat( | ||
225 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | ||
226 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | ||
227 | SendAlertToUser(firstName, lastName, message, false); | ||
228 | } | ||
229 | } | 205 | } |
230 | 206 | ||
231 | private string CombineParams(string[] commandParams, int pos) | 207 | private string CombineParams(string[] commandParams, int pos) |