diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 7be152b..27e73f6 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -216,18 +216,41 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
216 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) | 216 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) |
217 | throw new Exception("region not found"); | 217 | throw new Exception("region not found"); |
218 | 218 | ||
219 | int timeout = 30; | ||
220 | string message; | 219 | string message; |
220 | List<int> times = new List<int>(); | ||
221 | 221 | ||
222 | if (requestData.ContainsKey("restart") | 222 | if (requestData.ContainsKey("alerts")) |
223 | && ((string)requestData["restart"] == "delayed") | ||
224 | && requestData.ContainsKey("milliseconds")) | ||
225 | { | 223 | { |
226 | timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000; | 224 | string[] alertTimes = requestData["alerts"].ToString().Split( new char[] {','}); |
225 | foreach (string a in alertTimes) | ||
226 | times.Add(Convert.ToInt32(a)); | ||
227 | } | 227 | } |
228 | else | ||
229 | { | ||
230 | int timeout = 30; | ||
231 | if (requestData.ContainsKey("milliseconds")) | ||
232 | timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000; | ||
233 | while (timeout > 0) | ||
234 | { | ||
235 | times.Add(timeout); | ||
236 | if (timeout > 300) | ||
237 | timeout -= 120; | ||
238 | else if (timeout > 30) | ||
239 | timeout -= 30; | ||
240 | else | ||
241 | timeout -= 15; | ||
242 | } | ||
243 | } | ||
244 | |||
245 | if (requestData.ContainsKey("restart") | ||
246 | && ((string)requestData["restart"] == "delayed")) | ||
247 | |||
228 | 248 | ||
229 | message = "Region is restarting in {0}. Please save what you are doing and log out."; | 249 | message = "Region is restarting in {0}. Please save what you are doing and log out."; |
230 | 250 | ||
251 | if (requestData.ContainsKey("message")) | ||
252 | message = requestData["message"].ToString(); | ||
253 | |||
231 | bool notice = true; | 254 | bool notice = true; |
232 | if (requestData.ContainsKey("noticetype") | 255 | if (requestData.ContainsKey("noticetype") |
233 | && ((string)requestData["noticetype"] == "dialog")) | 256 | && ((string)requestData["noticetype"] == "dialog")) |
@@ -240,9 +263,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
240 | IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); | 263 | IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); |
241 | if (restartModule != null) | 264 | if (restartModule != null) |
242 | { | 265 | { |
243 | List<int> times = new List<int> { 30, 15 }; | 266 | restartModule.ScheduleRestart(UUID.Zero, message, times.ToArray(), notice); |
244 | |||
245 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), notice); | ||
246 | responseData["success"] = true; | 267 | responseData["success"] = true; |
247 | } | 268 | } |
248 | response.Value = responseData; | 269 | response.Value = responseData; |