diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 7b931d7..7be152b 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -209,68 +209,43 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
209 | 209 | ||
210 | UUID regionID = new UUID((string) requestData["regionID"]); | 210 | UUID regionID = new UUID((string) requestData["regionID"]); |
211 | 211 | ||
212 | responseData["accepted"] = true; | ||
213 | responseData["success"] = true; | ||
214 | response.Value = responseData; | ||
215 | |||
216 | Scene rebootedScene; | 212 | Scene rebootedScene; |
217 | 213 | ||
214 | responseData["success"] = false; | ||
215 | responseData["accepted"] = true; | ||
218 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) | 216 | if (!m_application.SceneManager.TryGetScene(regionID, out rebootedScene)) |
219 | throw new Exception("region not found"); | 217 | throw new Exception("region not found"); |
220 | 218 | ||
221 | int timeout = 30000; | 219 | int timeout = 30; |
222 | string message; | 220 | string message; |
223 | 221 | ||
224 | if (requestData.ContainsKey("restart") | 222 | if (requestData.ContainsKey("restart") |
225 | && ((string)requestData["restart"] == "delayed") | 223 | && ((string)requestData["restart"] == "delayed") |
226 | && requestData.ContainsKey("milliseconds")) | 224 | && requestData.ContainsKey("milliseconds")) |
227 | { | 225 | { |
228 | timeout = Int32.Parse(requestData["milliseconds"].ToString()); | 226 | timeout = Int32.Parse(requestData["milliseconds"].ToString()) / 1000; |
229 | |||
230 | if (timeout < 15000) | ||
231 | { | ||
232 | //It must be at least 15 seconds or we'll cancel the reboot request | ||
233 | timeout = 15000; | ||
234 | } | ||
235 | |||
236 | message | ||
237 | = "Region is restarting in " + ((int)(timeout / 1000)).ToString() | ||
238 | + " second(s). Please save what you are doing and log out."; | ||
239 | } | ||
240 | else | ||
241 | { | ||
242 | message = "Region is restarting in 30 second(s). Please save what you are doing and log out."; | ||
243 | } | 227 | } |
244 | 228 | ||
229 | message = "Region is restarting in {0}. Please save what you are doing and log out."; | ||
230 | |||
231 | bool notice = true; | ||
245 | if (requestData.ContainsKey("noticetype") | 232 | if (requestData.ContainsKey("noticetype") |
246 | && ((string)requestData["noticetype"] == "dialog")) | 233 | && ((string)requestData["noticetype"] == "dialog")) |
247 | { | 234 | { |
248 | m_application.SceneManager.ForEachScene( | 235 | notice = false; |
249 | delegate(Scene scene) | ||
250 | { | ||
251 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
252 | if (dialogModule != null) | ||
253 | dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message); | ||
254 | }); | ||
255 | } | ||
256 | else | ||
257 | { | ||
258 | if (!requestData.ContainsKey("noticetype") | ||
259 | || ((string)requestData["noticetype"] != "none")) | ||
260 | { | ||
261 | m_application.SceneManager.ForEachScene( | ||
262 | delegate(Scene scene) | ||
263 | { | ||
264 | IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); | ||
265 | if (dialogModule != null) | ||
266 | dialogModule.SendGeneralAlert(message); | ||
267 | }); | ||
268 | } | ||
269 | } | 236 | } |
270 | 237 | ||
271 | responseData["rebooting"] = true; | 238 | responseData["rebooting"] = true; |
239 | |||
240 | IRestartModule restartModule = rebootedScene.RequestModuleInterface<IRestartModule>(); | ||
241 | if (restartModule != null) | ||
242 | { | ||
243 | List<int> times = new List<int> { 30, 15 }; | ||
244 | |||
245 | restartModule.ScheduleRestart(UUID.Zero, "Region will restart in {0}", times.ToArray(), notice); | ||
246 | responseData["success"] = true; | ||
247 | } | ||
272 | response.Value = responseData; | 248 | response.Value = responseData; |
273 | rebootedScene.Restart(timeout / 1000,false); | ||
274 | } | 249 | } |
275 | catch (Exception e) | 250 | catch (Exception e) |
276 | { | 251 | { |