diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r-- | OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs index 10cd3d5..7529e01 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -131,6 +131,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
131 | availableMethods["admin_dialog"] = XmlRpcDialogMethod; | 131 | availableMethods["admin_dialog"] = XmlRpcDialogMethod; |
132 | availableMethods["admin_restart"] = XmlRpcRestartMethod; | 132 | availableMethods["admin_restart"] = XmlRpcRestartMethod; |
133 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; | 133 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; |
134 | availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod; | ||
134 | // User management | 135 | // User management |
135 | availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; | 136 | availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; |
136 | availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; | 137 | availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; |
@@ -440,6 +441,61 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
440 | return response; | 441 | return response; |
441 | } | 442 | } |
442 | 443 | ||
444 | public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) | ||
445 | |||
446 | { | ||
447 | XmlRpcResponse response = new XmlRpcResponse(); | ||
448 | Hashtable responseData = new Hashtable(); | ||
449 | |||
450 | m_log.Info("[RADMIN]: Save height maps request started"); | ||
451 | |||
452 | try | ||
453 | { | ||
454 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
455 | |||
456 | m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); | ||
457 | |||
458 | CheckStringParameters(request, new string[] { "password", "filename", "regionid" }); | ||
459 | |||
460 | if (m_requiredPassword != String.Empty && | ||
461 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) | ||
462 | throw new Exception("wrong password"); | ||
463 | |||
464 | string file = (string)requestData["filename"]; | ||
465 | UUID regionID = (UUID)(string)requestData["regionid"]; | ||
466 | m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); | ||
467 | |||
468 | responseData["accepted"] = true; | ||
469 | |||
470 | Scene region = null; | ||
471 | |||
472 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
473 | throw new Exception("1: unable to get a scene with that name"); | ||
474 | |||
475 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
476 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
477 | |||
478 | terrainModule.SaveToFile(file); | ||
479 | |||
480 | responseData["success"] = false; | ||
481 | |||
482 | response.Value = responseData; | ||
483 | } | ||
484 | catch (Exception e) | ||
485 | { | ||
486 | m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message); | ||
487 | m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString()); | ||
488 | |||
489 | responseData["success"] = false; | ||
490 | responseData["error"] = e.Message; | ||
491 | |||
492 | } | ||
493 | |||
494 | m_log.Info("[RADMIN]: Save height maps request complete"); | ||
495 | |||
496 | return response; | ||
497 | } | ||
498 | |||
443 | public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 499 | public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
444 | { | 500 | { |
445 | m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); | 501 | m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); |