aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/RemoteController
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/ApplicationPlugins/RemoteController')
-rw-r--r--OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs99
1 files changed, 90 insertions, 9 deletions
diff --git a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
index 9451f00..fc57386 100644
--- a/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
+++ b/OpenSim/ApplicationPlugins/RemoteController/RemoteAdminPlugin.cs
@@ -93,6 +93,7 @@ namespace OpenSim.ApplicationPlugins.RemoteController
93 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod); 93 m_httpd.AddXmlRPCHandler("admin_create_user", XmlRpcCreateUserMethod);
94 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod); 94 m_httpd.AddXmlRPCHandler("admin_update_user", XmlRpcUpdateUserAccountMethod);
95 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod); 95 m_httpd.AddXmlRPCHandler("admin_load_xml", XmlRpcLoadXMLMethod);
96 m_httpd.AddXmlRPCHandler("admin_save_xml", XmlRpcSaveXMLMethod);
96 m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod); 97 m_httpd.AddXmlRPCHandler("admin_load_oar", XmlRpcLoadOARMethod);
97 } 98 }
98 } 99 }
@@ -832,20 +833,19 @@ namespace OpenSim.ApplicationPlugins.RemoteController
832 833
833 switch (xml_version) 834 switch (xml_version)
834 { 835 {
835 case "1": 836 case "1":
836 m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0)); 837 m_app.SceneManager.LoadCurrentSceneFromXml(filename, true, new Vector3(0, 0, 0));
837 break; 838 break;
838 839
839 case "2": 840 case "2":
840 m_app.SceneManager.LoadCurrentSceneFromXml2(filename); 841 m_app.SceneManager.LoadCurrentSceneFromXml2(filename);
841 break; 842 break;
842 843
843 default: 844 default:
844 throw new Exception(String.Format("unknown Xml{0} format", xml_version)); 845 throw new Exception(String.Format("unknown Xml{0} format", xml_version));
845 } 846 }
846 847
847 responseData["loaded"] = "true"; 848 responseData["loaded"] = "true";
848
849 response.Value = responseData; 849 response.Value = responseData;
850 } 850 }
851 catch (Exception e) 851 catch (Exception e)
@@ -864,6 +864,87 @@ namespace OpenSim.ApplicationPlugins.RemoteController
864 } 864 }
865 865
866 866
867 public XmlRpcResponse XmlRpcSaveXMLMethod(XmlRpcRequest request)
868 {
869 m_log.Info("[RADMIN]: Received Save XML Administrator Request");
870 XmlRpcResponse response = new XmlRpcResponse();
871 Hashtable responseData = new Hashtable();
872
873 try
874 {
875 Hashtable requestData = (Hashtable)request.Params[0];
876
877 // check completeness
878 foreach (string p in new string[] { "password", "filename" })
879 {
880 if (!requestData.Contains(p))
881 throw new Exception(String.Format("missing parameter {0}", p));
882 if (String.IsNullOrEmpty((string)requestData[p]))
883 throw new Exception(String.Format("parameter {0} is empty"));
884 }
885
886 // check password
887 if (!String.IsNullOrEmpty(requiredPassword) &&
888 (string)requestData["password"] != requiredPassword) throw new Exception("wrong password");
889
890 string filename = (string)requestData["filename"];
891 if (requestData.Contains("region_uuid"))
892 {
893 UUID region_uuid = (string)requestData["region_uuid"];
894 if (!m_app.SceneManager.TrySetCurrentScene(region_uuid))
895 throw new Exception(String.Format("failed to switch to region {0}", region_uuid.ToString()));
896 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_uuid.ToString());
897 }
898 else if (requestData.Contains("region_name"))
899 {
900 string region_name = (string)requestData["region_name"];
901 if (!m_app.SceneManager.TrySetCurrentScene(region_name))
902 throw new Exception(String.Format("failed to switch to region {0}", region_name));
903 m_log.InfoFormat("[RADMIN] Switched to region {0}", region_name);
904 }
905 else throw new Exception("neither region_name nor region_uuid given");
906
907 responseData["switched"] = "true";
908
909 string xml_version = "1";
910 if (requestData.Contains("xml_version"))
911 {
912 xml_version = (string)requestData["xml_version"];
913 }
914
915 switch (xml_version)
916 {
917 case "1":
918 m_app.SceneManager.SaveCurrentSceneToXml(filename);
919 break;
920
921 case "2":
922 m_app.SceneManager.SaveCurrentSceneToXml2(filename);
923 break;
924
925 default:
926 throw new Exception(String.Format("unknown Xml{0} format", xml_version));
927 }
928
929 responseData["saved"] = "true";
930
931 response.Value = responseData;
932 }
933 catch (Exception e)
934 {
935 m_log.InfoFormat("[RADMIN] LoadXml: {0}", e.Message);
936 m_log.DebugFormat("[RADMIN] LoadXml: {0}", e.ToString());
937
938 responseData["loaded"] = "false";
939 responseData["switched"] = "false";
940 responseData["error"] = e.Message;
941
942 response.Value = responseData;
943 }
944
945 return response;
946 }
947
867 public void Dispose() 948 public void Dispose()
868 { 949 {
869 } 950 }