diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 69 |
1 files changed, 65 insertions, 4 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index fc57386..1c924c0 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -86,6 +86,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
86 | m_httpd = openSim.HttpServer; | 86 | m_httpd = openSim.HttpServer; |
87 | 87 | ||
88 | m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); | 88 | m_httpd.AddXmlRPCHandler("admin_create_region", XmlRpcCreateRegionMethod); |
89 | m_httpd.AddXmlRPCHandler("admin_delete_region", XmlRpcDeleteRegionMethod); | ||
89 | m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); | 90 | m_httpd.AddXmlRPCHandler("admin_shutdown", XmlRpcShutdownMethod); |
90 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); | 91 | m_httpd.AddXmlRPCHandler("admin_broadcast", XmlRpcAlertMethod); |
91 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); | 92 | m_httpd.AddXmlRPCHandler("admin_restart", XmlRpcRestartMethod); |
@@ -344,8 +345,6 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
344 | /// <description>internal port (integer)</description></item> | 345 | /// <description>internal port (integer)</description></item> |
345 | /// <item><term>external_address</term> | 346 | /// <item><term>external_address</term> |
346 | /// <description>external IP address</description></item> | 347 | /// <description>external IP address</description></item> |
347 | /// <item><term>datastore</term> | ||
348 | /// <description>datastore parameter (?)</description></item> | ||
349 | /// <item><term>persist</term> | 348 | /// <item><term>persist</term> |
350 | /// <description>if true, persist the region info | 349 | /// <description>if true, persist the region info |
351 | /// ('true' or 'false')</description></item> | 350 | /// ('true' or 'false')</description></item> |
@@ -378,7 +377,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
378 | "region_master_first", "region_master_last", | 377 | "region_master_first", "region_master_last", |
379 | "region_master_password", | 378 | "region_master_password", |
380 | "listen_ip", "external_address"}); | 379 | "listen_ip", "external_address"}); |
381 | checkIntegerParams(request, new string[] { "region_x", "region_y", "listen_port"}); | 380 | checkIntegerParams(request, new string[] {"region_x", "region_y", "listen_port"}); |
382 | 381 | ||
383 | // check password | 382 | // check password |
384 | if (!String.IsNullOrEmpty(requiredPassword) && | 383 | if (!String.IsNullOrEmpty(requiredPassword) && |
@@ -390,7 +389,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
390 | if (requestData.ContainsKey("region_id") && | 389 | if (requestData.ContainsKey("region_id") && |
391 | !String.IsNullOrEmpty((string)requestData["region_id"])) | 390 | !String.IsNullOrEmpty((string)requestData["region_id"])) |
392 | { | 391 | { |
393 | regionID = (string) requestData["region_id"]; | 392 | regionID = (string)requestData["region_id"]; |
394 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) | 393 | if (m_app.SceneManager.TryGetScene(regionID, out scene)) |
395 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", | 394 | throw new Exception(String.Format("region UUID already in use by region {0}, UUID {1}, <{2},{3}>", |
396 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, | 395 | scene.RegionInfo.RegionName, scene.RegionInfo.RegionID, |
@@ -493,6 +492,68 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
493 | } | 492 | } |
494 | 493 | ||
495 | /// <summary> | 494 | /// <summary> |
495 | /// Delete a new region. | ||
496 | /// <summary> | ||
497 | /// <param name="request">incoming XML RPC request</param> | ||
498 | /// <remarks> | ||
499 | /// XmlRpcCreateRegionMethod takes the following XMLRPC | ||
500 | /// parameters | ||
501 | /// <list type="table"> | ||
502 | /// <listheader><term>parameter name</term><description>description</description></listheader> | ||
503 | /// <item><term>password</term> | ||
504 | /// <description>admin password as set in OpenSim.ini</description></item> | ||
505 | /// <item><term>region_name</term> | ||
506 | /// <description>desired region name</description></item> | ||
507 | /// <item><term>region_id</term> | ||
508 | /// <description>(optional) desired region UUID</description></item> | ||
509 | /// </list> | ||
510 | /// | ||
511 | /// XmlRpcCreateRegionMethod returns | ||
512 | /// <list type="table"> | ||
513 | /// <listheader><term>name</term><description>description</description></listheader> | ||
514 | /// <item><term>success</term> | ||
515 | /// <description>true or false</description></item> | ||
516 | /// <item><term>error</term> | ||
517 | /// <description>error message if success is false</description></item> | ||
518 | /// </list> | ||
519 | /// </remarks> | ||
520 | public XmlRpcResponse XmlRpcDeleteRegionMethod(XmlRpcRequest request) | ||
521 | { | ||
522 | m_log.Info("[RADMIN]: DeleteRegion: new request"); | ||
523 | XmlRpcResponse response = new XmlRpcResponse(); | ||
524 | Hashtable responseData = new Hashtable(); | ||
525 | |||
526 | try { | ||
527 | Hashtable requestData = (Hashtable) request.Params[0]; | ||
528 | checkStringParameters(request, new string[] {"password", "region_name"}); | ||
529 | |||
530 | Scene scene = null; | ||
531 | string regionName = (string)requestData["region_name"]; | ||
532 | if (!m_app.SceneManager.TryGetScene(regionName, out scene)) | ||
533 | throw new Exception(String.Format("region \"{0}\" does not exist", regionName)); | ||
534 | |||
535 | m_app.RemoveRegion(scene, true); | ||
536 | |||
537 | responseData["success"] = "true"; | ||
538 | responseData["region_name"] = regionName; | ||
539 | |||
540 | response.Value = responseData; | ||
541 | } | ||
542 | catch (Exception e) | ||
543 | { | ||
544 | m_log.ErrorFormat("[RADMIN] DeleteRegion: failed {0}", e.Message); | ||
545 | m_log.DebugFormat("[RADMIN] DeleteRegion: failed {0}", e.ToString()); | ||
546 | |||
547 | responseData["success"] = "false"; | ||
548 | responseData["error"] = e.Message; | ||
549 | |||
550 | response.Value = responseData; | ||
551 | } | ||
552 | |||
553 | return response; | ||
554 | } | ||
555 | |||
556 | /// <summary> | ||
496 | /// Create a new user account. | 557 | /// Create a new user account. |
497 | /// <summary> | 558 | /// <summary> |
498 | /// <param name="request">incoming XML RPC request</param> | 559 | /// <param name="request">incoming XML RPC request</param> |