diff options
author | Melanie | 2011-04-17 21:43:16 +0100 |
---|---|---|
committer | Melanie | 2011-04-17 21:43:16 +0100 |
commit | 03e725ad87916965ebcd8cb264f7a614342da9b7 (patch) | |
tree | d0a9624a581f8dc5aeadcd7a7c8ef55ad533a76d /OpenSim/ApplicationPlugins/RemoteController | |
parent | More descriptive debug msg for ServiceOSDRequest failures. (diff) | |
download | opensim-SC_OLD-03e725ad87916965ebcd8cb264f7a614342da9b7.zip opensim-SC_OLD-03e725ad87916965ebcd8cb264f7a614342da9b7.tar.gz opensim-SC_OLD-03e725ad87916965ebcd8cb264f7a614342da9b7.tar.bz2 opensim-SC_OLD-03e725ad87916965ebcd8cb264f7a614342da9b7.tar.xz |
Mantis #5442: Add admin_save_heightmap
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 dc4309f..5a011ce 100644 --- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs +++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs | |||
@@ -130,6 +130,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
130 | availableMethods["admin_broadcast"] = XmlRpcAlertMethod; | 130 | availableMethods["admin_broadcast"] = XmlRpcAlertMethod; |
131 | availableMethods["admin_restart"] = XmlRpcRestartMethod; | 131 | availableMethods["admin_restart"] = XmlRpcRestartMethod; |
132 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; | 132 | availableMethods["admin_load_heightmap"] = XmlRpcLoadHeightmapMethod; |
133 | availableMethods["admin_save_heightmap"] = XmlRpcSaveHeightmapMethod; | ||
133 | // User management | 134 | // User management |
134 | availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; | 135 | availableMethods["admin_create_user"] = XmlRpcCreateUserMethod; |
135 | availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; | 136 | availableMethods["admin_create_user_email"] = XmlRpcCreateUserMethod; |
@@ -357,6 +358,61 @@ namespace OpenSim.ApplicationPlugins.RemoteController | |||
357 | return response; | 358 | return response; |
358 | } | 359 | } |
359 | 360 | ||
361 | public XmlRpcResponse XmlRpcSaveHeightmapMethod(XmlRpcRequest request, IPEndPoint remoteClient) | ||
362 | |||
363 | { | ||
364 | XmlRpcResponse response = new XmlRpcResponse(); | ||
365 | Hashtable responseData = new Hashtable(); | ||
366 | |||
367 | m_log.Info("[RADMIN]: Save height maps request started"); | ||
368 | |||
369 | try | ||
370 | { | ||
371 | Hashtable requestData = (Hashtable)request.Params[0]; | ||
372 | |||
373 | m_log.DebugFormat("[RADMIN]: Save Terrain: XmlRpc {0}", request.ToString()); | ||
374 | |||
375 | CheckStringParameters(request, new string[] { "password", "filename", "regionid" }); | ||
376 | |||
377 | if (m_requiredPassword != String.Empty && | ||
378 | (!requestData.Contains("password") || (string)requestData["password"] != m_requiredPassword)) | ||
379 | throw new Exception("wrong password"); | ||
380 | |||
381 | string file = (string)requestData["filename"]; | ||
382 | UUID regionID = (UUID)(string)requestData["regionid"]; | ||
383 | m_log.InfoFormat("[RADMIN]: Terrain Saving: {0}", file); | ||
384 | |||
385 | responseData["accepted"] = true; | ||
386 | |||
387 | Scene region = null; | ||
388 | |||
389 | if (!m_application.SceneManager.TryGetScene(regionID, out region)) | ||
390 | throw new Exception("1: unable to get a scene with that name"); | ||
391 | |||
392 | ITerrainModule terrainModule = region.RequestModuleInterface<ITerrainModule>(); | ||
393 | if (null == terrainModule) throw new Exception("terrain module not available"); | ||
394 | |||
395 | terrainModule.SaveToFile(file); | ||
396 | |||
397 | responseData["success"] = false; | ||
398 | |||
399 | response.Value = responseData; | ||
400 | } | ||
401 | catch (Exception e) | ||
402 | { | ||
403 | m_log.ErrorFormat("[RADMIN]: Terrain Saving: failed: {0}", e.Message); | ||
404 | m_log.DebugFormat("[RADMIN]: Terrain Saving: failed: {0}", e.ToString()); | ||
405 | |||
406 | responseData["success"] = false; | ||
407 | responseData["error"] = e.Message; | ||
408 | |||
409 | } | ||
410 | |||
411 | m_log.Info("[RADMIN]: Save height maps request complete"); | ||
412 | |||
413 | return response; | ||
414 | } | ||
415 | |||
360 | public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) | 416 | public XmlRpcResponse XmlRpcShutdownMethod(XmlRpcRequest request, IPEndPoint remoteClient) |
361 | { | 417 | { |
362 | m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); | 418 | m_log.Info("[RADMIN]: Received Shutdown Administrator Request"); |