aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs122
1 files changed, 120 insertions, 2 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 5a23c90..9f6414b 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -125,6 +125,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
125 availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod; 125 availableMethods["admin_region_query"] = XmlRpcRegionQueryMethod;
126 availableMethods["admin_shutdown"] = XmlRpcShutdownMethod; 126 availableMethods["admin_shutdown"] = XmlRpcShutdownMethod;
127 availableMethods["admin_broadcast"] = XmlRpcAlertMethod; 127 availableMethods["admin_broadcast"] = XmlRpcAlertMethod;
128 availableMethods["admin_dialog"] = XmlRpcDialogMethod;
128 availableMethods["admin_restart"] = XmlRpcRestartMethod; 129 availableMethods["admin_restart"] = XmlRpcRestartMethod;
129 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; 130 availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod;
130 // User management 131 // User management
@@ -214,9 +215,59 @@ namespace OpenSim.ApplicationPlugins.RemoteController
214 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene)) 215 if (!m_app.SceneManager.TryGetScene(regionID, out rebootedScene))
215 throw new Exception("region not found"); 216 throw new Exception("region not found");
216 217
218 int timeout = 30000;
219 string message;
220
221 if (requestData.ContainsKey("restart")
222 && ((string)requestData["restart"] == "delayed")
223 && requestData.ContainsKey("milliseconds"))
224 {
225 timeout = Int32.Parse(requestData["milliseconds"].ToString());
226
227 if (timeout < 15000)
228 {
229 //It must be at least 15 seconds or we'll cancel the reboot request
230 timeout = 15000;
231 }
232
233 message
234 = "Region is restarting in " + ((int)(timeout / 1000)).ToString()
235 + " second(s). Please save what you are doing and log out.";
236 }
237 else
238 {
239 message = "Region is restarting in 30 second(s). Please save what you are doing and log out.";
240 }
241
242 if (requestData.ContainsKey("noticetype")
243 && ((string)requestData["noticetype"] == "dialog"))
244 {
245 m_app.SceneManager.ForEachScene(
246 delegate(Scene scene)
247 {
248 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
249 if (dialogModule != null)
250 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
251 });
252 }
253 else
254 {
255 if (!requestData.ContainsKey("noticetype")
256 || ((string)requestData["noticetype"] != "none"))
257 {
258 m_app.SceneManager.ForEachScene(
259 delegate(Scene scene)
260 {
261 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
262 if (dialogModule != null)
263 dialogModule.SendGeneralAlert(message);
264 });
265 }
266 }
267
217 responseData["rebooting"] = true; 268 responseData["rebooting"] = true;
218 response.Value = responseData; 269 response.Value = responseData;
219 rebootedScene.Restart(30); 270 rebootedScene.Restart(timeout / 1000,false);
220 } 271 }
221 catch (Exception e) 272 catch (Exception e)
222 { 273 {
@@ -279,6 +330,53 @@ namespace OpenSim.ApplicationPlugins.RemoteController
279 m_log.Info("[RADMIN]: Alert request complete"); 330 m_log.Info("[RADMIN]: Alert request complete");
280 return response; 331 return response;
281 } 332 }
333 public XmlRpcResponse XmlRpcDialogMethod(XmlRpcRequest request, IPEndPoint remoteClient)
334 {
335 XmlRpcResponse response = new XmlRpcResponse();
336 Hashtable responseData = new Hashtable();
337
338 m_log.Info("[RADMIN]: Dialog request started");
339
340 try
341 {
342 Hashtable requestData = (Hashtable)request.Params[0];
343
344 checkStringParameters(request, new string[] { "password", "from", "message" });
345
346 if (m_requiredPassword != String.Empty &&
347 (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword))
348 throw new Exception("wrong password");
349
350 string message = (string)requestData["message"];
351 string fromuuid = (string)requestData["from"];
352 m_log.InfoFormat("[RADMIN]: Broadcasting: {0}", message);
353
354 responseData["accepted"] = true;
355 responseData["success"] = true;
356 response.Value = responseData;
357
358 m_app.SceneManager.ForEachScene(
359 delegate(Scene scene)
360 {
361 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
362 if (dialogModule != null)
363 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, fromuuid, message);
364 });
365 }
366 catch (Exception e)
367 {
368 m_log.ErrorFormat("[RADMIN]: Broadcasting: failed: {0}", e.Message);
369 m_log.DebugFormat("[RADMIN]: Broadcasting: failed: {0}", e.ToString());
370
371 responseData["accepted"] = false;
372 responseData["success"] = false;
373 responseData["error"] = e.Message;
374 response.Value = responseData;
375 }
376
377 m_log.Info("[RADMIN]: Alert request complete");
378 return response;
379 }
282 380
283 public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) 381 public XmlRpcResponse XmlRpcLoadHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient)
284 { 382 {
@@ -386,13 +484,33 @@ namespace OpenSim.ApplicationPlugins.RemoteController
386 message = "Region is going down now."; 484 message = "Region is going down now.";
387 } 485 }
388 486
389 m_app.SceneManager.ForEachScene( 487 if (requestData.ContainsKey("noticetype")
488 && ((string) requestData["noticetype"] == "dialog"))
489 {
490 m_app.SceneManager.ForEachScene(
390 delegate(Scene scene) 491 delegate(Scene scene)
391 { 492 {
392 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>(); 493 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
393 if (dialogModule != null) 494 if (dialogModule != null)
495 dialogModule.SendNotificationToUsersInRegion(UUID.Zero, "System", message);
496 });
497 }
498 else
499 {
500 if (!requestData.ContainsKey("noticetype")
501 || ((string)requestData["noticetype"] != "none"))
502 {
503 m_app.SceneManager.ForEachScene(
504 delegate(Scene scene)
505 {
506 IDialogModule dialogModule = scene.RequestModuleInterface<IDialogModule>();
507 if (dialogModule != null)
394 dialogModule.SendGeneralAlert(message); 508 dialogModule.SendGeneralAlert(message);
395 }); 509 });
510 }
511 }
512
513
396 514
397 // Perform shutdown 515 // Perform shutdown
398 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing 516 System.Timers.Timer shutdownTimer = new System.Timers.Timer(timeout); // Wait before firing