diff options
author | Marck | 2010-08-17 20:54:51 +0200 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-08-20 17:53:21 +0100 |
commit | bb5dd9fbbc39d2023c29ecc9deecd06523c7e467 (patch) | |
tree | 079524b38fb541c4dc293d6e9b231ac775df11b6 /OpenSim/Region/CoreModules | |
parent | Cleaned up a few more things related to incoming agents. (diff) | |
download | opensim-SC-bb5dd9fbbc39d2023c29ecc9deecd06523c7e467.zip opensim-SC-bb5dd9fbbc39d2023c29ecc9deecd06523c7e467.tar.gz opensim-SC-bb5dd9fbbc39d2023c29ecc9deecd06523c7e467.tar.bz2 opensim-SC-bb5dd9fbbc39d2023c29ecc9deecd06523c7e467.tar.xz |
Some code cleanup for console command alert.
Made parsing of parameters more robust.
Allow general alerts without specifying keyword 'general'.
Extended help texts.
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs index 2105f3c..2b3d2a9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Dialog/DialogModule.cs | |||
@@ -51,10 +51,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
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>", "Send an alert to a user", HandleAlertConsoleCommand); | 54 | this, "alert", "alert <first> <last> <message>", |
55 | "Send an alert to a user", | ||
56 | HandleAlertConsoleCommand); | ||
55 | 57 | ||
56 | m_scene.AddCommand( | 58 | m_scene.AddCommand( |
57 | this, "alert general", "alert general <message>", "Send an alert to everyone", HandleAlertConsoleCommand); | 59 | this, "alert general", "alert [general] <message>", |
60 | "Send an alert to everyone", | ||
61 | "If keyword 'general' is omitted, then <message> must be surrounded by quotation marks.", | ||
62 | HandleAlertConsoleCommand); | ||
58 | } | 63 | } |
59 | 64 | ||
60 | public void PostInitialise() {} | 65 | public void PostInitialise() {} |
@@ -173,20 +178,49 @@ namespace OpenSim.Region.CoreModules.Avatar.Dialog | |||
173 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) | 178 | if (m_scene.ConsoleScene() != null && m_scene.ConsoleScene() != m_scene) |
174 | return; | 179 | return; |
175 | 180 | ||
176 | if (cmdparams[1] == "general") | 181 | bool isGeneral = false; |
182 | string firstName = string.Empty; | ||
183 | string lastName = string.Empty; | ||
184 | string message = string.Empty; | ||
185 | |||
186 | if (cmdparams.Length > 1) | ||
187 | { | ||
188 | firstName = cmdparams[1]; | ||
189 | isGeneral = firstName.ToLower().Equals("general"); | ||
190 | } | ||
191 | if (cmdparams.Length == 2 && !isGeneral) | ||
192 | { | ||
193 | // alert "message" | ||
194 | message = cmdparams[1]; | ||
195 | isGeneral = true; | ||
196 | } | ||
197 | else if (cmdparams.Length > 2 && isGeneral) | ||
198 | { | ||
199 | // alert general <message> | ||
200 | message = CombineParams(cmdparams, 2); | ||
201 | } | ||
202 | else if (cmdparams.Length > 3) | ||
177 | { | 203 | { |
178 | string message = CombineParams(cmdparams, 2); | 204 | // alert <first> <last> <message> |
205 | lastName = cmdparams[2]; | ||
206 | message = CombineParams(cmdparams, 3); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | OpenSim.Framework.Console.MainConsole.Instance.Output( | ||
211 | "Usage: alert \"message\" | alert general <message> | alert <first> <last> <message>"); | ||
212 | return; | ||
213 | } | ||
179 | 214 | ||
215 | if (isGeneral) | ||
216 | { | ||
180 | m_log.InfoFormat( | 217 | m_log.InfoFormat( |
181 | "[DIALOG]: Sending general alert in region {0} with message {1}", m_scene.RegionInfo.RegionName, message); | 218 | "[DIALOG]: Sending general alert in region {0} with message {1}", |
219 | m_scene.RegionInfo.RegionName, message); | ||
182 | SendGeneralAlert(message); | 220 | SendGeneralAlert(message); |
183 | } | 221 | } |
184 | else | 222 | else |
185 | { | 223 | { |
186 | string firstName = cmdparams[1]; | ||
187 | string lastName = cmdparams[2]; | ||
188 | string message = CombineParams(cmdparams, 3); | ||
189 | |||
190 | m_log.InfoFormat( | 224 | m_log.InfoFormat( |
191 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", | 225 | "[DIALOG]: Sending alert in region {0} to {1} {2} with message {3}", |
192 | m_scene.RegionInfo.RegionName, firstName, lastName, message); | 226 | m_scene.RegionInfo.RegionName, firstName, lastName, message); |